mirror of
https://github.com/rectorphp/rector.git
synced 2024-05-30 07:50:53 +00:00
[PHPStan] Update to PHPStan ^1.7.0 (#2354)
* [PHPStan] Update to PHPStan ^1.7.0
* [ci-review] Rector Rectify
* [ci-review] Rector Rectify
* already 1.7.1
* skip pull from PHPStan PhpPropertyReflection
* rename fixture
* debug
* Fixed 🎉
* keep mysqli object use case
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
a14bd26655
commit
dc9189280f
|
@ -7,7 +7,7 @@
|
|||
],
|
||||
"require": {
|
||||
"php": "^7.2|^8.0",
|
||||
"phpstan/phpstan": "1.6.9"
|
||||
"phpstan/phpstan": "^1.7.1"
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
"nikic/php-parser": "^4.13.2",
|
||||
"ondram/ci-detector": "^4.1",
|
||||
"phpstan/phpdoc-parser": "^1.5.1",
|
||||
"phpstan/phpstan": "1.6.9",
|
||||
"phpstan/phpstan": "^1.7.1",
|
||||
"phpstan/phpstan-phpunit": "^1.0",
|
||||
"psr/log": "^2.0",
|
||||
"react/child-process": "^0.6.4",
|
||||
|
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\DowngradePhp80\Rector\MethodCall\DowngradeReflectionPropertyGetDefaultValueRector\Fixture;
|
||||
|
||||
use PHPStan\Reflection\Php\PhpPropertyReflection;
|
||||
|
||||
class PullFromPHPStanReflection
|
||||
{
|
||||
public function get(PhpPropertyReflection $phpPropertyReflection)
|
||||
{
|
||||
$reflectionProperty = $phpPropertyReflection->getNativeReflection();
|
||||
return is_array($reflectionProperty->getDefaultValue());
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
-----
|
||||
<?php
|
||||
|
||||
namespace Rector\Tests\DowngradePhp80\Rector\MethodCall\DowngradeReflectionPropertyGetDefaultValueRector\Fixture;
|
||||
|
||||
use PHPStan\Reflection\Php\PhpPropertyReflection;
|
||||
|
||||
class PullFromPHPStanReflection
|
||||
{
|
||||
public function get(PhpPropertyReflection $phpPropertyReflection)
|
||||
{
|
||||
$reflectionProperty = $phpPropertyReflection->getNativeReflection();
|
||||
return is_array($reflectionProperty->getDeclaringClass()->getDefaultProperties()[$reflectionProperty->getName()] ?? null);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace Rector\Tests\DowngradePhp80\Rector\MethodCall\DowngradeReflectionPropertyGetDefaultValueRector\Fixture;
|
||||
|
||||
use PHPStan\Reflection\Php\PhpPropertyReflection;
|
||||
|
||||
class SkipPullFromPHPStanReflection
|
||||
{
|
||||
public function get(PhpPropertyReflection $phpPropertyReflection)
|
||||
{
|
||||
$reflectionProperty = $phpPropertyReflection->getNativeReflection();
|
||||
return is_array($reflectionProperty->getDefaultValue());
|
||||
}
|
||||
}
|
|
@ -16,10 +16,6 @@ final class SetTest extends AbstractRectorTestCase
|
|||
*/
|
||||
public function test(SmartFileInfo $fileInfo): void
|
||||
{
|
||||
$this->markTestSkipped(
|
||||
'@todo update rules to handle both rename + argumentt adding at the same time; otherwise lost during scope update'
|
||||
);
|
||||
|
||||
$this->doTestFileInfo($fileInfo);
|
||||
}
|
||||
|
||||
|
|
|
@ -193,14 +193,14 @@ CODE_SAMPLE
|
|||
return null;
|
||||
}
|
||||
|
||||
$reflectionClass = $classReflection->getNativeReflection();
|
||||
$nativeReflection = $classReflection->getNativeReflection();
|
||||
|
||||
if (! $reflectionClass->hasMethod($methodName)) {
|
||||
if (! $nativeReflection->hasMethod($methodName)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Find the param we're looking for
|
||||
return $reflectionClass->getMethod($methodName);
|
||||
return $nativeReflection->getMethod($methodName);
|
||||
}
|
||||
|
||||
private function getDifferentParamTypeFromReflectionMethod(
|
||||
|
|
|
@ -185,7 +185,11 @@ CODE_SAMPLE
|
|||
return false;
|
||||
}
|
||||
|
||||
return $this->isObjectType($node->expr, new ObjectType('mysqli'));
|
||||
if ($this->isObjectType($node->expr, new ObjectType('mysqli'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return $node->expr instanceof FuncCall && $this->nodeNameResolver->isName($node->expr, 'mysqli_connect');
|
||||
});
|
||||
|
||||
if (! $connectionAssign instanceof Assign) {
|
||||
|
|
|
@ -179,9 +179,9 @@ CODE_SAMPLE
|
|||
}
|
||||
|
||||
$classReflection = $this->reflectionProvider->getClass($className);
|
||||
$reflectionClass = $classReflection->getNativeReflection();
|
||||
$nativeReflection = $classReflection->getNativeReflection();
|
||||
|
||||
$reflectionMethod = $reflectionClass->getConstructor();
|
||||
$reflectionMethod = $nativeReflection->getConstructor();
|
||||
if (! $reflectionMethod instanceof ReflectionMethod) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -32,9 +32,9 @@ final class ClassConstantsResolver
|
|||
}
|
||||
|
||||
$classReflection = $this->reflectionProvider->getClass($classWithConstants);
|
||||
$reflectionClass = $classReflection->getNativeReflection();
|
||||
$nativeReflection = $classReflection->getNativeReflection();
|
||||
|
||||
$constantNamesToValues = $reflectionClass->getConstants();
|
||||
$constantNamesToValues = $nativeReflection->getConstants();
|
||||
$this->cachedConstantNamesToValues = $constantNamesToValues;
|
||||
|
||||
return $constantNamesToValues;
|
||||
|
|
|
@ -149,8 +149,8 @@ final class PropertyPresenceChecker
|
|||
{
|
||||
$propertyNames = [];
|
||||
|
||||
$reflectionClass = $classReflection->getNativeReflection();
|
||||
foreach ($reflectionClass->getProperties() as $reflectionProperty) {
|
||||
$nativeReflection = $classReflection->getNativeReflection();
|
||||
foreach ($nativeReflection->getProperties() as $reflectionProperty) {
|
||||
if ($reflectionProperty->isPrivate()) {
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user