Skip to content

Commit dfa4831

Browse files
minor symfony#61329 Remove some unneeded var annotations (nicolas-grekas)
This PR was merged into the 7.4 branch. Discussion ---------- Remove some unneeded var annotations | Q | A | ------------- | --- | Branch? | 7.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT Commits ------- ecdb536 Remove some unneeded var annotations
2 parents 9c835fc + ecdb536 commit dfa4831

File tree

13 files changed

+8
-24
lines changed

13 files changed

+8
-24
lines changed

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use Symfony\Component\Filesystem\Exception\IOException;
2424
use Symfony\Component\Filesystem\Filesystem;
2525
use Symfony\Component\Finder\Finder;
26-
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
2726
use Symfony\Component\HttpKernel\KernelInterface;
2827

2928
/**
@@ -119,7 +118,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
119118
$copyUsed = false;
120119
$exitCode = 0;
121120
$validAssetDirs = [];
122-
/** @var BundleInterface $bundle */
123121
foreach ($kernel->getBundles() as $bundle) {
124122
if (!is_dir($originDir = $bundle->getPath().'/Resources/public') && !is_dir($originDir = $bundle->getPath().'/public')) {
125123
continue;

src/Symfony/Component/AssetMapper/ImportMap/Resolver/JsDelivrEsmResolver.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Symfony\Component\HttpClient\HttpClient;
2121
use Symfony\Contracts\HttpClient\Exception\HttpExceptionInterface;
2222
use Symfony\Contracts\HttpClient\HttpClientInterface;
23+
use Symfony\Contracts\HttpClient\ResponseInterface;
2324

2425
final class JsDelivrEsmResolver implements PackageResolverInterface
2526
{
@@ -165,6 +166,7 @@ public function resolvePackages(array $packagesToRequire): array
165166
*/
166167
public function downloadPackages(array $importMapEntries, ?callable $progressCallback = null): array
167168
{
169+
/** @var array<string, array{0: ResponseInterface, 1: ImportMapEntry}> $responses */
168170
$responses = [];
169171
foreach ($importMapEntries as $package => $entry) {
170172
if (!$entry->isRemotePackage()) {
@@ -184,7 +186,6 @@ public function downloadPackages(array $importMapEntries, ?callable $progressCal
184186
$errors = [];
185187
$contents = [];
186188
$extraFileResponses = [];
187-
/** @var ImportMapEntry $entry */
188189
foreach ($responses as $package => [$response, $entry]) {
189190
if (200 !== $response->getStatusCode()) {
190191
$errors[] = [$package, $response];

src/Symfony/Component/Console/Descriptor/ApplicationDescription.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ private function inspectApplication(): void
8585
foreach ($this->sortCommands($all) as $namespace => $commands) {
8686
$names = [];
8787

88-
/** @var Command $command */
8988
foreach ($commands as $name => $command) {
9089
if (!$command->getName() || (!$this->showHidden && $command->isHidden())) {
9190
continue;
@@ -104,6 +103,9 @@ private function inspectApplication(): void
104103
}
105104
}
106105

106+
/**
107+
* @return array<string, array<string, Command>>
108+
*/
107109
private function sortCommands(array $commands): array
108110
{
109111
$namespacedCommands = [];

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

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

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

src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
100100
if ($options['expanded'] || $options['multiple']) {
101101
// Make sure that scalar, submitted values are converted to arrays
102102
// which can be submitted to the checkboxes/radio buttons
103-
$builder->addEventListener(FormEvents::PRE_SUBMIT, static function (FormEvent $event) use ($choiceList, $options, &$unknownValues) {
104-
/** @var PreSubmitEvent $event */
103+
$builder->addEventListener(FormEvents::PRE_SUBMIT, static function (PreSubmitEvent $event) use ($choiceList, $options, &$unknownValues) {
105104
$form = $event->getForm();
106105
$data = $event->getData();
107106

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
use Symfony\Component\Form\FormRendererInterface;
1818
use Symfony\Component\Form\Util\InheritDataAwareIterator;
1919
use Symfony\Component\PropertyAccess\PropertyPathBuilder;
20-
use Symfony\Component\PropertyAccess\PropertyPathInterface;
2120
use Symfony\Component\PropertyAccess\PropertyPathIterator;
2221
use Symfony\Component\PropertyAccess\PropertyPathIteratorInterface;
2322
use Symfony\Component\Validator\Constraints\File;
@@ -229,6 +228,7 @@ private function matchChild(FormInterface $form, PropertyPathIteratorInterface $
229228
$foundAtIndex = null;
230229

231230
// Construct mapping rules for the given form
231+
/** @var MappingRule[] $rules */
232232
$rules = [];
233233

234234
foreach ($form->getConfig()->getOption('error_mapping') as $propertyPath => $targetPath) {
@@ -238,6 +238,7 @@ private function matchChild(FormInterface $form, PropertyPathIteratorInterface $
238238
}
239239
}
240240

241+
/** @var FormInterface[] $children */
241242
$children = iterator_to_array(new \RecursiveIteratorIterator(new InheritDataAwareIterator($form)), false);
242243

243244
while ($it->valid()) {
@@ -249,8 +250,6 @@ private function matchChild(FormInterface $form, PropertyPathIteratorInterface $
249250

250251
// Test mapping rules as long as we have any
251252
foreach ($rules as $key => $rule) {
252-
/** @var MappingRule $rule */
253-
254253
// Mapping rule matches completely, terminate.
255254
if (null !== ($form = $rule->match($chunk))) {
256255
return $form;
@@ -262,7 +261,6 @@ private function matchChild(FormInterface $form, PropertyPathIteratorInterface $
262261
}
263262
}
264263

265-
/** @var FormInterface $child */
266264
foreach ($children as $i => $child) {
267265
$childPath = (string) $child->getPropertyPath();
268266
if ($childPath === $chunk) {
@@ -313,7 +311,6 @@ private function reconstructPath(ViolationPath $violationPath, FormInterface $or
313311
// Cut the piece out of the property path and proceed
314312
$propertyPathBuilder->remove($i);
315313
} else {
316-
/** @var PropertyPathInterface $propertyPath */
317314
$propertyPath = $scope->getPropertyPath();
318315

319316
if (null === $propertyPath) {

src/Symfony/Component/Form/ResolvedFormType.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ public function finishView(FormView $view, FormInterface $form, array $options):
117117

118118
$this->innerType->finishView($view, $form, $options);
119119

120-
/** @var FormTypeExtensionInterface $extension */
121120
foreach ($this->typeExtensions as $extension) {
122121
$extension->finishView($view, $form, $options);
123122
}

src/Symfony/Component/Messenger/Middleware/HandleMessageMiddleware.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ public function handle(Envelope $envelope, StackInterface $stack): Envelope
6262
$handler = $handlerDescriptor->getHandler();
6363
$batchHandler = $handlerDescriptor->getBatchHandler();
6464

65-
/** @var AckStamp $ackStamp */
6665
if ($batchHandler && $ackStamp = $envelope->last(AckStamp::class)) {
6766
$ack = new Acknowledger(get_debug_type($batchHandler), static function (?\Throwable $e = null, $result = null) use ($envelope, $ackStamp, $handlerDescriptor) {
6867
if (null !== $e) {
@@ -99,9 +98,7 @@ public function handle(Envelope $envelope, StackInterface $stack): Envelope
9998
}
10099
}
101100

102-
/** @var FlushBatchHandlersStamp $flushStamp */
103101
if ($flushStamp = $envelope->last(FlushBatchHandlersStamp::class)) {
104-
/** @var NoAutoAckStamp $stamp */
105102
foreach ($envelope->all(NoAutoAckStamp::class) as $stamp) {
106103
try {
107104
$handler = $stamp->getHandlerDescriptor()->getBatchHandler();
@@ -129,7 +126,6 @@ public function handle(Envelope $envelope, StackInterface $stack): Envelope
129126

130127
private function messageHasAlreadyBeenHandled(Envelope $envelope, HandlerDescriptor $handlerDescriptor): bool
131128
{
132-
/** @var HandledStamp $stamp */
133129
foreach ($envelope->all(HandledStamp::class) as $stamp) {
134130
if ($stamp->getHandlerName() === $handlerDescriptor->getName()) {
135131
return true;

src/Symfony/Component/PropertyInfo/Extractor/PhpDocExtractor.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ public function __construct(?DocBlockFactoryInterface $docBlockFactory = null, ?
8080

8181
public function getShortDescription(string $class, string $property, array $context = []): ?string
8282
{
83-
/** @var DocBlock $docBlock */
8483
[$docBlock] = $this->findDocBlock($class, $property);
8584
if (!$docBlock) {
8685
return null;
@@ -107,7 +106,6 @@ public function getShortDescription(string $class, string $property, array $cont
107106

108107
public function getLongDescription(string $class, string $property, array $context = []): ?string
109108
{
110-
/** @var DocBlock $docBlock */
111109
[$docBlock] = $this->findDocBlock($class, $property);
112110
if (!$docBlock) {
113111
return null;
@@ -125,7 +123,6 @@ public function getTypes(string $class, string $property, array $context = []):
125123
{
126124
trigger_deprecation('symfony/property-info', '7.3', 'The "%s()" method is deprecated, use "%s::getType()" instead.', __METHOD__, self::class);
127125

128-
/** @var DocBlock $docBlock */
129126
[$docBlock, $source, $prefix] = $this->findDocBlock($class, $property);
130127
if (!$docBlock) {
131128
return null;

src/Symfony/Component/Translation/Extractor/PhpAstExtractor.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ public function extract(iterable|string $resource, MessageCatalogue $catalogue):
5151
$nameResolver = new NodeVisitor\NameResolver();
5252
$traverser->addVisitor($nameResolver);
5353

54-
/** @var AbstractVisitor&NodeVisitor $visitor */
5554
foreach ($this->visitors as $visitor) {
5655
$visitor->initialize($catalogue, $file, $this->prefix);
5756
$traverser->addVisitor($visitor);

0 commit comments

Comments
 (0)