From dd213bf3b77e774de6d93cf7476eb3e1c43e436a Mon Sep 17 00:00:00 2001 From: Alexandre Daubois Date: Thu, 4 Apr 2024 16:20:07 +0200 Subject: [PATCH] Fix and improve overall PHPDocs This also remove a few useless ones already inferred in the code --- .../Bridge/Doctrine/Test/TestRepositoryFactory.php | 1 - .../Tests/LazyProxy/ContainerBuilderTest.php | 2 +- .../Instantiator/RuntimeInstantiatorTest.php | 2 +- .../Command/AssetsInstallCommand.php | 1 - .../Tests/Controller/AbstractControllerTest.php | 4 ---- .../Functional/Bundle/TestBundle/TestBundle.php | 2 +- .../Asset/Exception/AssetNotFoundException.php | 8 ++++---- src/Symfony/Component/Asset/Packages.php | 10 +++++----- .../VersionStrategy/StaticVersionStrategy.php | 4 ++-- src/Symfony/Component/BrowserKit/Request.php | 14 +++++++------- .../Component/Cache/Adapter/PhpFilesAdapter.php | 4 ++-- .../Component/Config/Definition/BaseNode.php | 6 +++--- .../Console/Completion/CompletionInput.php | 2 +- .../Console/Output/ConsoleSectionOutput.php | 2 +- .../Component/CssSelector/XPath/Translator.php | 1 - .../DependencyInjection/ContainerBuilder.php | 2 +- .../DependencyInjection/EnvVarProcessor.php | 2 +- .../Tests/ContainerBuilderTest.php | 2 +- .../ErrorRenderer/HtmlErrorRenderer.php | 6 +++--- .../ErrorRenderer/SerializerErrorRenderer.php | 6 +++--- .../Tests/Fixtures/ReturnTypeParent.php | 3 --- .../Component/ErrorHandler/ThrowableUtils.php | 2 +- .../Factory/ChoiceListFactoryInterface.php | 2 +- .../Validator/Constraints/FormValidator.php | 1 - .../Extension/Validator/ValidatorExtension.php | 2 +- src/Symfony/Component/Form/FormBuilder.php | 2 +- src/Symfony/Component/Form/ResolvedFormType.php | 1 - .../Component/Form/Tests/SimpleFormTest.php | 1 - .../Component/HttpKernel/Event/KernelEvent.php | 4 ++-- .../Intl/DateFormatter/IntlDateFormatter.php | 3 +-- .../Lock/Tests/Store/ExpiringStoreTestTrait.php | 5 ----- .../Messenger/Tests/FailureIntegrationTest.php | 2 -- .../Transport/Serialization/PhpSerializer.php | 2 +- .../PropertyInfo/Extractor/PhpDocExtractor.php | 6 +++--- .../Component/Routing/RouteCollectionBuilder.php | 1 - .../Routing/Tests/Fixtures/validresource.php | 2 +- src/Symfony/Component/Runtime/GenericRuntime.php | 2 +- src/Symfony/Component/Runtime/SymfonyRuntime.php | 2 +- .../Serializer/Normalizer/AbstractNormalizer.php | 4 +--- .../Component/Serializer/Tests/SerializerTest.php | 2 +- .../Mapping/Loader/StaticMethodLoader.php | 1 - src/Symfony/Contracts/Cache/CacheInterface.php | 2 +- 42 files changed, 54 insertions(+), 79 deletions(-) diff --git a/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php b/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php index f08e2154d06e9..ee03e29cf8a13 100644 --- a/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php +++ b/src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php @@ -84,7 +84,6 @@ public function setRepository(EntityManagerInterface $entityManager, string $ent private function createRepository(EntityManagerInterface $entityManager, string $entityName): ObjectRepository { - /* @var $metadata ClassMetadata */ $metadata = $entityManager->getClassMetadata($entityName); $repositoryClassName = $metadata->customRepositoryClassName ?: $entityManager->getConfiguration()->getDefaultRepositoryClassName(); diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/ContainerBuilderTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/ContainerBuilderTest.php index cf3d2cdbd9f07..ccf58bf15c8c1 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/ContainerBuilderTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/ContainerBuilderTest.php @@ -37,7 +37,7 @@ public function testCreateProxyServiceWithRuntimeInstantiator() $builder->compile(); - /* @var $foo1 \ProxyManager\Proxy\LazyLoadingInterface|\ProxyManager\Proxy\ValueHolderInterface */ + /* @var \ProxyManager\Proxy\LazyLoadingInterface|\ProxyManager\Proxy\ValueHolderInterface $foo1 */ $foo1 = $builder->get('foo1'); $foo1->__destruct(); diff --git a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php index e202fad702655..0225bf31930db 100644 --- a/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php +++ b/src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php @@ -47,7 +47,7 @@ public function testInstantiateProxy() return $instance; }; - /* @var $proxy LazyLoadingInterface|ValueHolderInterface */ + /* @var LazyLoadingInterface|ValueHolderInterface $proxy */ $proxy = $this->instantiator->instantiateProxy($container, $definition, 'foo', $instantiator); $this->assertInstanceOf(LazyLoadingInterface::class, $proxy); diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php index 870e686de934e..da2474567d03e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php +++ b/src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php @@ -131,7 +131,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int $copyUsed = false; $exitCode = 0; $validAssetDirs = []; - /** @var BundleInterface $bundle */ foreach ($kernel->getBundles() as $bundle) { if (!is_dir($originDir = $bundle->getPath().'/Resources/public') && !is_dir($originDir = $bundle->getPath().'/public')) { continue; diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php index 2de0f7c919fe0..6ef3e4da0d86d 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php @@ -255,7 +255,6 @@ public function testFile() $controller = $this->createController(); $controller->setContainer($container); - /* @var BinaryFileResponse $response */ $response = $controller->file(new File(__FILE__)); $this->assertInstanceOf(BinaryFileResponse::class, $response); $this->assertSame(200, $response->getStatusCode()); @@ -270,7 +269,6 @@ public function testFileAsInline() { $controller = $this->createController(); - /* @var BinaryFileResponse $response */ $response = $controller->file(new File(__FILE__), null, ResponseHeaderBag::DISPOSITION_INLINE); $this->assertInstanceOf(BinaryFileResponse::class, $response); @@ -320,7 +318,6 @@ public function testFileFromPath() { $controller = $this->createController(); - /* @var BinaryFileResponse $response */ $response = $controller->file(__FILE__); $this->assertInstanceOf(BinaryFileResponse::class, $response); @@ -336,7 +333,6 @@ public function testFileFromPathWithCustomizedFileName() { $controller = $this->createController(); - /* @var BinaryFileResponse $response */ $response = $controller->file(__FILE__, 'test.php'); $this->assertInstanceOf(BinaryFileResponse::class, $response); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php index 13c368fd585e4..3c1e504534cf0 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php @@ -25,7 +25,7 @@ public function build(ContainerBuilder $container) { parent::build($container); - /** @var $extension DependencyInjection\TestExtension */ + /** @var DependencyInjection\TestExtension $extension */ $extension = $container->getExtension('test'); if (!$container->getParameterBag() instanceof FrozenParameterBag) { diff --git a/src/Symfony/Component/Asset/Exception/AssetNotFoundException.php b/src/Symfony/Component/Asset/Exception/AssetNotFoundException.php index d066ccd451ea1..8e2e844240a8b 100644 --- a/src/Symfony/Component/Asset/Exception/AssetNotFoundException.php +++ b/src/Symfony/Component/Asset/Exception/AssetNotFoundException.php @@ -19,10 +19,10 @@ class AssetNotFoundException extends RuntimeException private $alternatives; /** - * @param string $message Exception message to throw - * @param array $alternatives List of similar defined names - * @param int $code Exception code - * @param \Throwable $previous Previous exception used for the exception chaining + * @param string $message Exception message to throw + * @param array $alternatives List of similar defined names + * @param int $code Exception code + * @param ?\Throwable $previous Previous exception used for the exception chaining */ public function __construct(string $message, array $alternatives = [], int $code = 0, ?\Throwable $previous = null) { diff --git a/src/Symfony/Component/Asset/Packages.php b/src/Symfony/Component/Asset/Packages.php index 7673432ee8709..e6279b948b15e 100644 --- a/src/Symfony/Component/Asset/Packages.php +++ b/src/Symfony/Component/Asset/Packages.php @@ -50,7 +50,7 @@ public function addPackage(string $name, PackageInterface $package) /** * Returns an asset package. * - * @param string $name The name of the package or null for the default package + * @param string|null $name The name of the package or null for the default package * * @return PackageInterface * @@ -77,8 +77,8 @@ public function getPackage(?string $name = null) /** * Gets the version to add to public URL. * - * @param string $path A public path - * @param string $packageName A package name + * @param string $path A public path + * @param string|null $packageName A package name * * @return string */ @@ -92,8 +92,8 @@ public function getVersion(string $path, ?string $packageName = null) * * Absolute paths (i.e. http://...) are returned unmodified. * - * @param string $path A public path - * @param string $packageName The name of the asset package to use + * @param string $path A public path + * @param string|null $packageName The name of the asset package to use * * @return string A public path which takes into account the base path and URL path */ diff --git a/src/Symfony/Component/Asset/VersionStrategy/StaticVersionStrategy.php b/src/Symfony/Component/Asset/VersionStrategy/StaticVersionStrategy.php index 9e6e9ce8bae4e..5d348a3021447 100644 --- a/src/Symfony/Component/Asset/VersionStrategy/StaticVersionStrategy.php +++ b/src/Symfony/Component/Asset/VersionStrategy/StaticVersionStrategy.php @@ -22,8 +22,8 @@ class StaticVersionStrategy implements VersionStrategyInterface private $format; /** - * @param string $version Version number - * @param string $format Url format + * @param string $version Version number + * @param string|null $format Url format */ public function __construct(string $version, ?string $format = null) { diff --git a/src/Symfony/Component/BrowserKit/Request.php b/src/Symfony/Component/BrowserKit/Request.php index 9ab1afd99e705..a00145fa7bce8 100644 --- a/src/Symfony/Component/BrowserKit/Request.php +++ b/src/Symfony/Component/BrowserKit/Request.php @@ -25,13 +25,13 @@ class Request protected $content; /** - * @param string $uri The request URI - * @param string $method The HTTP method request - * @param array $parameters The request parameters - * @param array $files An array of uploaded files - * @param array $cookies An array of cookies - * @param array $server An array of server parameters - * @param string $content The raw body data + * @param string $uri The request URI + * @param string $method The HTTP method request + * @param array $parameters The request parameters + * @param array $files An array of uploaded files + * @param array $cookies An array of cookies + * @param array $server An array of server parameters + * @param string|null $content The raw body data */ public function __construct(string $uri, string $method, array $parameters = [], array $files = [], array $cookies = [], array $server = [], ?string $content = null) { diff --git a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php index 8dcd79cd98a90..c8fc1059acf40 100644 --- a/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php +++ b/src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php @@ -38,8 +38,8 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface private static $valuesCache = []; /** - * @param $appendOnly Set to `true` to gain extra performance when the items stored in this pool never expire. - * Doing so is encouraged because it fits perfectly OPcache's memory model. + * @param bool $appendOnly Set to `true` to gain extra performance when the items stored in this pool never expire. + * Doing so is encouraged because it fits perfectly OPcache's memory model. * * @throws CacheException if OPcache is not enabled */ diff --git a/src/Symfony/Component/Config/Definition/BaseNode.php b/src/Symfony/Component/Config/Definition/BaseNode.php index e4ba288aaff26..3253ae74b956e 100644 --- a/src/Symfony/Component/Config/Definition/BaseNode.php +++ b/src/Symfony/Component/Config/Definition/BaseNode.php @@ -196,9 +196,9 @@ public function setRequired(bool $boolean) /** * Sets this node as deprecated. * - * @param string $package The name of the composer package that is triggering the deprecation - * @param string $version The version of the package that introduced the deprecation - * @param string $message the deprecation message to use + * @param string|null $package The name of the composer package that is triggering the deprecation + * @param string $version The version of the package that introduced the deprecation + * @param string $message the deprecation message to use * * You can use %node% and %path% placeholders in your message to display, * respectively, the node name and its complete path diff --git a/src/Symfony/Component/Console/Completion/CompletionInput.php b/src/Symfony/Component/Console/Completion/CompletionInput.php index 368b945079484..2f631bcd8484f 100644 --- a/src/Symfony/Component/Console/Completion/CompletionInput.php +++ b/src/Symfony/Component/Console/Completion/CompletionInput.php @@ -53,7 +53,7 @@ public static function fromString(string $inputStr, int $currentIndex): self * Create an input based on an COMP_WORDS token list. * * @param string[] $tokens the set of split tokens (e.g. COMP_WORDS or argv) - * @param $currentIndex the index of the cursor (e.g. COMP_CWORD) + * @param int $currentIndex the index of the cursor (e.g. COMP_CWORD) */ public static function fromTokens(array $tokens, int $currentIndex): self { diff --git a/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php b/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php index 70d70c50bb84e..2f08034531e38 100644 --- a/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php +++ b/src/Symfony/Component/Console/Output/ConsoleSectionOutput.php @@ -41,7 +41,7 @@ public function __construct($stream, array &$sections, int $verbosity, bool $dec /** * Clears previous output for this section. * - * @param int $lines Number of lines to clear. If null, then the entire output of this section is cleared + * @param int|null $lines Number of lines to clear. If null, then the entire output of this section is cleared */ public function clear(?int $lines = null) { diff --git a/src/Symfony/Component/CssSelector/XPath/Translator.php b/src/Symfony/Component/CssSelector/XPath/Translator.php index 3d3ac7ac92b9a..abea96edaa194 100644 --- a/src/Symfony/Component/CssSelector/XPath/Translator.php +++ b/src/Symfony/Component/CssSelector/XPath/Translator.php @@ -94,7 +94,6 @@ public function cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self { $selectors = $this->parseSelectors($cssExpr); - /** @var SelectorNode $selector */ foreach ($selectors as $index => $selector) { if (null !== $selector->getPseudoElement()) { throw new ExpressionErrorException('Pseudo-elements are not supported.'); diff --git a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php index a9e61ab88121d..154a0aa6335f6 100644 --- a/src/Symfony/Component/DependencyInjection/ContainerBuilder.php +++ b/src/Symfony/Component/DependencyInjection/ContainerBuilder.php @@ -1389,7 +1389,7 @@ public function getAutoconfiguredAttributes(): array * @param string|true|null $format A sprintf() format returning the replacement for each env var name or * null to resolve back to the original "%env(VAR)%" format or * true to resolve to the actual values of the referenced env vars - * @param array &$usedEnvs Env vars found while resolving are added to this array + * @param array|null &$usedEnvs Env vars found while resolving are added to this array * * @return mixed The value with env parameters resolved if a string or an array is passed */ diff --git a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php index a9f88128cc009..f731b6be9c47f 100644 --- a/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php +++ b/src/Symfony/Component/DependencyInjection/EnvVarProcessor.php @@ -25,7 +25,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface private $loadedVars = []; /** - * @param EnvVarLoaderInterface[] $loaders + * @param EnvVarLoaderInterface[]|null $loaders */ public function __construct(ContainerInterface $container, ?\Traversable $loaders = null) { diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php index 21acd7fc962a4..82946ad71ccb6 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php @@ -952,7 +952,7 @@ public function testAddObjectResource() $this->assertCount(1, $resources); - /* @var $resource \Symfony\Component\Config\Resource\FileResource */ + /* @var \Symfony\Component\Config\Resource\FileResource $resource */ $resource = end($resources); $this->assertInstanceOf(FileResource::class, $resource); diff --git a/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php b/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php index 5b264fa5a7e90..be24f51976227 100644 --- a/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php +++ b/src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php @@ -231,9 +231,9 @@ private function getFileLink(string $file, int $line) /** * Formats a file path. * - * @param string $file An absolute file path - * @param int $line The line number - * @param string $text Use this text for the link rather than the file path + * @param string $file An absolute file path + * @param int $line The line number + * @param string|null $text Use this text for the link rather than the file path */ private function formatFile(string $file, int $line, ?string $text = null): string { diff --git a/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php b/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php index e6c4c898e19df..c77600b2069f4 100644 --- a/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php +++ b/src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php @@ -30,9 +30,9 @@ class SerializerErrorRenderer implements ErrorRendererInterface private $debug; /** - * @param string|callable(FlattenException) $format The format as a string or a callable that should return it - * formats not supported by Request::getMimeTypes() should be given as mime types - * @param bool|callable $debug The debugging mode as a boolean or a callable that should return it + * @param string|callable(FlattenException): string $format The format as a string or a callable that should return it + * formats not supported by Request::getMimeTypes() should be given as mime types + * @param bool|callable $debug The debugging mode as a boolean or a callable that should return it */ public function __construct(SerializerInterface $serializer, $format, ?ErrorRendererInterface $fallbackErrorRenderer = null, $debug = false) { diff --git a/src/Symfony/Component/ErrorHandler/Tests/Fixtures/ReturnTypeParent.php b/src/Symfony/Component/ErrorHandler/Tests/Fixtures/ReturnTypeParent.php index d42c7c8c02167..546d64ce3c607 100644 --- a/src/Symfony/Component/ErrorHandler/Tests/Fixtures/ReturnTypeParent.php +++ b/src/Symfony/Component/ErrorHandler/Tests/Fixtures/ReturnTypeParent.php @@ -18,9 +18,6 @@ public function returnTypeGrandParent() { } - /** - * @return string - */ abstract public function realReturnTypeMustBeThere(): string; /** diff --git a/src/Symfony/Component/ErrorHandler/ThrowableUtils.php b/src/Symfony/Component/ErrorHandler/ThrowableUtils.php index 18d04988ac342..4dcb9fc9e777c 100644 --- a/src/Symfony/Component/ErrorHandler/ThrowableUtils.php +++ b/src/Symfony/Component/ErrorHandler/ThrowableUtils.php @@ -19,7 +19,7 @@ class ThrowableUtils { /** - * @param SilencedErrorContext|\Throwable + * @param SilencedErrorContext|\Throwable $throwable */ public static function getSeverity($throwable): int { diff --git a/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php b/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php index c6c654b6f8a4b..0978d12180a42 100644 --- a/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php +++ b/src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php @@ -35,7 +35,7 @@ interface ChoiceListFactoryInterface * * @return ChoiceListInterface */ - public function createListFromChoices(iterable $choices, ?callable $value = null/* , callable $filter = null */); + public function createListFromChoices(iterable $choices, ?callable $value = null/* , ?callable $filter = null */); /** * Creates a choice list that is loaded with the given loader. diff --git a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php index 47982f3fc99f1..0f800d13590cf 100644 --- a/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php +++ b/src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php @@ -42,7 +42,6 @@ public function validate($form, Constraint $formConstraint) return; } - /* @var FormInterface $form */ $config = $form->getConfig(); $validator = $this->context->getValidator()->inContext($this->context); diff --git a/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php b/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php index 16b84eb2c40bc..ec4132fd5afde 100644 --- a/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php +++ b/src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php @@ -42,7 +42,7 @@ public function __construct(ValidatorInterface $validator, bool $legacyErrorMess // the DIC, where the XML file is loaded automatically. Thus the following // code must be kept synchronized with validation.xml - /* @var $metadata ClassMetadata */ + /* @var ClassMetadata $metadata */ $metadata->addConstraint(new Form()); $metadata->addConstraint(new Traverse(false)); diff --git a/src/Symfony/Component/Form/FormBuilder.php b/src/Symfony/Component/Form/FormBuilder.php index 3881cc56deb52..53c1ad1732160 100644 --- a/src/Symfony/Component/Form/FormBuilder.php +++ b/src/Symfony/Component/Form/FormBuilder.php @@ -178,7 +178,7 @@ public function count() */ public function getFormConfig() { - /** @var $config self */ + /** @var self $config */ $config = parent::getFormConfig(); $config->children = []; diff --git a/src/Symfony/Component/Form/ResolvedFormType.php b/src/Symfony/Component/Form/ResolvedFormType.php index d76ce9d6f2a0b..aefe7c8f77595 100644 --- a/src/Symfony/Component/Form/ResolvedFormType.php +++ b/src/Symfony/Component/Form/ResolvedFormType.php @@ -163,7 +163,6 @@ public function finishView(FormView $view, FormInterface $form, array $options) $this->innerType->finishView($view, $form, $options); foreach ($this->typeExtensions as $extension) { - /* @var FormTypeExtensionInterface $extension */ $extension->finishView($view, $form, $options); } } diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php index af091b49c9206..fc759dbd0d634 100644 --- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php +++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php @@ -1052,7 +1052,6 @@ public function testInitializeSetsDefaultData() $config = $this->getBuilder()->setData('DEFAULT')->getFormConfig(); $form = new Form($config); - /* @var Form $form */ $form->initialize(); $this->assertSame('DEFAULT', $form->getData()); diff --git a/src/Symfony/Component/HttpKernel/Event/KernelEvent.php b/src/Symfony/Component/HttpKernel/Event/KernelEvent.php index d9d425e114b93..dd67b9df1a8e8 100644 --- a/src/Symfony/Component/HttpKernel/Event/KernelEvent.php +++ b/src/Symfony/Component/HttpKernel/Event/KernelEvent.php @@ -27,8 +27,8 @@ class KernelEvent extends Event private $requestType; /** - * @param int $requestType The request type the kernel is currently processing; one of - * HttpKernelInterface::MAIN_REQUEST or HttpKernelInterface::SUB_REQUEST + * @param int|null $requestType The request type the kernel is currently processing; one of + * HttpKernelInterface::MAIN_REQUEST or HttpKernelInterface::SUB_REQUEST */ public function __construct(HttpKernelInterface $kernel, Request $request, ?int $requestType) { diff --git a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php index 31a6758028864..4b0de465eef0c 100644 --- a/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php +++ b/src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php @@ -235,8 +235,7 @@ public function format($timestamp) /** * Not supported. Formats an object. * - * @param mixed $format - * @param string $locale + * @param mixed $format * * @return string The formatted value * diff --git a/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php b/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php index 27a8406f768e4..fd5bc83a31058 100644 --- a/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php +++ b/src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php @@ -44,7 +44,6 @@ public function testExpiration() $key = new Key(uniqid(__METHOD__, true)); $clockDelay = $this->getClockDelay(); - /** @var PersistingStoreInterface $store */ $store = $this->getStore(); $store->save($key); @@ -63,7 +62,6 @@ public function testAbortAfterExpiration() $this->expectException(LockExpiredException::class); $key = new Key(uniqid(__METHOD__, true)); - /** @var PersistingStoreInterface $store */ $store = $this->getStore(); $store->save($key); @@ -82,7 +80,6 @@ public function testRefreshLock() $key = new Key(uniqid(__METHOD__, true)); - /** @var PersistingStoreInterface $store */ $store = $this->getStore(); $store->save($key); @@ -97,7 +94,6 @@ public function testSetExpiration() { $key = new Key(uniqid(__METHOD__, true)); - /** @var PersistingStoreInterface $store */ $store = $this->getStore(); $store->save($key); @@ -113,7 +109,6 @@ public function testExpiredLockCleaned() $key1 = new Key($resource); $key2 = new Key($resource); - /** @var PersistingStoreInterface $store */ $store = $this->getStore(); $key1->reduceLifetime(0); diff --git a/src/Symfony/Component/Messenger/Tests/FailureIntegrationTest.php b/src/Symfony/Component/Messenger/Tests/FailureIntegrationTest.php index 00c3571d678f6..ba1879f9bdb54 100644 --- a/src/Symfony/Component/Messenger/Tests/FailureIntegrationTest.php +++ b/src/Symfony/Component/Messenger/Tests/FailureIntegrationTest.php @@ -158,7 +158,6 @@ public function testRequeueMechanism() // handling fails again, message is sent to failure transport $this->assertCount(0, $transport1->getMessagesWaitingToBeReceived()); $this->assertCount(1, $failureTransport->getMessagesWaitingToBeReceived()); - /** @var Envelope $failedEnvelope */ $failedEnvelope = $failureTransport->getMessagesWaitingToBeReceived()[0]; /** @var SentToFailureTransportStamp $sentToFailureStamp */ $sentToFailureStamp = $failedEnvelope->last(SentToFailureTransportStamp::class); @@ -347,7 +346,6 @@ public function testRequeueMechanismWithServiceLocator() // handling fails again, message is sent to failure transport $this->assertCount(0, $transport1->getMessagesWaitingToBeReceived()); $this->assertCount(1, $failureTransport->getMessagesWaitingToBeReceived()); - /** @var Envelope $failedEnvelope */ $failedEnvelope = $failureTransport->getMessagesWaitingToBeReceived()[0]; /** @var SentToFailureTransportStamp $sentToFailureStamp */ $sentToFailureStamp = $failedEnvelope->last(SentToFailureTransportStamp::class); diff --git a/src/Symfony/Component/Messenger/Transport/Serialization/PhpSerializer.php b/src/Symfony/Component/Messenger/Transport/Serialization/PhpSerializer.php index 0af44fd32e068..910617c2a621c 100644 --- a/src/Symfony/Component/Messenger/Transport/Serialization/PhpSerializer.php +++ b/src/Symfony/Component/Messenger/Transport/Serialization/PhpSerializer.php @@ -66,7 +66,7 @@ private function safelyUnserialize(string $contents) }); try { - /** @var Envelope */ + /** @var Envelope $envelope */ $envelope = unserialize($contents); } catch (\Throwable $e) { if ($e instanceof MessageDecodingFailedException) { diff --git a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php index ff23bb40783e4..c1a66ec04ec48 100644 --- a/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php +++ b/src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php @@ -76,7 +76,7 @@ public function __construct(?DocBlockFactoryInterface $docBlockFactory = null, ? */ public function getShortDescription(string $class, string $property, array $context = []): ?string { - /** @var $docBlock DocBlock */ + /** @var DocBlock $docBlock */ [$docBlock] = $this->getDocBlock($class, $property); if (!$docBlock) { return null; @@ -106,7 +106,7 @@ public function getShortDescription(string $class, string $property, array $cont */ public function getLongDescription(string $class, string $property, array $context = []): ?string { - /** @var $docBlock DocBlock */ + /** @var DocBlock $docBlock */ [$docBlock] = $this->getDocBlock($class, $property); if (!$docBlock) { return null; @@ -122,7 +122,7 @@ public function getLongDescription(string $class, string $property, array $conte */ public function getTypes(string $class, string $property, array $context = []): ?array { - /** @var $docBlock DocBlock */ + /** @var DocBlock $docBlock */ [$docBlock, $source, $prefix] = $this->getDocBlock($class, $property); if (!$docBlock) { return null; diff --git a/src/Symfony/Component/Routing/RouteCollectionBuilder.php b/src/Symfony/Component/Routing/RouteCollectionBuilder.php index 04a443972a9cf..b0962e354504c 100644 --- a/src/Symfony/Component/Routing/RouteCollectionBuilder.php +++ b/src/Symfony/Component/Routing/RouteCollectionBuilder.php @@ -61,7 +61,6 @@ public function __construct(?LoaderInterface $loader = null) */ public function import($resource, string $prefix = '/', ?string $type = null) { - /** @var RouteCollection[] $collections */ $collections = $this->load($resource, $type); // create a builder from the RouteCollection diff --git a/src/Symfony/Component/Routing/Tests/Fixtures/validresource.php b/src/Symfony/Component/Routing/Tests/Fixtures/validresource.php index 31d354a34cd00..c0cf4db0e1cae 100644 --- a/src/Symfony/Component/Routing/Tests/Fixtures/validresource.php +++ b/src/Symfony/Component/Routing/Tests/Fixtures/validresource.php @@ -1,6 +1,6 @@ import('validpattern.php'); $collection->addDefaults([ diff --git a/src/Symfony/Component/Runtime/GenericRuntime.php b/src/Symfony/Component/Runtime/GenericRuntime.php index fa9364881363e..ea306e9c9d1b4 100644 --- a/src/Symfony/Component/Runtime/GenericRuntime.php +++ b/src/Symfony/Component/Runtime/GenericRuntime.php @@ -49,7 +49,7 @@ class GenericRuntime implements RuntimeInterface protected $options; /** - * @param array { + * @param array{ * debug?: ?bool, * runtimes?: ?array, * error_handler?: string|false, diff --git a/src/Symfony/Component/Runtime/SymfonyRuntime.php b/src/Symfony/Component/Runtime/SymfonyRuntime.php index 0ca9713049545..abe00e6f3a30c 100644 --- a/src/Symfony/Component/Runtime/SymfonyRuntime.php +++ b/src/Symfony/Component/Runtime/SymfonyRuntime.php @@ -72,7 +72,7 @@ class SymfonyRuntime extends GenericRuntime private $command; /** - * @param array { + * @param array{ * debug?: ?bool, * env?: ?string, * disable_dotenv?: ?bool, diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php index 2192f8ac23c97..946c7e388a7b1 100644 --- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php +++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php @@ -553,9 +553,7 @@ final protected function validateCallbackContext(array $context, string $context */ final protected function applyCallbacks($value, $object, string $attribute, ?string $format, array $context) { - /** - * @var callable|null - */ + /** @var callable|null $callback */ $callback = $context[self::CALLBACKS][$attribute] ?? $this->defaultContext[self::CALLBACKS][$attribute] ?? null; return $callback ? $callback($value, $object, $attribute, $format, $context) : $value; diff --git a/src/Symfony/Component/Serializer/Tests/SerializerTest.php b/src/Symfony/Component/Serializer/Tests/SerializerTest.php index 1fa299682dd3f..66fc24c4b31c6 100644 --- a/src/Symfony/Component/Serializer/Tests/SerializerTest.php +++ b/src/Symfony/Component/Serializer/Tests/SerializerTest.php @@ -1632,7 +1632,7 @@ class DummyUnionType public $changed = false; /** - * @param \DateTime|bool|null + * @param \DateTime|bool|null $changed * * @return $this */ diff --git a/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php b/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php index 256700e1ef64f..33dcdf7438bd3 100644 --- a/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php +++ b/src/Symfony/Component/Validator/Mapping/Loader/StaticMethodLoader.php @@ -38,7 +38,6 @@ public function __construct(string $methodName = 'loadValidatorMetadata') */ public function loadClassMetadata(ClassMetadata $metadata) { - /** @var \ReflectionClass $reflClass */ $reflClass = $metadata->getReflectionClass(); if (!$reflClass->isInterface() && $reflClass->hasMethod($this->methodName)) { diff --git a/src/Symfony/Contracts/Cache/CacheInterface.php b/src/Symfony/Contracts/Cache/CacheInterface.php index 70cb0d5446949..5abfd18b6b17d 100644 --- a/src/Symfony/Contracts/Cache/CacheInterface.php +++ b/src/Symfony/Contracts/Cache/CacheInterface.php @@ -36,7 +36,7 @@ interface CacheInterface * The default (or providing null) is implementation dependent but should * typically be 1.0, which should provide optimal stampede protection. * See https://en.wikipedia.org/wiki/Cache_stampede#Probabilistic_early_expiration - * @param array &$metadata The metadata of the cached item {@see ItemInterface::getMetadata()} + * @param array|null &$metadata The metadata of the cached item {@see ItemInterface::getMetadata()} * * @return mixed *