Skip to content

Fix @var phpdoc #61106

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
'@PHPUnit75Migration:risky' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'phpdoc_var_annotation_correct_order' => true,
'protected_to_private' => false,
'no_superfluous_phpdoc_tags' => [
'remove_inheritdoc' => true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testInstantiateProxy()
$definition = new Definition('stdClass');
$instantiator = fn () => $instance;

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

$this->assertInstanceOf(LazyLoadingInterface::class, $proxy);
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bridge/Twig/Extension/FormExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private function createFieldChoicesList(iterable $choices, string|false|null $tr
continue;
}

/* @var ChoiceView $choice */
/** @var ChoiceView $choice */
$translatableLabel = $this->createFieldTranslation($choice->label, $choice->labelTranslationParameters, $translationDomain);
yield $translatableLabel => $choice->value;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public function testFile()
$controller = $this->createController();
$controller->setContainer($container);

/* @var BinaryFileResponse $response */
/** @var BinaryFileResponse $response */
$response = $controller->file(new File(__FILE__));
$this->assertInstanceOf(BinaryFileResponse::class, $response);
$this->assertSame(200, $response->getStatusCode());
Expand All @@ -248,7 +248,7 @@ public function testFileAsInline()
{
$controller = $this->createController();

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

$this->assertInstanceOf(BinaryFileResponse::class, $response);
Expand All @@ -264,7 +264,7 @@ public function testFileWithOwnFileName()
{
$controller = $this->createController();

/* @var BinaryFileResponse $response */
/** @var BinaryFileResponse $response */
$fileName = 'test.php';
$response = $controller->file(new File(__FILE__), $fileName);

Expand All @@ -281,7 +281,7 @@ public function testFileWithOwnFileNameAsInline()
{
$controller = $this->createController();

/* @var BinaryFileResponse $response */
/** @var BinaryFileResponse $response */
$fileName = 'test.php';
$response = $controller->file(new File(__FILE__), $fileName, ResponseHeaderBag::DISPOSITION_INLINE);

Expand All @@ -298,7 +298,7 @@ public function testFileFromPath()
{
$controller = $this->createController();

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

$this->assertInstanceOf(BinaryFileResponse::class, $response);
Expand All @@ -314,7 +314,7 @@ public function testFileFromPathWithCustomizedFileName()
{
$controller = $this->createController();

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

$this->assertInstanceOf(BinaryFileResponse::class, $response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function build(ContainerBuilder $container): void
{
parent::build($container);

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

if (!$container->getParameterBag() instanceof FrozenParameterBag) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function downloadPackages(array $importMapEntries, ?callable $progressCal

$dependencies = [];
$extraFiles = [];
/* @var ImportMapEntry $entry */
/** @var ImportMapEntry $entry */
$contents[$package] = [
'content' => $this->makeImportsBare($response->getContent(), $dependencies, $extraFiles, $entry->type, $entry->getPackagePathString()),
'dependencies' => $dependencies,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public function testUpdateAll()
->method('resolvePackages')
->with($this->callback(function ($packages) {
$this->assertInstanceOf(PackageRequireOptions::class, $packages[0]);
/* @var PackageRequireOptions[] $packages */
/** @var PackageRequireOptions[] $packages */
$this->assertCount(2, $packages);

$this->assertSame('lodash', $packages[0]->packageModuleSpecifier);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function testInlineStyleOptions(string $tag, ?string $expected = null, ?s
$expected = $tag.$input.'</'.$styleString.'>';
$this->assertSame($expected, $formatter->format($expected));
} else {
/* @var OutputFormatterStyle $result */
/** @var OutputFormatterStyle $result */
$this->assertInstanceOf(OutputFormatterStyle::class, $result);
$this->assertSame($expected, $formatter->format($tag.$input.'</>'));
$this->assertSame($expected, $formatter->format($tag.$input.'</'.$styleString.'>'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function validate(mixed $form, Constraint $formConstraint)
return;
}

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

$validator = $this->context->getValidator()->inContext($this->context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,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));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ private function matchChild(FormInterface $form, PropertyPathIteratorInterface $

// Test mapping rules as long as we have any
foreach ($rules as $key => $rule) {
/* @var MappingRule $rule */
/** @var MappingRule $rule */

// Mapping rule matches completely, terminate.
if (null !== ($form = $rule->match($chunk))) {
Expand Down Expand Up @@ -317,7 +317,7 @@ private function reconstructPath(ViolationPath $violationPath, FormInterface $or
// Cut the piece out of the property path and proceed
$propertyPathBuilder->remove($i);
} else {
/* @var \Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath */
/** @var \Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath */
$propertyPath = $scope->getPropertyPath();

if (null === $propertyPath) {
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/FormBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function count(): int

public function getFormConfig(): FormConfigInterface
{
/** @var $config self */
/** @var self $config */
$config = parent::getFormConfig();

$config->children = [];
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/FormErrorIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function __toString(): string
if ($error instanceof FormError) {
$string .= 'ERROR: '.$error->getMessage()."\n";
} else {
/* @var self $error */
/** @var self $error */
$string .= $error->getForm()->getName().":\n";
$string .= self::indent((string) $error);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/ResolvedFormType.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function finishView(FormView $view, FormInterface $form, array $options)
$this->innerType->finishView($view, $form, $options);

foreach ($this->typeExtensions as $extension) {
/* @var FormTypeExtensionInterface $extension */
/** @var FormTypeExtensionInterface $extension */
$extension->finishView($view, $form, $options);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Form/Tests/SimpleFormTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ public function testInitializeSetsDefaultData()
$config = $this->getBuilder()->setData('DEFAULT')->getFormConfig();
$form = new Form($config);

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

$this->assertSame('DEFAULT', $form->getData());
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/HttpClient/Response/AmpResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private static function generateResponse(Request $request, AmpClientState $multi
});

try {
/* @var Response $response */
/** @var Response $response */
if (null === $response = yield from self::getPushedResponse($request, $multi, $info, $headers, $options, $logger)) {
$logger?->info(\sprintf('Request: "%s %s"', $info['http_method'], $info['url']));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ public function testHttp2PushVulcainWithUnusedResponse()

public function testChangeResponseFactory()
{
/* @var MockHttpClient $client */
/** @var MockHttpClient $client */
$client = $this->getHttpClient(__METHOD__);
$expectedBody = '{"foo": "bar"}';
$client->setResponseFactory(new MockResponse($expectedBody));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testMessengerTransportStampViaHeader()
$event = new MessageEvent($message, $envelope, 'smtp', true);
$l->onMessage($event);
$this->assertCount(1, $event->getStamps());
/* @var TransportNamesStamp $stamp */
/** @var TransportNamesStamp $stamp */
$this->assertInstanceOf(TransportNamesStamp::class, $stamp = $event->getStamps()[0]);
$this->assertSame(['async'], $stamp->getTransportNames());
$this->assertFalse($message->getHeaders()->has('X-Bus-Transport'));
Expand All @@ -57,7 +57,7 @@ public function testMessengerTransportStampsViaHeader()
$event = new MessageEvent($message, $envelope, 'smtp', true);
$l->onMessage($event);
$this->assertCount(1, $event->getStamps());
/* @var TransportNamesStamp $stamp */
/** @var TransportNamesStamp $stamp */
$this->assertInstanceOf(TransportNamesStamp::class, $stamp = $event->getStamps()[0]);
$this->assertSame(['async', 'async1', $name], $stamp->getTransportNames());
$this->assertFalse($message->getHeaders()->has('X-Bus-Transport'));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public function testRetryAndDelay()

// this should be the custom routing key message first
$this->assertCount(1, $envelopes);
/* @var Envelope $envelope */
/** @var Envelope $envelope */
$receiver->ack($envelopes[0]);
$this->assertEquals($customRoutingKeyMessage, $envelopes[0]->getMessage());

Expand All @@ -125,7 +125,7 @@ public function testRetryAndDelay()
// duration should be about 2 seconds
$this->assertApproximateDuration($startTime, 2);

/* @var RedeliveryStamp|null $retryStamp */
/** @var RedeliveryStamp|null $retryStamp */
// verify the stamp still exists from the last send
$this->assertCount(1, $envelopes);
$retryStamp = $envelopes[0]->last(RedeliveryStamp::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function handle(Envelope $envelope, StackInterface $stack): Envelope
$currentPathInfo = $context->getPathInfo();
$currentQueryString = $context->getQueryString();

/* @var RouterContextStamp $contextStamp */
/** @var RouterContextStamp $contextStamp */
$context
->setBaseUrl($contextStamp->getBaseUrl())
->setMethod($contextStamp->getMethod())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function testItSendsToTheFailureTransportWithSenderLocator()
$receiverName = 'my_receiver';
$sender = $this->createMock(SenderInterface::class);
$sender->expects($this->once())->method('send')->with($this->callback(function ($envelope) use ($receiverName) {
/* @var Envelope $envelope */
/** @var Envelope $envelope */
$this->assertInstanceOf(Envelope::class, $envelope);

/** @var SentToFailureTransportStamp $sentToFailureTransportStamp */
Expand Down Expand Up @@ -101,7 +101,7 @@ public function testItSendsToTheFailureTransportWithMultipleFailedTransports()
$receiverName = 'my_receiver';
$sender = $this->createMock(SenderInterface::class);
$sender->expects($this->once())->method('send')->with($this->callback(function ($envelope) use ($receiverName) {
/* @var Envelope $envelope */
/** @var Envelope $envelope */
$this->assertInstanceOf(Envelope::class, $envelope);

/** @var SentToFailureTransportStamp $sentToFailureTransportStamp */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function testItSendsTheMessageToAssignedSender()

$envelope = $middleware->handle($envelope, $this->getStackMock(false));

/* @var SentStamp $stamp */
/** @var SentStamp $stamp */
$this->assertInstanceOf(SentStamp::class, $stamp = $envelope->last(SentStamp::class), 'it adds a sent stamp');
$this->assertSame('my_sender', $stamp->getSenderAlias());
$this->assertStringMatchesFormat('Mock_SenderInterface_%s', $stamp->getSenderClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1368,7 +1368,7 @@ public function testNormalizerCanAccessOtherOptions()
$this->resolver->setDefault('norm', 'baz');

$this->resolver->setNormalizer('norm', function (Options $options) {
/* @var TestCase $test */
/** @var TestCase $test */
Assert::assertSame('bar', $options['default']);

return 'normalized';
Expand All @@ -1386,7 +1386,7 @@ public function testNormalizerCanAccessLazyOptions()
$this->resolver->setDefault('norm', 'baz');

$this->resolver->setNormalizer('norm', function (Options $options) {
/* @var TestCase $test */
/** @var TestCase $test */
Assert::assertEquals('bar', $options['lazy']);

return 'normalized';
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/PropertyAccess/PropertyPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function __construct(self|string $propertyPath)
{
// Can be used as copy constructor
if ($propertyPath instanceof self) {
/* @var PropertyPath $propertyPath */
/** @var PropertyPath $propertyPath */
$this->elements = $propertyPath->elements;
$this->length = $propertyPath->length;
$this->isIndex = $propertyPath->isIndex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,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;
Expand All @@ -100,7 +100,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;
Expand All @@ -113,7 +113,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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function read(array $domains, array $locales): TranslatorBag
}
}

/* @var ResponseInterface $response */
/** @var ResponseInterface $response */
$downloads = [];
foreach ($responses as [$response, $locale, $domain]) {
if (204 === $response->getStatusCode()) {
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/Validator/Constraints/Composite.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function __construct(mixed $options = null, ?array $groups = null, mixed

$this->initializeNestedConstraints();

/* @var Constraint[] $nestedConstraints */
/** @var Constraint[] $nestedConstraints */
$compositeOption = $this->getCompositeOption();
$nestedConstraints = $this->$compositeOption;

Expand Down Expand Up @@ -137,7 +137,7 @@ abstract protected function getCompositeOption(): string;
*/
public function getNestedConstraints(): array
{
/* @var Constraint[] $nestedConstraints */
/** @var Constraint[] $nestedConstraints */
return $this->{$this->getCompositeOption()};
}

Expand Down
Loading
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy