Skip to content

[Autocomplete] Add missing types #2265

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Autocomplete/src/AutocompleteBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*/
final class AutocompleteBundle extends Bundle
{
public function build(ContainerBuilder $container)
public function build(ContainerBuilder $container): void
{
$container->addCompilerPass(new AutocompleteFormTypePass());
}
Expand Down
3 changes: 3 additions & 0 deletions src/Autocomplete/src/AutocompleterRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public function getAutocompleter(string $alias): ?EntityAutocompleterInterface
return $this->autocompletersLocator->has($alias) ? $this->autocompletersLocator->get($alias) : null;
}

/**
* @return list<string>
*/
public function getAutocompleterNames(): array
{
return array_keys($this->autocompletersLocator->getProvidedServices());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
*/
final class AutocompleteExtension extends Extension implements PrependExtensionInterface
{
public function prepend(ContainerBuilder $container)
public function prepend(ContainerBuilder $container): void
{
$bundles = $container->getParameter('kernel.bundles');

Expand All @@ -61,7 +61,7 @@ public function prepend(ContainerBuilder $container)
}
}

public function load(array $configs, ContainerBuilder $container)
public function load(array $configs, ContainerBuilder $container): void
{
$this->registerBasicServices($container);
if (ContainerBuilder::willBeAvailable('symfony/form', Form::class, ['symfony/framework-bundle'])) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ class AutocompleteFormTypePass implements CompilerPassInterface
/** @var string Tag applied to EntityAutocompleterInterface classes */
public const ENTITY_AUTOCOMPLETER_TAG = 'ux.entity_autocompleter';

public function process(ContainerBuilder $container)
public function process(ContainerBuilder $container): void
{
$this->processEntityAutocompleteFieldTag($container);
$this->processEntityAutocompleterTag($container);
}

private function processEntityAutocompleteFieldTag(ContainerBuilder $container)
private function processEntityAutocompleteFieldTag(ContainerBuilder $container): void
{
foreach ($container->findTaggedServiceIds(self::ENTITY_AUTOCOMPLETE_FIELD_TAG, true) as $serviceId => $tag) {
$serviceDefinition = $container->getDefinition($serviceId);
Expand Down Expand Up @@ -68,7 +68,7 @@ private function getAlias(string $serviceId, Definition $serviceDefinition, arra
return $attribute->getAlias() ?: AsEntityAutocompleteField::shortName($class);
}

private function processEntityAutocompleterTag(ContainerBuilder $container)
private function processEntityAutocompleterTag(ContainerBuilder $container): void
{
$servicesMap = [];
foreach ($container->findTaggedServiceIds(self::ENTITY_AUTOCOMPLETER_TAG, true) as $serviceId => $tag) {
Expand Down
8 changes: 4 additions & 4 deletions src/Autocomplete/src/Maker/MakeAutocompleteField.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static function getCommandDescription(): string
return 'Generates an Ajax-autocomplete form field class for symfony/ux-autocomplete.';
}

public function configureCommand(Command $command, InputConfiguration $inputConfig)
public function configureCommand(Command $command, InputConfiguration $inputConfig): void
{
$command
->setHelp(<<<EOF
Expand All @@ -66,12 +66,12 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
;
}

public function configureDependencies(DependencyBuilder $dependencies)
public function configureDependencies(DependencyBuilder $dependencies): void
{
$dependencies->addClassDependency(FormInterface::class, 'symfony/form');
}

public function interact(InputInterface $input, ConsoleStyle $io, Command $command)
public function interact(InputInterface $input, ConsoleStyle $io, Command $command): void
{
if (null === $this->doctrineHelper) {
throw new \LogicException('Somehow the DoctrineHelper service is missing from MakerBundle.');
Expand All @@ -94,7 +94,7 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
);
}

public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator)
public function generate(InputInterface $input, ConsoleStyle $io, Generator $generator): void
{
if (null === $this->doctrineHelper) {
throw new \LogicException('Somehow the DoctrineHelper service is missing from MakerBundle.');
Expand Down