diff --git a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php index 1ee4f54ded8e1..70049a3602fce 100644 --- a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php +++ b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php @@ -195,10 +195,7 @@ private function getHash($listener): string return spl_object_hash($listener); } - /** - * @param object $listener - */ - private function getMethod($listener, string $event): string + private function getMethod(object $listener, string $event): string { if (!method_exists($listener, $event) && method_exists($listener, '__invoke')) { return '__invoke'; diff --git a/src/Symfony/Bridge/Doctrine/DataCollector/ObjectParameter.php b/src/Symfony/Bridge/Doctrine/DataCollector/ObjectParameter.php index 26bdb7ff267d0..dabb9ff2a35e2 100644 --- a/src/Symfony/Bridge/Doctrine/DataCollector/ObjectParameter.php +++ b/src/Symfony/Bridge/Doctrine/DataCollector/ObjectParameter.php @@ -18,10 +18,7 @@ final class ObjectParameter private $stringable; private $class; - /** - * @param object $object - */ - public function __construct($object, ?\Throwable $error) + public function __construct(object $object, ?\Throwable $error) { $this->object = $object; $this->error = $error; @@ -29,10 +26,7 @@ public function __construct($object, ?\Throwable $error) $this->class = \get_class($object); } - /** - * @return object - */ - public function getObject() + public function getObject(): object { return $this->object; } diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php index b6a699287b8c8..324d5d26d4b06 100644 --- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php +++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php @@ -92,7 +92,7 @@ public static function createChoiceName(object $choice, $key, string $value): st * @internal This method is public to be usable as callback. It should not * be used in user code. */ - public function getQueryBuilderPartsForCachingHash($queryBuilder): ?array + public function getQueryBuilderPartsForCachingHash(object $queryBuilder): ?array { return null; } @@ -232,12 +232,13 @@ public function configureOptions(OptionsResolver $resolver) /** * Return the default loader object. * - * @param mixed $queryBuilder - * * @return EntityLoaderInterface */ - abstract public function getLoader(ObjectManager $manager, $queryBuilder, string $class); + abstract public function getLoader(ObjectManager $manager, object $queryBuilder, string $class); + /** + * @return string + */ public function getParent() { return ChoiceType::class; @@ -263,7 +264,7 @@ private function getCachedIdReader(ObjectManager $manager, string $class): ?IdRe return $this->idReaders[$hash] = $idReader->isSingleId() ? $idReader : null; } - private function getCachedEntityLoader(ObjectManager $manager, $queryBuilder, string $class, array $vary): EntityLoaderInterface + private function getCachedEntityLoader(ObjectManager $manager, object $queryBuilder, string $class, array $vary): EntityLoaderInterface { $hash = CachingFactoryDecorator::generateHash($vary); diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php index bed785cbd88c9..9286ac5792275 100644 --- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php +++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php @@ -11,6 +11,8 @@ namespace Symfony\Bridge\Doctrine\Validator\Constraints; +use Doctrine\ORM\EntityManagerInterface; +use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\Persistence\ManagerRegistry; use Symfony\Component\Validator\Constraint; use Symfony\Component\Validator\ConstraintValidator; @@ -175,7 +177,7 @@ public function validate($entity, Constraint $constraint) ->addViolation(); } - private function formatWithIdentifiers($em, $class, $value) + private function formatWithIdentifiers(EntityManagerInterface $em, ClassMetadata $class, $value) { if (!\is_object($value) || $value instanceof \DateTimeInterface) { return $this->formatValue($value, self::PRETTY_DATE); diff --git a/src/Symfony/Component/BrowserKit/AbstractBrowser.php b/src/Symfony/Component/BrowserKit/AbstractBrowser.php index b1f0a0abecf75..79e9b4bca0f23 100644 --- a/src/Symfony/Component/BrowserKit/AbstractBrowser.php +++ b/src/Symfony/Component/BrowserKit/AbstractBrowser.php @@ -423,7 +423,7 @@ public function request(string $method, string $uri, array $parameters = [], arr * * @throws \RuntimeException When processing returns exit code */ - protected function doRequestInProcess($request) + protected function doRequestInProcess(object $request) { $deprecationsFile = tempnam(sys_get_temp_dir(), 'deprec'); putenv('SYMFONY_DEPRECATIONS_SERIALIZE='.$deprecationsFile); @@ -458,7 +458,7 @@ protected function doRequestInProcess($request) * * @return object An origin response instance */ - abstract protected function doRequest($request); + abstract protected function doRequest(object $request); /** * Returns the script to execute when the request must be insulated. @@ -467,7 +467,7 @@ abstract protected function doRequest($request); * * @throws \LogicException When this abstract class is not implemented */ - protected function getScript($request) + protected function getScript(object $request) { throw new \LogicException('To insulate requests, you need to override the getScript() method.'); } @@ -489,7 +489,7 @@ protected function filterRequest(Request $request) * * @return Response An BrowserKit Response instance */ - protected function filterResponse($response) + protected function filterResponse(object $response) { return $response; } @@ -681,7 +681,7 @@ protected function getAbsoluteUri(string $uri) * * @return Crawler */ - protected function requestFromRequest(Request $request, $changeHistory = true) + protected function requestFromRequest(Request $request, bool $changeHistory = true) { return $this->request($request->getMethod(), $request->getUri(), $request->getParameters(), $request->getFiles(), $request->getServer(), $request->getContent(), $changeHistory); } diff --git a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php index 00d7125b2a73d..10b54aa143757 100644 --- a/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php +++ b/src/Symfony/Component/Config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php @@ -461,10 +461,7 @@ protected function assertNode(string $expectedName, string $expectedType, NodeDe $this->assertSame($expectedName, $this->getField($actualNode, 'name')); } - /** - * @param object $object - */ - protected function getField($object, string $field) + protected function getField(object $object, string $field) { $reflection = new \ReflectionProperty($object, $field); $reflection->setAccessible(true); diff --git a/src/Symfony/Component/Console/Descriptor/DescriptorInterface.php b/src/Symfony/Component/Console/Descriptor/DescriptorInterface.php index e3184a6a5a208..ebea30367ec2a 100644 --- a/src/Symfony/Component/Console/Descriptor/DescriptorInterface.php +++ b/src/Symfony/Component/Console/Descriptor/DescriptorInterface.php @@ -20,10 +20,5 @@ */ interface DescriptorInterface { - /** - * Describes an object if supported. - * - * @param object $object - */ - public function describe(OutputInterface $output, $object, array $options = []); + public function describe(OutputInterface $output, object $object, array $options = []); } diff --git a/src/Symfony/Component/Messenger/Envelope.php b/src/Symfony/Component/Messenger/Envelope.php index a066f5044d13c..ad6d2de210ca3 100644 --- a/src/Symfony/Component/Messenger/Envelope.php +++ b/src/Symfony/Component/Messenger/Envelope.php @@ -24,14 +24,10 @@ final class Envelope private $message; /** - * @param object $message * @param StampInterface[] $stamps */ - public function __construct($message, array $stamps = []) + public function __construct(object $message, array $stamps = []) { - if (!\is_object($message)) { - throw new \TypeError(sprintf('Invalid argument provided to "%s()": expected object but got "%s".', __METHOD__, get_debug_type($message))); - } $this->message = $message; foreach ($stamps as $stamp) { @@ -45,7 +41,7 @@ public function __construct($message, array $stamps = []) * @param object|Envelope $message * @param StampInterface[] $stamps */ - public static function wrap($message, array $stamps = []): self + public static function wrap(object $message, array $stamps = []): self { $envelope = $message instanceof self ? $message : new self($message); diff --git a/src/Symfony/Component/Messenger/Exception/ValidationFailedException.php b/src/Symfony/Component/Messenger/Exception/ValidationFailedException.php index 9b12d64ac6c67..fe129cd78a991 100644 --- a/src/Symfony/Component/Messenger/Exception/ValidationFailedException.php +++ b/src/Symfony/Component/Messenger/Exception/ValidationFailedException.php @@ -21,10 +21,7 @@ class ValidationFailedException extends RuntimeException private $violations; private $violatingMessage; - /** - * @param object $violatingMessage - */ - public function __construct($violatingMessage, ConstraintViolationListInterface $violations) + public function __construct(object $violatingMessage, ConstraintViolationListInterface $violations) { $this->violatingMessage = $violatingMessage; $this->violations = $violations; diff --git a/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php b/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php index 97eb4f9d41a55..7a2ebc459e7dd 100644 --- a/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php +++ b/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManagerInterface.php @@ -23,8 +23,8 @@ interface AccessDecisionManagerInterface /** * Decides whether the access is possible or not. * - * @param array $attributes An array of attributes associated with the method being invoked - * @param object $object The object to secure + * @param array $attributes An array of attributes associated with the method being invoked + * @param mixed $object The object to secure * * @return bool true if the access is granted, false otherwise */ diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php index aa1be48cfbaf5..57873391c0c31 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php @@ -236,11 +236,9 @@ protected function instantiateObject(array &$data, string $class, array &$contex /** * Gets and caches attributes for the given object, format and context. * - * @param object $object - * * @return string[] */ - protected function getAttributes($object, ?string $format, array $context) + protected function getAttributes(object $object, ?string $format, array $context) { $class = $this->objectClassResolver ? ($this->objectClassResolver)($object) : \get_class($object); $key = $class.'-'.$context['cache_key']; diff --git a/src/Symfony/Component/Validator/Context/ExecutionContext.php b/src/Symfony/Component/Validator/Context/ExecutionContext.php index bffe99709182b..bd2d2f24000e8 100644 --- a/src/Symfony/Component/Validator/Context/ExecutionContext.php +++ b/src/Symfony/Component/Validator/Context/ExecutionContext.php @@ -351,12 +351,8 @@ public function isObjectInitialized(string $cacheKey): bool /** * @internal - * - * @param object $object - * - * @return string */ - public function generateCacheKey($object) + public function generateCacheKey(object $object): string { if (!isset($this->cachedObjectsRefs[$object])) { $this->cachedObjectsRefs[$object] = spl_object_hash($object); diff --git a/src/Symfony/Component/Validator/ObjectInitializerInterface.php b/src/Symfony/Component/Validator/ObjectInitializerInterface.php index 8d0688ceced03..6f3ac5e2f6b86 100644 --- a/src/Symfony/Component/Validator/ObjectInitializerInterface.php +++ b/src/Symfony/Component/Validator/ObjectInitializerInterface.php @@ -22,10 +22,5 @@ */ interface ObjectInitializerInterface { - /** - * Initializes an object just before validation. - * - * @param object $object The object to validate - */ public function initialize(object $object); } diff --git a/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php b/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php index 0a6afadf10c36..a8fce8da44f7c 100644 --- a/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php +++ b/src/Symfony/Component/Validator/Validator/ContextualValidatorInterface.php @@ -41,7 +41,7 @@ public function atPath(string $path); * {@link \Symfony\Component\Validator\Constraints\Valid} is assumed. * * @param mixed $value The value to validate - * @param Constraint|Constraint[] $constraints The constraint(s) to validate against + * @param Constraint|Constraint[]|null $constraints The constraint(s) to validate against * @param string|GroupSequence|array|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return $this @@ -52,13 +52,12 @@ public function validate($value, $constraints = null, $groups = null); * Validates a property of an object against the constraints specified * for this property. * - * @param object $object The object * @param string $propertyName The name of the validated property * @param string|GroupSequence|array|null $groups The validation groups to validate. If none is given, "Default" is assumed * * @return $this */ - public function validateProperty($object, string $propertyName, $groups = null); + public function validateProperty(object $object, string $propertyName, $groups = null); /** * Validates a value against the constraints specified for an object's diff --git a/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php b/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php index f9dc81a23e8c1..01aeda2b364fe 100644 --- a/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php +++ b/src/Symfony/Component/Validator/Validator/RecursiveContextualValidator.php @@ -166,7 +166,7 @@ public function validate($value, $constraints = null, $groups = null) /** * {@inheritdoc} */ - public function validateProperty($object, string $propertyName, $groups = null) + public function validateProperty(object $object, string $propertyName, $groups = null) { $classMetadata = $this->metadataFactory->getMetadataFor($object); @@ -300,7 +300,7 @@ protected function normalizeGroups($groups) * metadata factory does not implement * {@link ClassMetadataInterface} */ - private function validateObject($object, string $propertyPath, array $groups, int $traversalStrategy, ExecutionContextInterface $context) + private function validateObject(object $object, string $propertyPath, array $groups, int $traversalStrategy, ExecutionContextInterface $context) { try { $classMetadata = $this->metadataFactory->getMetadataFor($object); @@ -765,10 +765,7 @@ private function validateInGroup($value, ?string $cacheKey, MetadataInterface $m } } - /** - * @param object $object - */ - private function generateCacheKey($object, bool $dependsOnPropertyPath = false): string + private function generateCacheKey(object $object, bool $dependsOnPropertyPath = false): string { if ($this->context instanceof ExecutionContext) { $cacheKey = $this->context->generateCacheKey($object); diff --git a/src/Symfony/Component/Validator/Validator/ValidatorInterface.php b/src/Symfony/Component/Validator/Validator/ValidatorInterface.php index f1d76df5336cd..17495b1d075cf 100644 --- a/src/Symfony/Component/Validator/Validator/ValidatorInterface.php +++ b/src/Symfony/Component/Validator/Validator/ValidatorInterface.php @@ -44,7 +44,6 @@ public function validate($value, $constraints = null, $groups = null); * Validates a property of an object against the constraints specified * for this property. * - * @param object $object The object * @param string $propertyName The name of the validated property * @param string|GroupSequence|array|null $groups The validation groups to validate. If none is given, "Default" is assumed * @@ -52,7 +51,7 @@ public function validate($value, $constraints = null, $groups = null); * If the list is empty, validation * succeeded */ - public function validateProperty($object, string $propertyName, $groups = null); + public function validateProperty(object $object, string $propertyName, $groups = null); /** * Validates a value against the constraints specified for an object's