Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7e522cb

Browse filesBrowse files
minor #41919 Add some missing types (nicolas-grekas)
This PR was merged into the 5.2 branch. Discussion ---------- Add some missing types | Q | A | ------------- | --- | Branch? | 5.2 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- e99d71b Add some missing types
2 parents 3221949 + e99d71b commit 7e522cb
Copy full SHA for 7e522cb

File tree

Expand file treeCollapse file tree

16 files changed

+32
-69
lines changed
Filter options
Expand file treeCollapse file tree

16 files changed

+32
-69
lines changed

‎src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,7 @@ private function getHash($listener): string
195195
return spl_object_hash($listener);
196196
}
197197

198-
/**
199-
* @param object $listener
200-
*/
201-
private function getMethod($listener, string $event): string
198+
private function getMethod(object $listener, string $event): string
202199
{
203200
if (!method_exists($listener, $event) && method_exists($listener, '__invoke')) {
204201
return '__invoke';

‎src/Symfony/Bridge/Doctrine/DataCollector/ObjectParameter.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/DataCollector/ObjectParameter.php
+2-8Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,15 @@ final class ObjectParameter
1818
private $stringable;
1919
private $class;
2020

21-
/**
22-
* @param object $object
23-
*/
24-
public function __construct($object, ?\Throwable $error)
21+
public function __construct(object $object, ?\Throwable $error)
2522
{
2623
$this->object = $object;
2724
$this->error = $error;
2825
$this->stringable = \is_callable([$object, '__toString']);
2926
$this->class = \get_class($object);
3027
}
3128

32-
/**
33-
* @return object
34-
*/
35-
public function getObject()
29+
public function getObject(): object
3630
{
3731
return $this->object;
3832
}

‎src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
+6-5Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public static function createChoiceName(object $choice, $key, string $value): st
9292
* @internal This method is public to be usable as callback. It should not
9393
* be used in user code.
9494
*/
95-
public function getQueryBuilderPartsForCachingHash($queryBuilder): ?array
95+
public function getQueryBuilderPartsForCachingHash(object $queryBuilder): ?array
9696
{
9797
return null;
9898
}
@@ -232,12 +232,13 @@ public function configureOptions(OptionsResolver $resolver)
232232
/**
233233
* Return the default loader object.
234234
*
235-
* @param mixed $queryBuilder
236-
*
237235
* @return EntityLoaderInterface
238236
*/
239-
abstract public function getLoader(ObjectManager $manager, $queryBuilder, string $class);
237+
abstract public function getLoader(ObjectManager $manager, object $queryBuilder, string $class);
240238

239+
/**
240+
* @return string
241+
*/
241242
public function getParent()
242243
{
243244
return ChoiceType::class;
@@ -263,7 +264,7 @@ private function getCachedIdReader(ObjectManager $manager, string $class): ?IdRe
263264
return $this->idReaders[$hash] = $idReader->isSingleId() ? $idReader : null;
264265
}
265266

266-
private function getCachedEntityLoader(ObjectManager $manager, $queryBuilder, string $class, array $vary): EntityLoaderInterface
267+
private function getCachedEntityLoader(ObjectManager $manager, object $queryBuilder, string $class, array $vary): EntityLoaderInterface
267268
{
268269
$hash = CachingFactoryDecorator::generateHash($vary);
269270

‎src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Validator\Constraints;
1313

14+
use Doctrine\ORM\EntityManagerInterface;
15+
use Doctrine\ORM\Mapping\ClassMetadata;
1416
use Doctrine\Persistence\ManagerRegistry;
1517
use Symfony\Component\Validator\Constraint;
1618
use Symfony\Component\Validator\ConstraintValidator;
@@ -175,7 +177,7 @@ public function validate($entity, Constraint $constraint)
175177
->addViolation();
176178
}
177179

178-
private function formatWithIdentifiers($em, $class, $value)
180+
private function formatWithIdentifiers(EntityManagerInterface $em, ClassMetadata $class, $value)
179181
{
180182
if (!\is_object($value) || $value instanceof \DateTimeInterface) {
181183
return $this->formatValue($value, self::PRETTY_DATE);

‎src/Symfony/Component/BrowserKit/AbstractBrowser.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/BrowserKit/AbstractBrowser.php
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ public function request(string $method, string $uri, array $parameters = [], arr
423423
*
424424
* @throws \RuntimeException When processing returns exit code
425425
*/
426-
protected function doRequestInProcess($request)
426+
protected function doRequestInProcess(object $request)
427427
{
428428
$deprecationsFile = tempnam(sys_get_temp_dir(), 'deprec');
429429
putenv('SYMFONY_DEPRECATIONS_SERIALIZE='.$deprecationsFile);
@@ -458,7 +458,7 @@ protected function doRequestInProcess($request)
458458
*
459459
* @return object An origin response instance
460460
*/
461-
abstract protected function doRequest($request);
461+
abstract protected function doRequest(object $request);
462462

463463
/**
464464
* Returns the script to execute when the request must be insulated.
@@ -467,7 +467,7 @@ abstract protected function doRequest($request);
467467
*
468468
* @throws \LogicException When this abstract class is not implemented
469469
*/
470-
protected function getScript($request)
470+
protected function getScript(object $request)
471471
{
472472
throw new \LogicException('To insulate requests, you need to override the getScript() method.');
473473
}
@@ -489,7 +489,7 @@ protected function filterRequest(Request $request)
489489
*
490490
* @return Response An BrowserKit Response instance
491491
*/
492-
protected function filterResponse($response)
492+
protected function filterResponse(object $response)
493493
{
494494
return $response;
495495
}
@@ -681,7 +681,7 @@ protected function getAbsoluteUri(string $uri)
681681
*
682682
* @return Crawler
683683
*/
684-
protected function requestFromRequest(Request $request, $changeHistory = true)
684+
protected function requestFromRequest(Request $request, bool $changeHistory = true)
685685
{
686686
return $this->request($request->getMethod(), $request->getUri(), $request->getParameters(), $request->getFiles(), $request->getServer(), $request->getContent(), $changeHistory);
687687
}

‎src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,7 @@ protected function assertNode(string $expectedName, string $expectedType, NodeDe
461461
$this->assertSame($expectedName, $this->getField($actualNode, 'name'));
462462
}
463463

464-
/**
465-
* @param object $object
466-
*/
467-
protected function getField($object, string $field)
464+
protected function getField(object $object, string $field)
468465
{
469466
$reflection = new \ReflectionProperty($object, $field);
470467
$reflection->setAccessible(true);

‎src/Symfony/Component/Console/Descriptor/DescriptorInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Console/Descriptor/DescriptorInterface.php
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,5 @@
2020
*/
2121
interface DescriptorInterface
2222
{
23-
/**
24-
* Describes an object if supported.
25-
*
26-
* @param object $object
27-
*/
28-
public function describe(OutputInterface $output, $object, array $options = []);
23+
public function describe(OutputInterface $output, object $object, array $options = []);
2924
}

‎src/Symfony/Component/Messenger/Envelope.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Envelope.php
+2-6Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,10 @@ final class Envelope
2424
private $message;
2525

2626
/**
27-
* @param object $message
2827
* @param StampInterface[] $stamps
2928
*/
30-
public function __construct($message, array $stamps = [])
29+
public function __construct(object $message, array $stamps = [])
3130
{
32-
if (!\is_object($message)) {
33-
throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object but got "%s".', __METHOD__, get_debug_type($message)));
34-
}
3531
$this->message = $message;
3632

3733
foreach ($stamps as $stamp) {
@@ -45,7 +41,7 @@ public function __construct($message, array $stamps = [])
4541
* @param object|Envelope $message
4642
* @param StampInterface[] $stamps
4743
*/
48-
public static function wrap($message, array $stamps = []): self
44+
public static function wrap(object $message, array $stamps = []): self
4945
{
5046
$envelope = $message instanceof self ? $message : new self($message);
5147

‎src/Symfony/Component/Messenger/Exception/ValidationFailedException.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Exception/ValidationFailedException.php
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,7 @@ class ValidationFailedException extends RuntimeException
2121
private $violations;
2222
private $violatingMessage;
2323

24-
/**
25-
* @param object $violatingMessage
26-
*/
27-
public function __construct($violatingMessage, ConstraintViolationListInterface $violations)
24+
public function __construct(object $violatingMessage, ConstraintViolationListInterface $violations)
2825
{
2926
$this->violatingMessage = $violatingMessage;
3027
$this->violations = $violations;

‎src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ interface AccessDecisionManagerInterface
2323
/**
2424
* Decides whether the access is possible or not.
2525
*
26-
* @param array $attributes An array of attributes associated with the method being invoked
27-
* @param object $object The object to secure
26+
* @param array $attributes An array of attributes associated with the method being invoked
27+
* @param mixed $object The object to secure
2828
*
2929
* @return bool true if the access is granted, false otherwise
3030
*/

‎src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
+1-3Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,9 @@ protected function instantiateObject(array &$data, string $class, array &$contex
236236
/**
237237
* Gets and caches attributes for the given object, format and context.
238238
*
239-
* @param object $object
240-
*
241239
* @return string[]
242240
*/
243-
protected function getAttributes($object, ?string $format, array $context)
241+
protected function getAttributes(object $object, ?string $format, array $context)
244242
{
245243
$class = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object);
246244
$key = $class.'-'.$context['cache_key'];

‎src/Symfony/Component/Validator/Context/ExecutionContext.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Context/ExecutionContext.php
+1-5Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -351,12 +351,8 @@ public function isObjectInitialized(string $cacheKey): bool
351351

352352
/**
353353
* @internal
354-
*
355-
* @param object $object
356-
*
357-
* @return string
358354
*/
359-
public function generateCacheKey($object)
355+
public function generateCacheKey(object $object): string
360356
{
361357
if (!isset($this->cachedObjectsRefs[$object])) {
362358
$this->cachedObjectsRefs[$object] = spl_object_hash($object);

‎src/Symfony/Component/Validator/ObjectInitializerInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/ObjectInitializerInterface.php
-5Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,5 @@
2222
*/
2323
interface ObjectInitializerInterface
2424
{
25-
/**
26-
* Initializes an object just before validation.
27-
*
28-
* @param object $object The object to validate
29-
*/
3025
public function initialize(object $object);
3126
}

‎src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function atPath(string $path);
4141
* {@link \Symfony\Component\Validator\Constraints\Valid} is assumed.
4242
*
4343
* @param mixed $value The value to validate
44-
* @param Constraint|Constraint[] $constraints The constraint(s) to validate against
44+
* @param Constraint|Constraint[]|null $constraints The constraint(s) to validate against
4545
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
4646
*
4747
* @return $this
@@ -52,13 +52,12 @@ public function validate($value, $constraints = null, $groups = null);
5252
* Validates a property of an object against the constraints specified
5353
* for this property.
5454
*
55-
* @param object $object The object
5655
* @param string $propertyName The name of the validated property
5756
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
5857
*
5958
* @return $this
6059
*/
61-
public function validateProperty($object, string $propertyName, $groups = null);
60+
public function validateProperty(object $object, string $propertyName, $groups = null);
6261

6362
/**
6463
* Validates a value against the constraints specified for an object's

‎src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public function validate($value, $constraints = null, $groups = null)
166166
/**
167167
* {@inheritdoc}
168168
*/
169-
public function validateProperty($object, string $propertyName, $groups = null)
169+
public function validateProperty(object $object, string $propertyName, $groups = null)
170170
{
171171
$classMetadata = $this->metadataFactory->getMetadataFor($object);
172172

@@ -300,7 +300,7 @@ protected function normalizeGroups($groups)
300300
* metadata factory does not implement
301301
* {@link ClassMetadataInterface}
302302
*/
303-
private function validateObject($object, string $propertyPath, array $groups, int $traversalStrategy, ExecutionContextInterface $context)
303+
private function validateObject(object $object, string $propertyPath, array $groups, int $traversalStrategy, ExecutionContextInterface $context)
304304
{
305305
try {
306306
$classMetadata = $this->metadataFactory->getMetadataFor($object);
@@ -765,10 +765,7 @@ private function validateInGroup($value, ?string $cacheKey, MetadataInterface $m
765765
}
766766
}
767767

768-
/**
769-
* @param object $object
770-
*/
771-
private function generateCacheKey($object, bool $dependsOnPropertyPath = false): string
768+
private function generateCacheKey(object $object, bool $dependsOnPropertyPath = false): string
772769
{
773770
if ($this->context instanceof ExecutionContext) {
774771
$cacheKey = $this->context->generateCacheKey($object);

‎src/Symfony/Component/Validator/Validator/ValidatorInterface.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Validator/ValidatorInterface.php
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,14 @@ public function validate($value, $constraints = null, $groups = null);
4444
* Validates a property of an object against the constraints specified
4545
* for this property.
4646
*
47-
* @param object $object The object
4847
* @param string $propertyName The name of the validated property
4948
* @param string|GroupSequence|array<string|GroupSequence>|null $groups The validation groups to validate. If none is given, "Default" is assumed
5049
*
5150
* @return ConstraintViolationListInterface A list of constraint violations
5251
* If the list is empty, validation
5352
* succeeded
5453
*/
55-
public function validateProperty($object, string $propertyName, $groups = null);
54+
public function validateProperty(object $object, string $propertyName, $groups = null);
5655

5756
/**
5857
* Validates a value against the constraints specified for an object's

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.