mirror of https://github.com/rectorphp/rector.git
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:
parent
6f3eaff305
commit
712174b300
|
@ -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
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
],
|
||||
"require": {
|
||||
"php": "^7.2|^8.0",
|
||||
"phpstan/phpstan": "^1.7.10"
|
||||
"phpstan/phpstan": "^1.7.12"
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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])) {
|
||||
|
|
Loading…
Reference in New Issue