Skip to content

Commit fe3b165

Browse files
committed
[PropertyInfo] Add type-hints to public interfaces and classes
1 parent 1d57b80 commit fe3b165

9 files changed

+26
-49
lines changed

src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct(DocBlockFactoryInterface $docBlockFactory = null, ar
6868
/**
6969
* {@inheritdoc}
7070
*/
71-
public function getShortDescription($class, $property, array $context = [])
71+
public function getShortDescription(string $class, string $property, array $context = [])
7272
{
7373
/** @var $docBlock DocBlock */
7474
list($docBlock) = $this->getDocBlock($class, $property);
@@ -94,7 +94,7 @@ public function getShortDescription($class, $property, array $context = [])
9494
/**
9595
* {@inheritdoc}
9696
*/
97-
public function getLongDescription($class, $property, array $context = [])
97+
public function getLongDescription(string $class, string $property, array $context = [])
9898
{
9999
/** @var $docBlock DocBlock */
100100
list($docBlock) = $this->getDocBlock($class, $property);
@@ -110,7 +110,7 @@ public function getLongDescription($class, $property, array $context = [])
110110
/**
111111
* {@inheritdoc}
112112
*/
113-
public function getTypes($class, $property, array $context = [])
113+
public function getTypes(string $class, string $property, array $context = [])
114114
{
115115
/** @var $docBlock DocBlock */
116116
list($docBlock, $source, $prefix) = $this->getDocBlock($class, $property);

src/Symfony/Component/PropertyInfo/Extractor/ReflectionExtractor.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function __construct(array $mutatorPrefixes = null, array $accessorPrefix
7575
/**
7676
* {@inheritdoc}
7777
*/
78-
public function getProperties($class, array $context = [])
78+
public function getProperties(string $class, array $context = [])
7979
{
8080
try {
8181
$reflectionClass = new \ReflectionClass($class);
@@ -131,7 +131,7 @@ public function getProperties($class, array $context = [])
131131
/**
132132
* {@inheritdoc}
133133
*/
134-
public function getTypes($class, $property, array $context = [])
134+
public function getTypes(string $class, $property, array $context = [])
135135
{
136136
if ($fromMutator = $this->extractFromMutator($class, $property)) {
137137
return $fromMutator;
@@ -156,7 +156,7 @@ public function getTypes($class, $property, array $context = [])
156156
/**
157157
* {@inheritdoc}
158158
*/
159-
public function isReadable($class, $property, array $context = []): bool
159+
public function isReadable(string $class, $property, array $context = []): bool
160160
{
161161
if ($this->isAllowedProperty($class, $property)) {
162162
return true;
@@ -170,7 +170,7 @@ public function isReadable($class, $property, array $context = []): bool
170170
/**
171171
* {@inheritdoc}
172172
*/
173-
public function isWritable($class, $property, array $context = []): bool
173+
public function isWritable(string $class, $property, array $context = []): bool
174174
{
175175
if ($this->isAllowedProperty($class, $property)) {
176176
return true;

src/Symfony/Component/PropertyInfo/Extractor/SerializerExtractor.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(ClassMetadataFactoryInterface $classMetadataFactory)
3333
/**
3434
* {@inheritdoc}
3535
*/
36-
public function getProperties($class, array $context = [])
36+
public function getProperties(string $class, array $context = [])
3737
{
3838
if (!isset($context['serializer_groups']) || !\is_array($context['serializer_groups'])) {
3939
return;

src/Symfony/Component/PropertyInfo/PropertyAccessExtractorInterface.php

+2-10
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,14 @@ interface PropertyAccessExtractorInterface
2121
/**
2222
* Is the property readable?
2323
*
24-
* @param string $class
25-
* @param string $property
26-
* @param array $context
27-
*
2824
* @return bool|null
2925
*/
30-
public function isReadable($class, $property, array $context = []);
26+
public function isReadable(string $class, string $property, array $context = []);
3127

3228
/**
3329
* Is the property writable?
3430
*
35-
* @param string $class
36-
* @param string $property
37-
* @param array $context
38-
*
3931
* @return bool|null
4032
*/
41-
public function isWritable($class, $property, array $context = []);
33+
public function isWritable(string $class, string $property, array $context = []);
4234
}

src/Symfony/Component/PropertyInfo/PropertyDescriptionExtractorInterface.php

+2-10
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,14 @@ interface PropertyDescriptionExtractorInterface
2121
/**
2222
* Gets the short description of the property.
2323
*
24-
* @param string $class
25-
* @param string $property
26-
* @param array $context
27-
*
2824
* @return string|null
2925
*/
30-
public function getShortDescription($class, $property, array $context = []);
26+
public function getShortDescription(string $class, string $property, array $context = []);
3127

3228
/**
3329
* Gets the long description of the property.
3430
*
35-
* @param string $class
36-
* @param string $property
37-
* @param array $context
38-
*
3931
* @return string|null
4032
*/
41-
public function getLongDescription($class, $property, array $context = []);
33+
public function getLongDescription(string $class, string $property, array $context = []);
4234
}

src/Symfony/Component/PropertyInfo/PropertyInfoCacheExtractor.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -35,47 +35,47 @@ public function __construct(PropertyInfoExtractorInterface $propertyInfoExtracto
3535
/**
3636
* {@inheritdoc}
3737
*/
38-
public function isReadable($class, $property, array $context = [])
38+
public function isReadable(string $class, string $property, array $context = [])
3939
{
4040
return $this->extract('isReadable', [$class, $property, $context]);
4141
}
4242

4343
/**
4444
* {@inheritdoc}
4545
*/
46-
public function isWritable($class, $property, array $context = [])
46+
public function isWritable(string $class, string $property, array $context = [])
4747
{
4848
return $this->extract('isWritable', [$class, $property, $context]);
4949
}
5050

5151
/**
5252
* {@inheritdoc}
5353
*/
54-
public function getShortDescription($class, $property, array $context = [])
54+
public function getShortDescription(string $class, string $property, array $context = [])
5555
{
5656
return $this->extract('getShortDescription', [$class, $property, $context]);
5757
}
5858

5959
/**
6060
* {@inheritdoc}
6161
*/
62-
public function getLongDescription($class, $property, array $context = [])
62+
public function getLongDescription(string $class, string $property, array $context = [])
6363
{
6464
return $this->extract('getLongDescription', [$class, $property, $context]);
6565
}
6666

6767
/**
6868
* {@inheritdoc}
6969
*/
70-
public function getProperties($class, array $context = [])
70+
public function getProperties(string $class, array $context = [])
7171
{
7272
return $this->extract('getProperties', [$class, $context]);
7373
}
7474

7575
/**
7676
* {@inheritdoc}
7777
*/
78-
public function getTypes($class, $property, array $context = [])
78+
public function getTypes(string $class, string $property, array $context = [])
7979
{
8080
return $this->extract('getTypes', [$class, $property, $context]);
8181
}

src/Symfony/Component/PropertyInfo/PropertyInfoExtractor.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -45,47 +45,47 @@ public function __construct(iterable $listExtractors = [], iterable $typeExtract
4545
/**
4646
* {@inheritdoc}
4747
*/
48-
public function getProperties($class, array $context = [])
48+
public function getProperties(string $class, array $context = [])
4949
{
5050
return $this->extract($this->listExtractors, 'getProperties', [$class, $context]);
5151
}
5252

5353
/**
5454
* {@inheritdoc}
5555
*/
56-
public function getShortDescription($class, $property, array $context = [])
56+
public function getShortDescription(string $class, string $property, array $context = [])
5757
{
5858
return $this->extract($this->descriptionExtractors, 'getShortDescription', [$class, $property, $context]);
5959
}
6060

6161
/**
6262
* {@inheritdoc}
6363
*/
64-
public function getLongDescription($class, $property, array $context = [])
64+
public function getLongDescription(string $class, string $property, array $context = [])
6565
{
6666
return $this->extract($this->descriptionExtractors, 'getLongDescription', [$class, $property, $context]);
6767
}
6868

6969
/**
7070
* {@inheritdoc}
7171
*/
72-
public function getTypes($class, $property, array $context = [])
72+
public function getTypes(string $class, string $property, array $context = [])
7373
{
7474
return $this->extract($this->typeExtractors, 'getTypes', [$class, $property, $context]);
7575
}
7676

7777
/**
7878
* {@inheritdoc}
7979
*/
80-
public function isReadable($class, $property, array $context = [])
80+
public function isReadable(string $class, string $property, array $context = [])
8181
{
8282
return $this->extract($this->accessExtractors, 'isReadable', [$class, $property, $context]);
8383
}
8484

8585
/**
8686
* {@inheritdoc}
8787
*/
88-
public function isWritable($class, $property, array $context = [])
88+
public function isWritable(string $class, string $property, array $context = [])
8989
{
9090
return $this->extract($this->accessExtractors, 'isWritable', [$class, $property, $context]);
9191
}

src/Symfony/Component/PropertyInfo/PropertyListExtractorInterface.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ interface PropertyListExtractorInterface
2121
/**
2222
* Gets the list of properties available for the given class.
2323
*
24-
* @param string $class
25-
* @param array $context
26-
*
2724
* @return string[]|null
2825
*/
29-
public function getProperties($class, array $context = []);
26+
public function getProperties(string $class, array $context = []);
3027
}

src/Symfony/Component/PropertyInfo/PropertyTypeExtractorInterface.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,7 @@ interface PropertyTypeExtractorInterface
2121
/**
2222
* Gets types of a property.
2323
*
24-
* @param string $class
25-
* @param string $property
26-
* @param array $context
27-
*
2824
* @return Type[]|null
2925
*/
30-
public function getTypes($class, $property, array $context = []);
26+
public function getTypes(string $class, string $property, array $context = []);
3127
}

0 commit comments

Comments
 (0)