Update packages-tests github action to use latest phpdoc-parser (#2467)

* Update packages-tests github action to use latest phpdoc-parser

* fix compat

* [ci-review] Rector Rectify

* update to use ExtendedMethodReflection

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Abdul Malik Ikhsan 2022-06-09 20:26:15 +07:00 committed by GitHub
parent 6f3eaff305
commit 712174b300
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 13 deletions

View File

@ -47,9 +47,7 @@ jobs:
# test with current commit in a pull-request
-
run: |
composer require phpstan/phpdoc-parser:1.5.* --no-update
composer require rector/rector-src dev-main#${{github.event.pull_request.head.sha}} --no-update
run: composer require rector/rector-src dev-main#${{github.event.pull_request.head.sha}} --no-update
if: ${{ github.event_name == 'pull_request' }}
- run: composer install --ansi

View File

@ -7,7 +7,7 @@
],
"require": {
"php": "^7.2|^8.0",
"phpstan/phpstan": "^1.7.10"
"phpstan/phpstan": "^1.7.12"
},
"autoload": {
"files": [

View File

@ -120,8 +120,8 @@ CODE_SAMPLE
return new MethodCall(new Variable('this'), $arrayCallable->getMethod());
}
$methodReflection = $classReflection->getNativeMethod($arrayCallable->getMethod());
return $this->nodeFactory->createClosureFromMethodReflection($methodReflection);
$extendedMethodReflection = $classReflection->getNativeMethod($arrayCallable->getMethod());
return $this->nodeFactory->createClosureFromMethodReflection($extendedMethodReflection);
}
private function isAssignedToNetteMagicOnProperty(Array_ $array): bool

View File

@ -11,7 +11,7 @@ use PhpParser\Node\Stmt\ClassMethod;
use PhpParser\Node\VariadicPlaceholder;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\ClassReflection;
use PHPStan\Reflection\MethodReflection;
use PHPStan\Reflection\ExtendedMethodReflection;
use PHPStan\Reflection\ParametersAcceptorSelector;
use Rector\Core\Enum\ObjectReference;
use Rector\Core\Exception\ShouldNotHappenException;
@ -138,26 +138,26 @@ final class CurrentAndParentClassMethodComparator
throw new ShouldNotHappenException();
}
$parentMethodReflection = $classReflection->getMethod($methodName, $scope);
$extendedMethodReflection = $classReflection->getMethod($methodName, $scope);
// 3rd party code
if (! $parentMethodReflection->isPrivate() && ! $parentMethodReflection->isPublic() && $classMethod->isPublic()) {
if (! $extendedMethodReflection->isPrivate() && ! $extendedMethodReflection->isPublic() && $classMethod->isPublic()) {
return true;
}
if ($parentMethodReflection->isInternal()->yes()) {
if ($extendedMethodReflection->isInternal()->yes()) {
// we can't know for certain so we assume its a override with purpose
return true;
}
return $this->areParameterDefaultsDifferent($classMethod, $parentMethodReflection);
return $this->areParameterDefaultsDifferent($classMethod, $extendedMethodReflection);
}
private function areParameterDefaultsDifferent(
ClassMethod $classMethod,
MethodReflection $methodReflection
ExtendedMethodReflection $extendedMethodReflection
): bool {
$parametersAcceptor = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants());
$parametersAcceptor = ParametersAcceptorSelector::selectSingle($extendedMethodReflection->getVariants());
foreach ($parametersAcceptor->getParameters() as $key => $parameterReflection) {
if (! isset($classMethod->params[$key])) {