8000 Fix and improve overall PHPDocs · symfony/symfony@e6a8601 · GitHub
[go: up one dir, main page]

Skip to content

Commit e6a8601

Browse files
Fix and improve overall PHPDocs
This also remove a few useless ones already inferred in the code
1 parent e483eee commit e6a8601

File tree

45 files changed

+56
-82
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+56
-82
lines changed

src/Symfony/Bridge/Doctrine/Test/TestRepositoryFactory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ public function setRepository(EntityManagerInterface $entityManager, string $ent
8484

8585
private function createRepository(EntityManagerInterface $entityManager, string $entityName): ObjectRepository
8686
{
87-
/* @var $metadata ClassMetadata */
8887
$metadata = $entityManager->getClassMetadata($entityName);
8988
$repositoryClassName = $metadata->customRepositoryClassName ?: $entityManager->getConfiguration()->getDefaultRepositoryClassName();
9089

src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/ContainerBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public function testCreateProxyServiceWithRuntimeInstantiator()
3737

3838
$builder->compile();
3939

40-
/* @var $foo1 \ProxyManager\Proxy\LazyLoadingInterface|\ProxyManager\Proxy\ValueHolderInterface */
40+
/* @var \ProxyManager\Proxy\LazyLoadingInterface|\ProxyManager\Proxy\ValueHolderInterface $foo1 */
4141
$foo1 = $builder->get('foo1');
4242

4343
$foo1->__destruct();

src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Instantiator/RuntimeInstantiatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function testInstantiateProxy()
4747
return $instance;
4848
};
4949

50-
/* @var $proxy LazyLoadingInterface|ValueHolderInterface */
50+
/* @var LazyLoadingInterface|ValueHolderInterface $proxy */
5151
$proxy = $this->instantiator->instantiateProxy($container, $definition, 'foo', $instantiator);
5252

5353
$this->assertInstanceOf(LazyLoadingInterface::class, $proxy);

src/Symfony/Bundle/FrameworkBundle/Command/AssetsInstallCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
131131
$copyUsed = false;
132132
$exitCode = 0;
133133
$validAssetDirs = [];
134-
/** @var BundleInterface $bundle */
135134
foreach ($kernel->getBundles() as $bundle) {
136135
if (!is_dir($originDir = $bundle->getPath().'/Resources/public') && !is_dir($originDir = $bundle->getPath().'/public')) {
137136
continue;

src/Symfony/Bundle/FrameworkBundle/Tests/Controller/AbstractControllerTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ public function testFile()
255255
$controller = $this->createController();
256256
$controller->setContainer($container);
257257

258-
/* @var BinaryFileResponse $response */
259258
$response = $controller->file(new File(__FILE__));
260259
$this->assertInstanceOf(BinaryFileResponse::class, $response);
261260
$this->assertSame(200, $response->getStatusCode());
@@ -270,7 +269,6 @@ public function testFileAsInline()
270269
{
271270
$controller = $this->createController();
272271

273-
/* @var BinaryFileResponse $response */
274272
$response = $controller->file(new File(__FILE__), null, ResponseHeaderBag::DISPOSITION_INLINE);
275273

276274
$this->assertInstanceOf(BinaryFileResponse::class, $response);
@@ -320,7 +318,6 @@ public function testFileFromPath()
320318
{
321319
$controller = $this->createController();
322320

323-
/* @var BinaryFileResponse $response */
324321
$response = $controller->file(__FILE__);
325322

326323
$this->assertInstanceOf(BinaryFileResponse::class, $response);
@@ -336,7 +333,6 @@ public function testFileFromPathWithCustomizedFileName()
336333
{
337334
$controller = $this->createController();
338335

339-
/* @var BinaryFileResponse $response */
340336
$response = $controller->file(__FILE__, 'test.php');
341337

342338
$this->assertInstanceOf(BinaryFileResponse::class, $response);

src/Symfony/Bundle/FrameworkBundle/Tests/Functional/Bundle/TestBundle/TestBundle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function build(ContainerBuilder $container)
2525
{
2626
parent::build($container);
2727

28-
/** @var $extension DependencyInjection\TestExtension */
28+
/** @var DependencyInjection\TestExtension $extension */
2929
$extension = $container->getExtension('test');
3030

3131
if (!$container->getParameterBag() instanceof FrozenParameterBag) {

src/Symfony/Component/Asset/Exception/AssetNotFoundException.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ class AssetNotFoundException extends RuntimeException
1919
private $alternatives;
2020

2121
/**
22-
* @param string $message Exception message to throw
23-
* @param array $alternatives List of similar defined names
24-
* @param int $code Exception code
25-
* @param \Throwable $previous Previous exception used for the exception chaining
22+
* @param string $message Exception message to throw
23+
* @param array $alternatives List of similar defined names
24+
* @param int $code Exception code
25+
* @param ?\Throwable $previous Previous exception used for the exception chaining
2626
*/
2727
public function __construct(string $message, array $alternatives = [], int $code = 0, ?\Throwable $previous = null)
2828
{

src/Symfony/Component/Asset/Packages.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function addPackage(string $name, PackageInterface $package)
5050
/**
5151
* Returns an asset package.
5252
*
53-
* @param string $name The name of the package or null for the default package
53+
* @param string|null $name The name of the package or null for the default package
5454
*
5555
* @return PackageInterface
5656
*
@@ -77,8 +77,8 @@ public function getPackage(?string $name = null)
7777
/**
7878
* Gets the version to add to public URL.
7979
*
80-
* @param string $path A public path
81-
* @param string $packageName A package name
80+
* @param string $path A public path
81+
* @param string|null $packageName A package name
8282
*
8383
* @return string
8484
*/
@@ -92,8 +92,8 @@ public function getVersion(string $path, ?string $packageName = null)
9292
*
9393
* Absolute paths (i.e. http://...) are returned unmodified.
9494
*
95-
* @param string $path A public path
96-
* @param string $packageName The name of the asset package to use
95+
* @param string $path A public path
96+
* @param string|null $packageName The name of the asset package to use
9797
*
9898
* @return string A public path which takes into account the base path and URL path
9999
*/

src/Symfony/Component/Asset/VersionStrategy/StaticVersionStrategy.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class StaticVersionStrategy implements VersionStrategyInterface
2222
private $format;
2323

2424
/**
25-
* @param string $version Version number
26-
* @param string $format Url format
25+
* @param string $version Version number
26+
* @param string|null $format Url format
2727
*/
2828
public function __construct(string $version, ?string $format = null)
2929
{

src/Symfony/Component/BrowserKit/Request.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ class Request
2525
protected $content;
2626

2727
/**
28-
* @param string $uri The request URI
29-
* @param string $method The HTTP method request
30-
* @param array $parameters The request parameters
31-
* @param array $files An array of uploaded files
32-
* @param array $cookies An array of cookies
33-
* @param array $server An array of server parameters
34-
* @param string $content The raw body data
28+
* @param string $uri The request URI
29+
* @param string $method The HTTP method request
30+
* @param array $parameters The request parameters
31+
* @param array $files An array of uploaded files
32+
* @param array $cookies An array of cookies
33+
* @param array $server An array of server parameters
34+
* @param string|null $content The raw body data
3535
*/
3636
public function __construct(string $uri, string $method, array $parameters = [], array $files = [], array $cookies = [], array $server = [], ?string $content = null)
3737
{

src/Symfony/Component/Cache/Adapter/PhpFilesAdapter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ class PhpFilesAdapter extends AbstractAdapter implements PruneableInterface
3838
private static $valuesCache = [];
3939

4040
/**
41-
* @param $appendOnly Set to `true` to gain extra performance when the items stored in this pool never expire.
42-
* Doing so is encouraged because it fits perfectly OPcache's memory model.
41+
* @param bool $appendOnly Set to `true` to gain extra performance when the items stored in this pool never expire.
42+
* Doing so is encouraged because it fits perfectly OPcache's memory model.
4343
*
4444
* @throws CacheException if OPcache is not enabled
4545
*/

src/Symfony/Component/Config/Definition/BaseNode.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ public function setRequired(bool $boolean)
196196
/**
197197
* Sets this node as deprecated.
198198
*
199-
* @param string $package The name of the composer package that is triggering the deprecation
200-
* @param string $version The version of the package that introduced the deprecation
201-
* @param string $message the deprecation message to use
199+
* @param ?string $package The name of the composer package that is triggering the deprecation
200+
* @param string $version The version of the package that introduced the deprecation
201+
* @param string $message the deprecation message to use
202202
*
203203
* You can use %node% and %path% placeholders in your message to display,
204204
* respectively, the node name and its complete path

src/Symfony/Component/Console/Completion/CompletionInput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public static function fromString(string $inputStr, int $currentIndex): self
5353
* Create an input based on an COMP_WORDS token list.
5454
*
5555
* @param string[] $tokens the set of split tokens (e.g. COMP_WORDS or argv)
56-
* @param $currentIndex the index of the cursor (e.g. COMP_CWORD)
56+
* @param int $currentIndex the index of the cursor (e.g. COMP_CWORD)
5757
*/
5858
public static function fromTokens(array $tokens, int $currentIndex): self
5959
{

src/Symfony/Component/Console/Output/ConsoleSectionOutput.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function __construct($stream, array &$sections, int $verbosity, bool $dec
4141
/**
4242
* Clears previous output for this section.
4343
*
44-
* @param int $lines Number of lines to clear. If null, then the entire output of this section is cleared
44+
* @param int|null $lines Number of lines to clear. If null, then the entire output of this section is cleared
4545
*/
4646
public function clear(?int $lines = null)
4747
{

src/Symfony/Component/CssSelector/XPath/Translator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ public function cssToXPath(string $cssExpr, string $prefix = 'descendant-or-self
9494
{
9595
$selectors = $this->parseSelectors($cssExpr);
9696

97-
/** @var SelectorNode $selector */
9897
foreach ($selectors as $index => $selector) {
9998
if (null !== $selector->getPseudoElement()) {
10099
throw new ExpressionErrorException('Pseudo-elements are not supported.');

src/Symfony/Component/DependencyInjection/ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1389,7 +1389,7 @@ public function getAutoconfiguredAttributes(): array
13891389
* @param string|true|null $format A sprintf() format returning the replacement for each env var name or
13901390
* null to resolve back to the original "%env(VAR)%" format or
13911391
* true to resolve to the actual values of the referenced env vars
1392-
* @param array &$usedEnvs Env vars found while resolving are added to this array
1392+
* @param array|null &$usedEnvs Env vars found while resolving are added to this array
13931393
*
13941394
* @return mixed The value with env parameters resolved if a string or an array is passed
13951395
*/

src/Symfony/Component/DependencyInjection/EnvVarProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
2525
private $loadedVars = [];
2626

2727
/**
28-
* @param EnvVarLoaderInterface[] $loaders
28+
* @param EnvVarLoaderInterface[]|null $loaders
2929
*/
3030
public function __construct(ContainerInterface $container, ?\Traversable $loaders = null)
3131
{

src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ public function testAddObjectResource()
952952

953953
$this->assertCount(1, $resources);
954954

955-
/* @var $resource \Symfony\Component\Config\Resource\FileResource */
955+
/* @var \Symfony\Component\Config\Resource\FileResource $resource */
956956
$resource = end($resources);
957957

958958
$this->assertInstanceOf(FileResource::class, $resource);

src/Symfony/Component/ErrorHandler/ErrorHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public function setLoggers(array $loggers): array
286286
/**
287287
* Sets a user exception handler.
288288
*
289-
* @param callable(\Throwable $e)|null $handler
289+
* @param callable(\Throwable $e): void|null $handler
290290
*
291291
* @return callable|null The previous exception handler
292292
*/

src/Symfony/Component/ErrorHandler/ErrorRenderer/HtmlErrorRenderer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,9 @@ private function getFileLink(string $file, int $line)
231231
/**
232232
* Formats a file path.
233233
*
234-
* @param string $file An absolute file path
235-
* @param int $line The line number
236-
* @param string $text Use this text for the link rather than the file path
234+
* @param string $file An absolute file path
235+
* @param int $line The line number
236+
* @param string|null $text Use this text for the link rather than the file path
237237
*/
238238
private function formatFile(string $file, int $line, ?string $text = null): string
239239
{

src/Symfony/Component/ErrorHandler/ErrorRenderer/SerializerErrorRenderer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ class SerializerErrorRenderer implements ErrorRendererInterface
3030
private $debug;
3131

3232
/**
33-
* @param string|callable(FlattenException) $format The format as a string or a callable that should return it
34-
* formats not supported by Request::getMimeTypes() should be given as mime types
35-
* @param bool|callable $debug The debugging mode as a boolean or a callable that should return it
33+
* @param string|callable(FlattenException): string $format The format as a string or a callable that should return it
34+
* formats not supported by Request::getMimeTypes() should be given as mime types
35+
* @param bool|callable $debug The debugging mode as a boolean or a callable that should return it
3636
*/
3737
public function __construct(SerializerInterface $serializer, $format, ?ErrorRendererInterface $fallbackErrorRenderer = null, $debug = false)
3838
{

src/Symfony/Component/ErrorHandler/Tests/Fixtures/ReturnTypeParent.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,6 @@ public function returnTypeGrandParent()
1818
{
1919
}
2020

21-
/**
22-
* @return string
23-
*/
2421
abstract public function realReturnTypeMustBeThere(): string;
2522

2623
/**

src/Symfony/Component/ErrorHandler/ThrowableUtils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
class ThrowableUtils
2020
{
2121
/**
22-
* @param SilencedErrorContext|\Throwable
22+
* @param SilencedErrorContext|\Throwable $throwable
2323
*/
2424
public static function getSeverity($throwable): int
2525
{

src/Symfony/Component/Form/ChoiceList/Factory/ChoiceListFactoryInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ interface ChoiceListFactoryInterface
3535
*
3636
* @return ChoiceListInterface
3737
*/
38-
public function createListFromChoices(iterable $choices, ?callable $value = null/* , callable $filter = null */);
38+
public function createListFromChoices(iterable $choices, ?callable $value = null/* , ?callable $filter = null */);
3939

4040
/**
4141
* Creates a choice list that is loaded with the given loader.

src/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public function validate($form, Constraint $formConstraint)
4242
return;
4343
}
4444

45-
/* @var FormInterface $form */
4645
$config = $form->getConfig();
4746

4847
$validator = $this->context->getValidator()->inContext($this->context);

src/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct(ValidatorInterface $validator, bool $legacyErrorMess
4242
// the DIC, where the XML file is loaded automatically. Thus the following
4343
// code must be kept synchronized with validation.xml
4444

45-
/* @var $metadata ClassMetadata */
45+
/* @var ClassMetadata $metadata */
4646
$metadata->addConstraint(new Form());
4747
$metadata->addConstraint(new Traverse(false));
4848

src/Symfony/Component/Form/FormBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ public function count()
178178
*/
179179
public function getFormConfig()
180180
{
181-
/** @var $config self */
181+
/** @var self $config */
182182
$config = parent::getFormConfig();
183183

184184
$config->children = [];

src/Symfony/Component/Form/ResolvedFormType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ public function finishView(FormView $view, FormInterface $form, array $options)
163163
$this->innerType->finishView($view, $form, $options);
164164

165165
foreach ($this->typeExtensions as $extension) {
166-
/* @var FormTypeExtensionInterface $extension */
167166
$extension->finishView($view, $form, $options);
168167
}
169168
}

src/Symfony/Component/Form/Tests/SimpleFormTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,6 @@ public function testInitializeSetsDefaultData()
10521052
$config = $this->getBuilder()->setData('DEFAULT')->getFormConfig();
10531053
$form = new Form($config);
10541054

1055-
/* @var Form $form */
10561055
$form->initialize();
10571056

10581057
$this->assertSame('DEFAULT', $form->getData());

src/Symfony/Component/HttpKernel/Event/KernelEvent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ class KernelEvent extends Event
2727
private $requestType;
2828

2929
/**
30-
* @param int $requestType The request type the kernel is currently processing; one of
31-
* HttpKernelInterface::MAIN_REQUEST or HttpKernelInterface::SUB_REQUEST
30+
* @param int|null $requestType The request type the kernel is currently processing; one of
31+
* HttpKernelInterface::MAIN_REQUEST or HttpKernelInterface::SUB_REQUEST
3232
*/
3333
public function __construct(HttpKernelInterface $kernel, Request $request, ?int $requestType)
3434
{

src/Symfony/Component/Intl/DateFormatter/IntlDateFormatter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,7 @@ public function format($timestamp)
235235
/**
236236
* Not supported. Formats an object.
237237
*
238-
* @param mixed $format
239-
* @param string $locale
238+
* @param mixed $format
240239
*
241240
* @return string The formatted value
242241
*

src/Symfony/Component/Lock/Tests/Store/ExpiringStoreTestTrait.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public function testExpiration()
4444
$key = new Key(uniqid(__METHOD__, true));
4545
$clockDelay = $this->getClockDelay();
4646

47-
/** @var PersistingStoreInterface $store */
4847
$store = $this->getStore();
4948

5049
$store->save($key);
@@ -63,7 +62,6 @@ public function testAbortAfterExpiration()
6362
$this->expectException(LockExpiredException::class);
6463
$key = new Key(uniqid(__METHOD__, true));
6564

66-
/** @var PersistingStoreInterface $store */
6765
$store = $this->getStore();
6866

6967
$store->save($key);
@@ -82,7 +80,6 @@ public function testRefreshLock()
8280

8381
$key = new Key(uniqid(__METHOD__, true));
8482

85-
/** @var PersistingStoreInterface $store */
8683
$store = $this->getStore();
8784

8885
$store->save($key);
@@ -97,7 +94,6 @@ public function testSetExpiration()
9794
{
9895
$key = new Key(uniqid(__METHOD__, true));
9996

100-
/** @var PersistingStoreInterface $store */
10197
$store = $this->getStore();
10298

10399
$store->save($key);
@@ -113,7 +109,6 @@ public function testExpiredLockCleaned()
113109
$key1 = new Key($resource);
114110
$key2 = new Key($resource);
115111

116-
/** @var PersistingStoreInterface $store */
117112
$store = $this->getStore();
118113
$key1->reduceLifetime(0);
119114

0 commit comments

Comments
 (0)
0