Skip to content

Commit

Permalink
Merge pull request #1879 from XWB/typed-properties
Browse files Browse the repository at this point in the history
Add more typed properties
  • Loading branch information
XWB authored Aug 8, 2022
2 parents cfb49e8 + afb6a61 commit 74d4de5
Show file tree
Hide file tree
Showing 21 changed files with 65 additions and 203 deletions.
8 changes: 2 additions & 6 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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();
Expand Down
11 changes: 3 additions & 8 deletions src/Doctrine/AbstractElasticaToModelTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
34 changes: 7 additions & 27 deletions src/Doctrine/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
36 changes: 11 additions & 25 deletions src/Doctrine/MongoDBPagerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
36 changes: 11 additions & 25 deletions src/Doctrine/ORMPagerProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions src/Doctrine/RegisterListenersService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@

class RegisterListenersService
{
/**
* @var EventDispatcherInterface
*/
private $dispatcher;
private EventDispatcherInterface $dispatcher;

public function __construct(EventDispatcherInterface $dispatcher)
{
Expand Down
21 changes: 5 additions & 16 deletions src/Doctrine/RepositoryManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/FOSElasticaBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FOSElasticaBundle extends Bundle
/**
* {@inheritdoc}
*
* @return void todo: remove
* @return void
*/
public function build(ContainerBuilder $container)
{
Expand Down
11 changes: 2 additions & 9 deletions src/Finder/TransformedFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 1 addition & 4 deletions src/Index/IndexManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@

class IndexManager
{
/**
* @var Index
*/
private $defaultIndex;
private Index $defaultIndex;

/**
* @var array<string, Index>
Expand Down
5 changes: 1 addition & 4 deletions src/Index/MappingBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,7 @@
*/
class MappingBuilder
{
/**
* @var EventDispatcherInterface
*/
private $dispatcher;
private EventDispatcherInterface $dispatcher;

public function __construct(EventDispatcherInterface $eventDispatcher)
{
Expand Down
29 changes: 5 additions & 24 deletions src/Index/Resetter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
23 changes: 4 additions & 19 deletions src/Index/TemplateResetter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 1 addition & 4 deletions src/Message/Handler/AsyncPersistPageHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@

class AsyncPersistPageHandler implements MessageHandlerInterface
{
/**
* @var AsyncPagerPersister
*/
private $persister;
private AsyncPagerPersister $persister;

public function __construct(AsyncPagerPersister $persister)
{
Expand Down
11 changes: 2 additions & 9 deletions src/Persister/InPlacePagerPersister.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Loading

0 comments on commit 74d4de5

Please sign in to comment.