Skip to content
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
4 changes: 2 additions & 2 deletions src/Analyser/NodeScopeResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -1910,7 +1910,7 @@ private function processStmtNode(
continue;
}

foreach ($catchTypes as $catchTypeIndex => $catchTypeItem) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused variable $catchTypeIndex

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Slevomat CS typically catches this, can you figure out why it doesn't in this case, maybe create a failign test for slevomat/coding-standard?

foreach ($catchTypes as $catchTypeItem) {
if ($catchTypeItem->isSuperTypeOf($throwPoint->getType())->no()) {
continue;
}
Expand Down Expand Up @@ -6393,7 +6393,7 @@ private function processAssignVar(
$throwPoints = array_merge($throwPoints, $keyResult->getThrowPoints());
$impurePoints = array_merge($impurePoints, $keyResult->getImpurePoints());
$isAlwaysTerminating = $isAlwaysTerminating || $keyResult->isAlwaysTerminating();
$itemScope = $keyResult->getScope();
// no need for $keyResult->getScope()
}

if ($arrayItem->key === null) {
Expand Down
4 changes: 2 additions & 2 deletions src/PhpDoc/StubValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function validate(array $stubFiles, bool $debug): array
]);

$ruleRegistry = $this->getRuleRegistry($container);
$collectorRegistry = $this->getCollectorRegistry($container);
$collectorRegistry = $this->getCollectorRegistry();

$fileAnalyser = $container->getByType(FileAnalyser::class);

Expand Down Expand Up @@ -293,7 +293,7 @@ private function getRuleRegistry(Container $container): RuleRegistry
return new DirectRuleRegistry($rules);
}

private function getCollectorRegistry(Container $container): CollectorRegistry
private function getCollectorRegistry(): CollectorRegistry
{
return new CollectorRegistry([]);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Rules/PhpDoc/WrongVariableNameInVarTagRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function processNode(Node $node, Scope $scope): array
}

if ($node instanceof Node\Stmt\Global_) {
return $this->processGlobal($scope, $node, $varTags);
return $this->processGlobal($node, $varTags);
}

if ($node instanceof InClassNode || $node instanceof InClassMethodNode || $node instanceof InFunctionNode) {
Expand Down Expand Up @@ -372,7 +372,7 @@ private function processStmt(Scope $scope, array $varTags, ?Expr $defaultExpr):
* @param VarTag[] $varTags
* @return list<IdentifierRuleError>
*/
private function processGlobal(Scope $scope, Node\Stmt\Global_ $node, array $varTags): array
private function processGlobal(Node\Stmt\Global_ $node, array $varTags): array
{
$variableNames = [];
foreach ($node->vars as $var) {
Expand Down
3 changes: 2 additions & 1 deletion src/Type/Php/StatDynamicReturnTypeExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use PHPStan\Type\Type;
use PHPStan\Type\TypeCombinator;
use SplFileObject;
use function count;
use function in_array;

#[AutowiredService]
Expand Down Expand Up @@ -68,7 +69,7 @@ private function getReturnType(): Type
'blocks',
];

foreach ($keys as $key) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused variable $key

for ($i = 0; $i < count($keys); $i++) {
$builder->setOffsetValueType(null, $valueType);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/PHPStan/Rules/Methods/data/uppercase-string.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public function test(
$this->acceptUppercaseString($string);
$this->acceptUppercaseString($uppercaseString);
$this->acceptUppercaseString($numericString);
$this->acceptUppercaseString($nonEmptyLowercaseString);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

undefined variable

$this->acceptUppercaseString($nonEmptyUppercaseString);
}
}
Loading