mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 21:38:22 +01:00
Updated Rector to commit d894cccb8535fea0ad8ab93ead4a4383c81d56b8
d894cccb85
[DeadCode] Skip object shape pseudo-type in RemoveNonExistingVarAnnotationRector (#2837)
This commit is contained in:
parent
97851f1829
commit
d94a78124e
@ -19,6 +19,7 @@ use PhpParser\Node\Stmt\Switch_;
|
||||
use PhpParser\Node\Stmt\Throw_;
|
||||
use PhpParser\Node\Stmt\While_;
|
||||
use PHPStan\PhpDocParser\Ast\PhpDoc\VarTagValueNode;
|
||||
use PHPStan\PhpDocParser\Ast\Type\IdentifierTypeNode;
|
||||
use Rector\Core\Rector\AbstractRector;
|
||||
use Rector\DeadCode\NodeAnalyzer\ExprUsedInNodeAnalyzer;
|
||||
use RectorPrefix202208\Symplify\PackageBuilder\Php\TypeChecker;
|
||||
@ -90,6 +91,9 @@ CODE_SAMPLE
|
||||
if (!$varTagValueNode instanceof VarTagValueNode) {
|
||||
return null;
|
||||
}
|
||||
if ($this->isObjectShapePseudoType($varTagValueNode)) {
|
||||
return null;
|
||||
}
|
||||
$variableName = \ltrim($varTagValueNode->variableName, '$');
|
||||
if ($this->hasVariableName($node, $variableName)) {
|
||||
return null;
|
||||
@ -140,4 +144,21 @@ CODE_SAMPLE
|
||||
return $this->isName($node, $variableName);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* This is a hack,
|
||||
* that waits on phpdoc-parser to get merged - https://github.com/phpstan/phpdoc-parser/pull/145
|
||||
*/
|
||||
private function isObjectShapePseudoType(VarTagValueNode $varTagValueNode) : bool
|
||||
{
|
||||
if (!$varTagValueNode->type instanceof IdentifierTypeNode) {
|
||||
return \false;
|
||||
}
|
||||
if ($varTagValueNode->type->name !== 'object') {
|
||||
return \false;
|
||||
}
|
||||
if (\strncmp($varTagValueNode->description, '{', \strlen('{')) !== 0) {
|
||||
return \false;
|
||||
}
|
||||
return \strpos($varTagValueNode->description, '}') !== \false;
|
||||
}
|
||||
}
|
||||
|
@ -17,12 +17,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'c8e66ae94919163b425add82179c735dea44cd8f';
|
||||
public const PACKAGE_VERSION = 'd894cccb8535fea0ad8ab93ead4a4383c81d56b8';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2022-08-24 18:58:11';
|
||||
public const RELEASE_DATE = '2022-08-24 13:59:38';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
2
vendor/autoload.php
vendored
2
vendor/autoload.php
vendored
@ -9,4 +9,4 @@ if (PHP_VERSION_ID < 50600) {
|
||||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInitb73cc082c899099953d09e0d9af2ec72::getLoader();
|
||||
return ComposerAutoloaderInit9aeabd358130a814e3941ccf7c1484be::getLoader();
|
||||
|
14
vendor/composer/autoload_real.php
vendored
14
vendor/composer/autoload_real.php
vendored
@ -2,7 +2,7 @@
|
||||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInitb73cc082c899099953d09e0d9af2ec72
|
||||
class ComposerAutoloaderInit9aeabd358130a814e3941ccf7c1484be
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
@ -22,19 +22,19 @@ class ComposerAutoloaderInitb73cc082c899099953d09e0d9af2ec72
|
||||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInitb73cc082c899099953d09e0d9af2ec72', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit9aeabd358130a814e3941ccf7c1484be', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInitb73cc082c899099953d09e0d9af2ec72', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit9aeabd358130a814e3941ccf7c1484be', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInitb73cc082c899099953d09e0d9af2ec72::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit9aeabd358130a814e3941ccf7c1484be::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInitb73cc082c899099953d09e0d9af2ec72::$files;
|
||||
$includeFiles = \Composer\Autoload\ComposerStaticInit9aeabd358130a814e3941ccf7c1484be::$files;
|
||||
foreach ($includeFiles as $fileIdentifier => $file) {
|
||||
composerRequireb73cc082c899099953d09e0d9af2ec72($fileIdentifier, $file);
|
||||
composerRequire9aeabd358130a814e3941ccf7c1484be($fileIdentifier, $file);
|
||||
}
|
||||
|
||||
return $loader;
|
||||
@ -46,7 +46,7 @@ class ComposerAutoloaderInitb73cc082c899099953d09e0d9af2ec72
|
||||
* @param string $file
|
||||
* @return void
|
||||
*/
|
||||
function composerRequireb73cc082c899099953d09e0d9af2ec72($fileIdentifier, $file)
|
||||
function composerRequire9aeabd358130a814e3941ccf7c1484be($fileIdentifier, $file)
|
||||
{
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
8
vendor/composer/autoload_static.php
vendored
8
vendor/composer/autoload_static.php
vendored
@ -4,7 +4,7 @@
|
||||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInitb73cc082c899099953d09e0d9af2ec72
|
||||
class ComposerStaticInit9aeabd358130a814e3941ccf7c1484be
|
||||
{
|
||||
public static $files = array (
|
||||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
@ -3255,9 +3255,9 @@ class ComposerStaticInitb73cc082c899099953d09e0d9af2ec72
|
||||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInitb73cc082c899099953d09e0d9af2ec72::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInitb73cc082c899099953d09e0d9af2ec72::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInitb73cc082c899099953d09e0d9af2ec72::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit9aeabd358130a814e3941ccf7c1484be::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit9aeabd358130a814e3941ccf7c1484be::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit9aeabd358130a814e3941ccf7c1484be::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user