Skip to content
Open
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
12 changes: 0 additions & 12 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ parameters:
count: 1
path: src/Collectors/Registry.php

-
rawMessage: Anonymous function has an unused use $container.
identifier: closure.unusedUse
count: 1
path: src/Command/CommandHelper.php

-
rawMessage: 'Call to static method expand() of internal class Nette\DI\Helpers from outside its root namespace Nette.'
identifier: staticMethod.internalClass
Expand Down Expand Up @@ -759,12 +753,6 @@ parameters:
count: 1
path: src/Testing/LevelsTestCase.php

-
rawMessage: Anonymous function has an unused use $container.
identifier: closure.unusedUse
count: 1
path: src/Testing/PHPStanTestCase.php

-
rawMessage: 'Doing instanceof PHPStan\Type\ConstantScalarType is error-prone and deprecated. Use Type::isConstantScalarValue() or Type::getConstantScalarTypes() or Type::getConstantScalarValues() instead.'
identifier: phpstanApi.instanceofType
Expand Down
3 changes: 3 additions & 0 deletions src/Rules/UnusedFunctionParametersCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ private function getUsedVariables(Scope $scope, $node): array
return $scope->getDefinedVariables();
}
}
if ($node instanceof Node\Expr\Include_) {
return $scope->getDefinedVariables();
}
if ($node instanceof Variable && is_string($node->name) && $node->name !== 'this') {
return [$node->name];
}
Expand Down
5 changes: 5 additions & 0 deletions tests/PHPStan/Rules/Functions/UnusedClosureUsesRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,9 @@ public function testUnusedClosureUses(): void
]);
}

public function testBug13960(): void
{
$this->analyse([__DIR__ . '/data/bug-13960.php'], []);
}

}
21 changes: 21 additions & 0 deletions tests/PHPStan/Rules/Functions/data/bug-13960.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php declare(strict_types = 1);

namespace Bug13960;

$aap = 684;

$a = function() use ($aap) {
require __DIR__ . '/echo_the_value_of_aap.php';
};

$b = function() use ($aap) {
include __DIR__ . '/echo_the_value_of_aap.php';
};

$c = function() use ($aap) {
require_once __DIR__ . '/echo_the_value_of_aap.php';
};

$d = function() use ($aap) {
include_once __DIR__ . '/echo_the_value_of_aap.php';
};
Loading