Skip to content

Commit

Permalink
[Components] Convert to native return types
Browse files Browse the repository at this point in the history
  • Loading branch information
wouterj authored and nicolas-grekas committed Jul 5, 2023
1 parent 7f036f9 commit 8266c81
Show file tree
Hide file tree
Showing 92 changed files with 214 additions and 773 deletions.
6 changes: 2 additions & 4 deletions AbstractExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function getTypeGuesser(): ?FormTypeGuesserInterface
*
* @return FormTypeInterface[]
*/
protected function loadTypes()
protected function loadTypes(): array
{
return [];
}
Expand All @@ -115,10 +115,8 @@ protected function loadTypeExtensions(): array

/**
* Registers the type guesser.
*
* @return FormTypeGuesserInterface|null
*/
protected function loadTypeGuesser()
protected function loadTypeGuesser(): ?FormTypeGuesserInterface
{
return null;
}
Expand Down
9 changes: 2 additions & 7 deletions AbstractRendererEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,7 @@ public function __construct(array $defaultThemes = [])
$this->defaultThemes = $defaultThemes;
}

/**
* @return void
*/
public function setTheme(FormView $view, mixed $themes, bool $useDefaultThemes = true)
public function setTheme(FormView $view, mixed $themes, bool $useDefaultThemes = true): void
{
$cacheKey = $view->vars[self::CACHE_KEY_VAR];

Expand Down Expand Up @@ -124,10 +121,8 @@ public function getResourceHierarchyLevel(FormView $view, array $blockNameHierar
* Loads the cache with the resource for a given block name.
*
* @see getResourceForBlock()
*
* @return bool
*/
abstract protected function loadResourceForBlockName(string $cacheKey, FormView $view, string $blockName);
abstract protected function loadResourceForBlockName(string $cacheKey, FormView $view, string $blockName): bool;

/**
* Loads the cache with the resource for a specific level of a block hierarchy.
Expand Down
30 changes: 6 additions & 24 deletions AbstractType.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,46 +20,28 @@
*/
abstract class AbstractType implements FormTypeInterface
{
/**
* @return void
*/
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
}

/**
* @return void
*/
public function buildView(FormView $view, FormInterface $form, array $options)
public function buildView(FormView $view, FormInterface $form, array $options): void
{
}

/**
* @return void
*/
public function finishView(FormView $view, FormInterface $form, array $options)
public function finishView(FormView $view, FormInterface $form, array $options): void
{
}

/**
* @return void
*/
public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): void
{
}

/**
* @return string
*/
public function getBlockPrefix()
public function getBlockPrefix(): string
{
return StringUtil::fqcnToBlockPrefix(static::class) ?: '';
}

/**
* @return string|null
*/
public function getParent()
public function getParent(): ?string
{
return FormType::class;
}
Expand Down
20 changes: 4 additions & 16 deletions AbstractTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,19 @@
*/
abstract class AbstractTypeExtension implements FormTypeExtensionInterface
{
/**
* @return void
*/
public function buildForm(FormBuilderInterface $builder, array $options)
public function buildForm(FormBuilderInterface $builder, array $options): void
{
}

/**
* @return void
*/
public function buildView(FormView $view, FormInterface $form, array $options)
public function buildView(FormView $view, FormInterface $form, array $options): void
{
}

/**
* @return void
*/
public function finishView(FormView $view, FormInterface $form, array $options)
public function finishView(FormView $view, FormInterface $form, array $options): void
{
}

/**
* @return void
*/
public function configureOptions(OptionsResolver $resolver)
public function configureOptions(OptionsResolver $resolver): void
{
}
}
Loading

0 comments on commit 8266c81

Please sign in to comment.