diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 81df64dfb..c6274b3cf 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -22,10 +22,8 @@ class Configuration implements ConfigurationInterface /** * If the kernel is running in debug mode. - * - * @var bool */ - private $debug; + private bool $debug; public function __construct(bool $debug) { @@ -34,10 +32,8 @@ public function __construct(bool $debug) /** * Generates the configuration tree. - * - * @return TreeBuilder */ - public function getConfigTreeBuilder() + public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('fos_elastica'); $rootNode = $treeBuilder->getRootNode(); diff --git a/src/Doctrine/AbstractElasticaToModelTransformer.php b/src/Doctrine/AbstractElasticaToModelTransformer.php index f02ba53a5..574361447 100644 --- a/src/Doctrine/AbstractElasticaToModelTransformer.php +++ b/src/Doctrine/AbstractElasticaToModelTransformer.php @@ -26,25 +26,20 @@ abstract class AbstractElasticaToModelTransformer extends BaseTransformer { /** * Manager registry. - * - * @var ManagerRegistry */ - protected $registry; + protected ManagerRegistry $registry; /** * Class of the model to map to the elastica documents. * - * @var string * @phpstan-var class-string */ - protected $objectClass; + protected string $objectClass; /** * Optional parameters. - * - * @var array */ - protected $options = [ + protected array $options = [ 'hints' => [], 'hydrate' => true, 'identifier' => 'id', diff --git a/src/Doctrine/Listener.php b/src/Doctrine/Listener.php index 9a48ecc0a..b5e593058 100644 --- a/src/Doctrine/Listener.php +++ b/src/Doctrine/Listener.php @@ -27,55 +27,35 @@ class Listener { /** * Objects scheduled for insertion. - * - * @var array */ - public $scheduledForInsertion = []; + public array $scheduledForInsertion = []; /** * Objects scheduled to be updated or removed. - * - * @var array */ - public $scheduledForUpdate = []; + public array $scheduledForUpdate = []; /** * IDs of objects scheduled for removal. - * - * @var array */ - public $scheduledForDeletion = []; + public array $scheduledForDeletion = []; /** * Object persister. - * - * @var ObjectPersisterInterface */ - protected $objectPersister; + protected ObjectPersisterInterface $objectPersister; /** * PropertyAccessor instance. - * - * @var PropertyAccessorInterface */ - protected $propertyAccessor; + protected PropertyAccessorInterface $propertyAccessor; /** * Configuration for the listener. - * - * @var array */ - private $config; + private array $config; - /** - * @var IndexableInterface - */ - private $indexable; + private IndexableInterface $indexable; - /** - * Constructor. - * - * @param LoggerInterface $logger - */ public function __construct( ObjectPersisterInterface $objectPersister, IndexableInterface $indexable, diff --git a/src/Doctrine/MongoDBPagerProvider.php b/src/Doctrine/MongoDBPagerProvider.php index 735ba86fb..c2efa5616 100644 --- a/src/Doctrine/MongoDBPagerProvider.php +++ b/src/Doctrine/MongoDBPagerProvider.php @@ -20,31 +20,17 @@ final class MongoDBPagerProvider implements PagerProviderInterface { - /** - * @var string - */ - private $objectClass; - - /** - * @var ManagerRegistry - */ - private $doctrine; - - /** - * @var array - */ - private $baseOptions; - - /** - * @var RegisterListenersService - */ - private $registerListenersService; - - /** - * @param string $objectClass - */ - public function __construct(ManagerRegistry $doctrine, RegisterListenersService $registerListenersService, $objectClass, array $baseOptions) - { + private string $objectClass; + private ManagerRegistry $doctrine; + private array $baseOptions; + private RegisterListenersService $registerListenersService; + + public function __construct( + ManagerRegistry $doctrine, + RegisterListenersService $registerListenersService, + string $objectClass, + array $baseOptions + ) { $this->doctrine = $doctrine; $this->objectClass = $objectClass; $this->baseOptions = $baseOptions; diff --git a/src/Doctrine/ORMPagerProvider.php b/src/Doctrine/ORMPagerProvider.php index 21771fc28..259a20da9 100644 --- a/src/Doctrine/ORMPagerProvider.php +++ b/src/Doctrine/ORMPagerProvider.php @@ -24,31 +24,17 @@ final class ORMPagerProvider implements PagerProviderInterface { public const ENTITY_ALIAS = 'a'; - /** - * @var string - */ - private $objectClass; - - /** - * @var ManagerRegistry - */ - private $doctrine; - - /** - * @var array - */ - private $baseOptions; - - /** - * @var RegisterListenersService - */ - private $registerListenersService; - - /** - * @param string $objectClass - */ - public function __construct(ManagerRegistry $doctrine, RegisterListenersService $registerListenersService, $objectClass, array $baseOptions) - { + private string $objectClass; + private ManagerRegistry $doctrine; + private array $baseOptions; + private RegisterListenersService $registerListenersService; + + public function __construct( + ManagerRegistry $doctrine, + RegisterListenersService $registerListenersService, + string $objectClass, + array $baseOptions + ) { $this->doctrine = $doctrine; $this->objectClass = $objectClass; $this->baseOptions = $baseOptions; diff --git a/src/Doctrine/RegisterListenersService.php b/src/Doctrine/RegisterListenersService.php index 46575ebb9..67c92bdc5 100644 --- a/src/Doctrine/RegisterListenersService.php +++ b/src/Doctrine/RegisterListenersService.php @@ -22,10 +22,7 @@ class RegisterListenersService { - /** - * @var EventDispatcherInterface - */ - private $dispatcher; + private EventDispatcherInterface $dispatcher; public function __construct(EventDispatcherInterface $dispatcher) { diff --git a/src/Doctrine/RepositoryManager.php b/src/Doctrine/RepositoryManager.php index 4f61a69c8..bd3cb85f7 100644 --- a/src/Doctrine/RepositoryManager.php +++ b/src/Doctrine/RepositoryManager.php @@ -24,21 +24,10 @@ */ class RepositoryManager implements RepositoryManagerInterface { - /** - * @var array - */ - protected $entities = []; - - /** @var array */ - protected $repositories = []; - - /** @var ManagerRegistry */ - protected $managerRegistry; - - /** - * @var RepositoryManagerInterface - */ - private $repositoryManager; + protected array $entities = []; + protected array $repositories = []; + protected ManagerRegistry $managerRegistry; + private RepositoryManagerInterface $repositoryManager; public function __construct(ManagerRegistry $managerRegistry, RepositoryManagerInterface $repositoryManager) { @@ -54,7 +43,7 @@ public function addIndex(string $indexName, FinderInterface $finder, ?string $re throw new \LogicException(__METHOD__.' should not be called. Call addIndex on the main repository manager'); } - public function addEntity($entityName, $indexName) + public function addEntity($entityName, $indexName): void { $this->entities[$entityName] = $indexName; } diff --git a/src/FOSElasticaBundle.php b/src/FOSElasticaBundle.php index a19d0a3c3..03fed3ef9 100644 --- a/src/FOSElasticaBundle.php +++ b/src/FOSElasticaBundle.php @@ -21,7 +21,7 @@ class FOSElasticaBundle extends Bundle /** * {@inheritdoc} * - * @return void todo: remove + * @return void */ public function build(ContainerBuilder $container) { diff --git a/src/Finder/TransformedFinder.php b/src/Finder/TransformedFinder.php index 908b35e4f..b07e71359 100644 --- a/src/Finder/TransformedFinder.php +++ b/src/Finder/TransformedFinder.php @@ -30,15 +30,8 @@ */ class TransformedFinder implements PaginatedFinderInterface { - /** - * @var SearchableInterface - */ - protected $searchable; - - /** - * @var ElasticaToModelTransformerInterface - */ - protected $transformer; + protected SearchableInterface $searchable; + protected ElasticaToModelTransformerInterface $transformer; public function __construct(SearchableInterface $searchable, ElasticaToModelTransformerInterface $transformer) { diff --git a/src/Index/IndexManager.php b/src/Index/IndexManager.php index 5304f8740..d32a08189 100644 --- a/src/Index/IndexManager.php +++ b/src/Index/IndexManager.php @@ -15,10 +15,7 @@ class IndexManager { - /** - * @var Index - */ - private $defaultIndex; + private Index $defaultIndex; /** * @var array diff --git a/src/Index/MappingBuilder.php b/src/Index/MappingBuilder.php index f235ba729..7633eca2d 100644 --- a/src/Index/MappingBuilder.php +++ b/src/Index/MappingBuilder.php @@ -22,10 +22,7 @@ */ class MappingBuilder { - /** - * @var EventDispatcherInterface - */ - private $dispatcher; + private EventDispatcherInterface $dispatcher; public function __construct(EventDispatcherInterface $eventDispatcher) { diff --git a/src/Index/Resetter.php b/src/Index/Resetter.php index cb59487fd..b0b893bb4 100644 --- a/src/Index/Resetter.php +++ b/src/Index/Resetter.php @@ -22,30 +22,11 @@ */ class Resetter implements ResetterInterface { - /** - * @var AliasProcessor - */ - private $aliasProcessor; - - /** - * @var ManagerInterface - */ - private $configManager; - - /** - * @var EventDispatcherInterface - */ - private $dispatcher; - - /** - * @var IndexManager - */ - private $indexManager; - - /** - * @var MappingBuilder - */ - private $mappingBuilder; + private AliasProcessor $aliasProcessor; + private ManagerInterface $configManager; + private EventDispatcherInterface $dispatcher; + private IndexManager $indexManager; + private MappingBuilder $mappingBuilder; public function __construct( ManagerInterface $configManager, diff --git a/src/Index/TemplateResetter.php b/src/Index/TemplateResetter.php index a6072add0..55e0a34f4 100644 --- a/src/Index/TemplateResetter.php +++ b/src/Index/TemplateResetter.php @@ -23,25 +23,10 @@ */ class TemplateResetter implements ResetterInterface { - /** - * @var ManagerInterface - */ - private $configManager; - - /** - * @var MappingBuilder - */ - private $mappingBuilder; - - /** - * @var Client - */ - private $client; - - /** - * @var IndexTemplateManager - */ - private $indexTemplateManager; + private ManagerInterface $configManager; + private MappingBuilder $mappingBuilder; + private Client $client; + private IndexTemplateManager $indexTemplateManager; public function __construct( ManagerInterface $configManager, diff --git a/src/Message/Handler/AsyncPersistPageHandler.php b/src/Message/Handler/AsyncPersistPageHandler.php index 2473631e4..92e7b4497 100644 --- a/src/Message/Handler/AsyncPersistPageHandler.php +++ b/src/Message/Handler/AsyncPersistPageHandler.php @@ -17,10 +17,7 @@ class AsyncPersistPageHandler implements MessageHandlerInterface { - /** - * @var AsyncPagerPersister - */ - private $persister; + private AsyncPagerPersister $persister; public function __construct(AsyncPagerPersister $persister) { diff --git a/src/Persister/InPlacePagerPersister.php b/src/Persister/InPlacePagerPersister.php index 083070327..e08a5b5a5 100644 --- a/src/Persister/InPlacePagerPersister.php +++ b/src/Persister/InPlacePagerPersister.php @@ -27,15 +27,8 @@ final class InPlacePagerPersister implements PagerPersisterInterface { public const NAME = 'in_place'; - /** - * @var PersisterRegistry - */ - private $registry; - - /** - * @var EventDispatcherInterface - */ - private $dispatcher; + private PersisterRegistry $registry; + private EventDispatcherInterface $dispatcher; public function __construct(PersisterRegistry $registry, EventDispatcherInterface $dispatcher) { diff --git a/src/Persister/Listener/FilterObjectsListener.php b/src/Persister/Listener/FilterObjectsListener.php index a05a84abb..6ffb8cc1a 100644 --- a/src/Persister/Listener/FilterObjectsListener.php +++ b/src/Persister/Listener/FilterObjectsListener.php @@ -17,10 +17,7 @@ class FilterObjectsListener implements EventSubscriberInterface { - /** - * @var IndexableInterface - */ - private $indexable; + private IndexableInterface $indexable; public function __construct(IndexableInterface $indexable) { diff --git a/src/Persister/PagerPersisterRegistry.php b/src/Persister/PagerPersisterRegistry.php index 3adf24a96..70c3d96fc 100644 --- a/src/Persister/PagerPersisterRegistry.php +++ b/src/Persister/PagerPersisterRegistry.php @@ -15,8 +15,7 @@ final class PagerPersisterRegistry { - /** @var ServiceLocator */ - private $persisters; + private ServiceLocator $persisters; public function __construct(ServiceLocator $persisters) { diff --git a/src/Persister/PersisterRegistry.php b/src/Persister/PersisterRegistry.php index 9e52cc4d2..7f1d8bd71 100644 --- a/src/Persister/PersisterRegistry.php +++ b/src/Persister/PersisterRegistry.php @@ -15,8 +15,7 @@ class PersisterRegistry { - /** @var ServiceLocator */ - private $persisters; + private ServiceLocator $persisters; public function __construct(ServiceLocator $persisters) { diff --git a/src/Provider/PagerProviderRegistry.php b/src/Provider/PagerProviderRegistry.php index 9a5f162a6..948f55e5e 100644 --- a/src/Provider/PagerProviderRegistry.php +++ b/src/Provider/PagerProviderRegistry.php @@ -18,8 +18,7 @@ */ class PagerProviderRegistry { - /** @var ServiceLocator */ - private $providers; + private ServiceLocator $providers; public function __construct(ServiceLocator $providers) { @@ -33,7 +32,7 @@ public function __construct(ServiceLocator $providers) * * @return PagerProviderInterface[] */ - public function getProviders() + public function getProviders(): array { return \array_reduce(\array_keys($this->providers->getProvidedServices()), function ($carry, $index) { return $carry + [$index => $this->providers->get($index)]; diff --git a/src/Repository.php b/src/Repository.php index 6e0d24c3e..b40b4f79c 100644 --- a/src/Repository.php +++ b/src/Repository.php @@ -25,8 +25,7 @@ */ class Repository { - /** @var PaginatedFinderInterface */ - protected $finder; + protected PaginatedFinderInterface $finder; public function __construct(PaginatedFinderInterface $finder) { diff --git a/src/Subscriber/PaginateElasticaQuerySubscriber.php b/src/Subscriber/PaginateElasticaQuerySubscriber.php index bc99b2c47..b9c55909b 100644 --- a/src/Subscriber/PaginateElasticaQuerySubscriber.php +++ b/src/Subscriber/PaginateElasticaQuerySubscriber.php @@ -20,10 +20,7 @@ class PaginateElasticaQuerySubscriber implements EventSubscriberInterface { - /** - * @var RequestStack - */ - private $requestStack; + private RequestStack $requestStack; public function __construct(RequestStack $requestStack) { @@ -53,7 +50,7 @@ public function items(ItemsEvent $event) } } - public static function getSubscribedEvents() + public static function getSubscribedEvents(): array { return [ 'knp_pager.items' => ['items', 1],