bump to phpstan 0.12.33

This commit is contained in:
TomasVotruba 2020-07-26 11:00:23 +02:00
parent 3acacc0c00
commit 5106475aae
4 changed files with 15 additions and 7 deletions

View File

@ -18,7 +18,7 @@
"jean85/pretty-package-versions": "^1.2",
"nette/robot-loader": "^3.2",
"nette/utils": "^3.1",
"nikic/php-parser": "4.5",
"nikic/php-parser": "^4.7",
"ondram/ci-detector": "^3.4",
"phpstan/phpdoc-parser": "^0.4.7",
"phpstan/phpstan-phpunit": "^0.12.10",
@ -37,7 +37,7 @@
"symplify/set-config-resolver": "^8.1.15",
"symplify/smart-file-system": "^8.1.15",
"tracy/tracy": "^2.7",
"phpstan/phpstan": "0.12.32"
"phpstan/phpstan": "^0.12.33"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace Rector\NodeTypeResolver\PHPStan\Scope;
use Nette\Utils\Strings;
use PhpParser\Node;
use PhpParser\Node\Stmt\Class_;
use PhpParser\Node\Stmt\ClassLike;
@ -177,14 +178,20 @@ final class PHPStanNodeScopeResolver
}
/**
* @param Class_|Interface_ $classOrInterfaceNode
* @param Class_|Interface_ $classLike
*/
private function resolveClassOrInterfaceScope(
Node $classOrInterfaceNode,
ClassLike $classLike,
MutatingScope $mutatingScope
): MutatingScope {
$className = $this->resolveClassName($classOrInterfaceNode);
$classReflection = $this->reflectionProvider->getClass($className);
$className = $this->resolveClassName($classLike);
// is anonymous class? - not possible to enter it since PHPStan 0.12.33, see https://github.com/phpstan/phpstan-src/commit/e87fb0ec26f9c8552bbeef26a868b1e5d8185e91
if ($classLike instanceof Class_ && Strings::match($className, '#^AnonymousClass(\w+)#')) {
$classReflection = $this->reflectionProvider->getAnonymousClassReflection($classLike, $mutatingScope);
} else {
$classReflection = $this->reflectionProvider->getClass($className);
}
return $mutatingScope->enterClass($classReflection);
}

View File

@ -386,3 +386,4 @@ parameters:
- '#Method Rector\\Nette\\NodeResolver\\FormVariableInputNameTypeResolver\:\:resolveFromGetComponentMethodCall\(\) should return array<string, string\> but returns array<int\|string, string\>#'
- '#Method Rector\\Core\\PhpParser\\Node\\BetterNodeFinder\:\:findPreviousAssignToExpr\(\) should return PhpParser\\Node\\Expr\\Assign\|null but returns PhpParser\\Node\|null#'
- '#Method Rector\\Nette\\FormControlTypeResolver\\GetComponentMethodCallFormControlTypeResolver\:\:resolve\(\) should return array<string, string\> but returns array<int\|string, string\>#'
- '#Class with base "LexerFactory" name is already used in "PHPStan\\Parser\\LexerFactory", "Rector\\Core\\PhpParser\\Parser\\LexerFactory"\. Use unique name to make classes easy to recognize#'

View File

@ -93,7 +93,7 @@ PHP
}
if ($this->isAnonymousClass($classLike)) {
//currently the classMethodManipulator isn't able to find usages of anonymous classes
// currently the classMethodManipulator isn't able to find usages of anonymous classes
return null;
}