Skip to content

Commit b0da65a

Browse files
AJenboondrejmirtes
authored andcommitted
1 parent 091c5a7 commit b0da65a

20 files changed

Lines changed: 51 additions & 7 deletions

‎src/Analyser/ArgumentsHandler.php‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,9 @@ public function processArgs(
194194

195195
$processingOrder = array_keys($args);
196196
usort($processingOrder, static function (int $a, int $b) use ($args): int {
197+
/** @var Node\Arg|null $aOriginalArg */
197198
$aOriginalArg = $args[$a]->getAttribute(ArgumentsNormalizer::ORIGINAL_ARG_ATTRIBUTE);
199+
/** @var Node\Arg|null $bOriginalArg */
198200
$bOriginalArg = $args[$b]->getAttribute(ArgumentsNormalizer::ORIGINAL_ARG_ATTRIBUTE);
199201
$aValue = $aOriginalArg !== null ? $aOriginalArg->value : $args[$a]->value;
200202
$bValue = $bOriginalArg !== null ? $bOriginalArg->value : $args[$b]->value;
@@ -206,19 +208,17 @@ public function processArgs(
206208
return $aIsClosure ? 1 : -1;
207209
}
208210

209-
$aOriginal = $args[$a]->getAttribute(ArgumentsNormalizer::ORIGINAL_ARG_ATTRIBUTE);
210-
$bOriginal = $args[$b]->getAttribute(ArgumentsNormalizer::ORIGINAL_ARG_ATTRIBUTE);
211-
if ($aOriginal === null && $bOriginal === null) {
211+
if ($aOriginalArg === null && $bOriginalArg === null) {
212212
return $a <=> $b;
213213
}
214-
if ($aOriginal === null) {
214+
if ($aOriginalArg === null) {
215215
return 1;
216216
}
217-
if ($bOriginal === null) {
217+
if ($bOriginalArg === null) {
218218
return -1;
219219
}
220220

221-
return $aOriginal->getStartTokenPos() <=> $bOriginal->getStartTokenPos();
221+
return $aOriginalArg->getStartTokenPos() <=> $bOriginalArg->getStartTokenPos();
222222
});
223223

224224
$argResults = [];

‎src/Analyser/ExprHandler/Helper/ContextualClosureParameterResolver.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ public function resolve(
7171
?Type $nativePassedToType,
7272
): ClosureParameterTypes
7373
{
74+
/** @var Node\Arg[]|null $arrayMapArgs */
7475
$arrayMapArgs = $expr->getAttribute(ArrayMapArgVisitor::ATTRIBUTE_NAME);
76+
/** @var Node\Arg[]|null $immediatelyInvokedArgs */
7577
$immediatelyInvokedArgs = $expr->getAttribute(ImmediatelyInvokedClosureVisitor::ARGS_ATTRIBUTE_NAME);
7678
$intrinsicArgs = $arrayMapArgs ?? $immediatelyInvokedArgs;
7779
if ($intrinsicArgs === null) {

‎src/Analyser/ResultCache/ResultCacheManager.php‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1251,6 +1251,20 @@ public function process(AnalyserResult $analyserResult, ResultCache $resultCache
12511251
$projectConfigArray = $this->getPathTransformer()->relativizeProjectConfig($projectConfigArray);
12521252
$meta['projectConfig'] = Neon::encode($projectConfigArray);
12531253
}
1254+
/**
1255+
* @param array<string, list<Error>> $errorsByFile
1256+
* @param array<string, list<Error>> $locallyIgnoredErrorsByFile
1257+
* @param array<string, LinesToIgnore> $linesToIgnore
1258+
* @param array<string, LinesToIgnore> $unmatchedLineIgnores
1259+
* @param CollectorData $collectedDataByFile
1260+
* @param array<string, array<string>>|null $dependencies
1261+
* @param array<string, array<string>>|null $usedTraitDependencies
1262+
* @param ValueDependencies|null $valueDependencies
1263+
* @param array<string, array<string>>|null $packageDependencies
1264+
* @param array<string, array<RootExportedNode>> $exportedNodes
1265+
* @param array<string, array{string, bool, string}> $projectExtensionFiles
1266+
* @param array<string, CollectedDataRuleResult> $collectedDataRuleResults
1267+
*/
12541268
$doSave = function (array $errorsByFile, $locallyIgnoredErrorsByFile, $linesToIgnore, $unmatchedLineIgnores, $collectedDataByFile, ?array $dependencies, ?array $usedTraitDependencies, ?array $valueDependencies, ?array $packageDependencies, array $exportedNodes, CachedExportedNodes $cachedExportedNodes, array $projectExtensionFiles, array $collectedDataRuleResults) use ($internalErrors, $resultCache, $output, $onlyFiles, $meta): bool {
12551269
if ($onlyFiles) {
12561270
if ($output->isVeryVerbose()) {

‎src/Analyser/ScopeOps.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ public static function nodeKey(Expr $node, ExprPrinter $exprPrinter): string
7575
&& (($attributes['startFilePos'] ?? null) !== null)
7676
) {
7777
$key .= '/*' . $attributes['startFilePos'];
78-
foreach ($attributes[ArrayMapArgVisitor::ATTRIBUTE_NAME] as $arg) {
78+
/** @var Node\Arg[] $arrayMapArgs */
79+
$arrayMapArgs = $attributes[ArrayMapArgVisitor::ATTRIBUTE_NAME];
80+
foreach ($arrayMapArgs as $arg) {
7981
$key .= ':' . $exprPrinter->printExpr($arg->value);
8082
}
8183
$key .= '*/';

‎src/Command/CommandHelper.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
use PHPStan\Internal\ComposerHelper;
3131
use PHPStan\Internal\DirectoryCreator;
3232
use PHPStan\Internal\DirectoryCreatorException;
33+
use PHPStan\Parser\PathRoutingParser;
3334
use PHPStan\Process\ForkedChildCrashReporter;
3435
use PHPStan\Process\Restart\RestartExtensionRegistry;
3536
use PHPStan\Process\Restart\RestartManager;
@@ -593,6 +594,7 @@ public static function begin(
593594
/** @var FileFinder $fileFinder */
594595
$fileFinder = $container->getService('fileFinderAnalyse');
595596

597+
/** @var PathRoutingParser $pathRoutingParser */
596598
$pathRoutingParser = $container->getService('pathRoutingParser');
597599

598600
/** @var string[] $configStubFiles */

‎src/Command/WorkerCommand.php‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use PHPStan\Cache\ArenaCache;
77
use PHPStan\File\PathNotFoundException;
88
use PHPStan\Parallel\WorkerRunner;
9+
use PHPStan\Parser\PathRoutingParser;
910
use PHPStan\ShouldNotHappenException;
1011
use Symfony\Component\Console\Command\Command;
1112
use Symfony\Component\Console\Input\InputArgument;
@@ -127,6 +128,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
127128
// routing is unused either way.)
128129
$analysedFiles = ArenaCache::lookup('analysed-files');
129130
if (is_array($analysedFiles)) {
131+
/** @var PathRoutingParser $pathRoutingParser */
130132
$pathRoutingParser = $container->getService('pathRoutingParser');
131133
$pathRoutingParser->setAnalysedFiles($analysedFiles);
132134
} else {

‎src/Dependency/ExportedNode.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public static function __set_state(array $properties): self;
1414

1515
/**
1616
* @param mixed[] $data
17+
* @return static
1718
*/
1819
public static function decode(array $data, ExportedNodeDecoder $decoder): self;
1920

‎src/Dependency/ExportedNode/ExportedClassNode.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ public static function decode(array $data, ExportedNodeDecoder $decoder): self
159159
return ExportedTraitUseAdaptation::decode($traitUseAdaptationData['data'], $decoder);
160160
}, $data['traitUseAdaptations']),
161161
array_map(static function (array $node) use ($decoder): ExportedNode {
162+
/** @var class-string<ExportedNode> $nodeType */
162163
$nodeType = $node['type'];
163164

164165
return $nodeType::decode($node['data'], $decoder);

‎src/Dependency/ExportedNode/ExportedEnumNode.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ public static function decode(array $data, ExportedNodeDecoder $decoder): self
122122
$data['phpDoc'] !== null ? ExportedPhpDocNode::decode($data['phpDoc']['data'], $decoder) : null,
123123
$data['implements'],
124124
array_map(static function (array $node) use ($decoder): ExportedNode {
125+
/** @var class-string<ExportedNode> $nodeType */
125126
$nodeType = $node['type'];
126127

127128
return $nodeType::decode($node['data'], $decoder);

‎src/Dependency/ExportedNode/ExportedInterfaceNode.php‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public static function decode(array $data, ExportedNodeDecoder $decoder): self
9797
$data['phpDoc'] !== null ? ExportedPhpDocNode::decode($data['phpDoc']['data'], $decoder) : null,
9898
$data['extends'],
9999
array_map(static function (array $node) use ($decoder): ExportedNode {
100+
/** @var class-string<ExportedNode> $nodeType */
100101
$nodeType = $node['type'];
101102

102103
return $nodeType::decode($node['data'], $decoder);

0 commit comments

Comments
 (0)