Skip to content

Commit afb6a61

Browse files
committed
Add more typed properties
1 parent ab53217 commit afb6a61

21 files changed

+65
-203
lines changed

src/DependencyInjection/Configuration.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@ class Configuration implements ConfigurationInterface
2222

2323
/**
2424
* If the kernel is running in debug mode.
25-
*
26-
* @var bool
2725
*/
28-
private $debug;
26+
private bool $debug;
2927

3028
public function __construct(bool $debug)
3129
{
@@ -34,10 +32,8 @@ public function __construct(bool $debug)
3432

3533
/**
3634
* Generates the configuration tree.
37-
*
38-
* @return TreeBuilder
3935
*/
40-
public function getConfigTreeBuilder()
36+
public function getConfigTreeBuilder(): TreeBuilder
4137
{
4238
$treeBuilder = new TreeBuilder('fos_elastica');
4339
$rootNode = $treeBuilder->getRootNode();

src/Doctrine/AbstractElasticaToModelTransformer.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,25 +26,20 @@ abstract class AbstractElasticaToModelTransformer extends BaseTransformer
2626
{
2727
/**
2828
* Manager registry.
29-
*
30-
* @var ManagerRegistry
3129
*/
32-
protected $registry;
30+
protected ManagerRegistry $registry;
3331

3432
/**
3533
* Class of the model to map to the elastica documents.
3634
*
37-
* @var string
3835
* @phpstan-var class-string
3936
*/
40-
protected $objectClass;
37+
protected string $objectClass;
4138

4239
/**
4340
* Optional parameters.
44-
*
45-
* @var array
4641
*/
47-
protected $options = [
42+
protected array $options = [
4843
'hints' => [],
4944
'hydrate' => true,
5045
'identifier' => 'id',

src/Doctrine/Listener.php

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -27,55 +27,35 @@ class Listener
2727
{
2828
/**
2929
* Objects scheduled for insertion.
30-
*
31-
* @var array
3230
*/
33-
public $scheduledForInsertion = [];
31+
public array $scheduledForInsertion = [];
3432

3533
/**
3634
* Objects scheduled to be updated or removed.
37-
*
38-
* @var array
3935
*/
40-
public $scheduledForUpdate = [];
36+
public array $scheduledForUpdate = [];
4137

4238
/**
4339
* IDs of objects scheduled for removal.
44-
*
45-
* @var array
4640
*/
47-
public $scheduledForDeletion = [];
41+
public array $scheduledForDeletion = [];
4842
/**
4943
* Object persister.
50-
*
51-
* @var ObjectPersisterInterface
5244
*/
53-
protected $objectPersister;
45+
protected ObjectPersisterInterface $objectPersister;
5446

5547
/**
5648
* PropertyAccessor instance.
57-
*
58-
* @var PropertyAccessorInterface
5949
*/
60-
protected $propertyAccessor;
50+
protected PropertyAccessorInterface $propertyAccessor;
6151

6252
/**
6353
* Configuration for the listener.
64-
*
65-
* @var array
6654
*/
67-
private $config;
55+
private array $config;
6856

69-
/**
70-
* @var IndexableInterface
71-
*/
72-
private $indexable;
57+
private IndexableInterface $indexable;
7358

74-
/**
75-
* Constructor.
76-
*
77-
* @param LoggerInterface $logger
78-
*/
7959
public function __construct(
8060
ObjectPersisterInterface $objectPersister,
8161
IndexableInterface $indexable,

src/Doctrine/MongoDBPagerProvider.php

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,31 +20,17 @@
2020

2121
final class MongoDBPagerProvider implements PagerProviderInterface
2222
{
23-
/**
24-
* @var string
25-
*/
26-
private $objectClass;
27-
28-
/**
29-
* @var ManagerRegistry
30-
*/
31-
private $doctrine;
32-
33-
/**
34-
* @var array
35-
*/
36-
private $baseOptions;
37-
38-
/**
39-
* @var RegisterListenersService
40-
*/
41-
private $registerListenersService;
42-
43-
/**
44-
* @param string $objectClass
45-
*/
46-
public function __construct(ManagerRegistry $doctrine, RegisterListenersService $registerListenersService, $objectClass, array $baseOptions)
47-
{
23+
private string $objectClass;
24+
private ManagerRegistry $doctrine;
25+
private array $baseOptions;
26+
private RegisterListenersService $registerListenersService;
27+
28+
public function __construct(
29+
ManagerRegistry $doctrine,
30+
RegisterListenersService $registerListenersService,
31+
string $objectClass,
32+
array $baseOptions
33+
) {
4834
$this->doctrine = $doctrine;
4935
$this->objectClass = $objectClass;
5036
$this->baseOptions = $baseOptions;

src/Doctrine/ORMPagerProvider.php

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,31 +24,17 @@ final class ORMPagerProvider implements PagerProviderInterface
2424
{
2525
public const ENTITY_ALIAS = 'a';
2626

27-
/**
28-
* @var string
29-
*/
30-
private $objectClass;
31-
32-
/**
33-
* @var ManagerRegistry
34-
*/
35-
private $doctrine;
36-
37-
/**
38-
* @var array
39-
*/
40-
private $baseOptions;
41-
42-
/**
43-
* @var RegisterListenersService
44-
*/
45-
private $registerListenersService;
46-
47-
/**
48-
* @param string $objectClass
49-
*/
50-
public function __construct(ManagerRegistry $doctrine, RegisterListenersService $registerListenersService, $objectClass, array $baseOptions)
51-
{
27+
private string $objectClass;
28+
private ManagerRegistry $doctrine;
29+
private array $baseOptions;
30+
private RegisterListenersService $registerListenersService;
31+
32+
public function __construct(
33+
ManagerRegistry $doctrine,
34+
RegisterListenersService $registerListenersService,
35+
string $objectClass,
36+
array $baseOptions
37+
) {
5238
$this->doctrine = $doctrine;
5339
$this->objectClass = $objectClass;
5440
$this->baseOptions = $baseOptions;

src/Doctrine/RegisterListenersService.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,7 @@
2222

2323
class RegisterListenersService
2424
{
25-
/**
26-
* @var EventDispatcherInterface
27-
*/
28-
private $dispatcher;
25+
private EventDispatcherInterface $dispatcher;
2926

3027
public function __construct(EventDispatcherInterface $dispatcher)
3128
{

src/Doctrine/RepositoryManager.php

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,10 @@
2424
*/
2525
class RepositoryManager implements RepositoryManagerInterface
2626
{
27-
/**
28-
* @var array
29-
*/
30-
protected $entities = [];
31-
32-
/** @var array */
33-
protected $repositories = [];
34-
35-
/** @var ManagerRegistry */
36-
protected $managerRegistry;
37-
38-
/**
39-
* @var RepositoryManagerInterface
40-
*/
41-
private $repositoryManager;
27+
protected array $entities = [];
28+
protected array $repositories = [];
29+
protected ManagerRegistry $managerRegistry;
30+
private RepositoryManagerInterface $repositoryManager;
4231

4332
public function __construct(ManagerRegistry $managerRegistry, RepositoryManagerInterface $repositoryManager)
4433
{
@@ -54,7 +43,7 @@ public function addIndex(string $indexName, FinderInterface $finder, ?string $re
5443
throw new \LogicException(__METHOD__.' should not be called. Call addIndex on the main repository manager');
5544
}
5645

57-
public function addEntity($entityName, $indexName)
46+
public function addEntity($entityName, $indexName): void
5847
{
5948
$this->entities[$entityName] = $indexName;
6049
}

src/FOSElasticaBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class FOSElasticaBundle extends Bundle
2121
/**
2222
* {@inheritdoc}
2323
*
24-
* @return void todo: remove
24+
* @return void
2525
*/
2626
public function build(ContainerBuilder $container)
2727
{

src/Finder/TransformedFinder.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,8 @@
3030
*/
3131
class TransformedFinder implements PaginatedFinderInterface
3232
{
33-
/**
34-
* @var SearchableInterface
35-
*/
36-
protected $searchable;
37-
38-
/**
39-
* @var ElasticaToModelTransformerInterface
40-
*/
41-
protected $transformer;
33+
protected SearchableInterface $searchable;
34+
protected ElasticaToModelTransformerInterface $transformer;
4235

4336
public function __construct(SearchableInterface $searchable, ElasticaToModelTransformerInterface $transformer)
4437
{

src/Index/IndexManager.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515

1616
class IndexManager
1717
{
18-
/**
19-
* @var Index
20-
*/
21-
private $defaultIndex;
18+
private Index $defaultIndex;
2219

2320
/**
2421
* @var array<string, Index>

0 commit comments

Comments
 (0)