Skip to content

Commit

Permalink
Updated Rector to commit d894cccb8535fea0ad8ab93ead4a4383c81d56b8
Browse files Browse the repository at this point in the history
rectorphp/rector-src@d894ccc [DeadCode] Skip object shape pseudo-type in RemoveNonExistingVarAnnotationRector (#2837)
  • Loading branch information
TomasVotruba committed Aug 24, 2022
1 parent 97851f1 commit d94a781
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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;
Expand Down Expand Up @@ -90,6 +91,9 @@ public function refactor(Node $node) : ?Node
if (!$varTagValueNode instanceof VarTagValueNode) {
return null;
}
if ($this->isObjectShapePseudoType($varTagValueNode)) {
return null;
}
$variableName = \ltrim($varTagValueNode->variableName, '$');
if ($this->hasVariableName($node, $variableName)) {
return null;
Expand Down Expand Up @@ -140,4 +144,21 @@ private function hasVariableName(Node $node, string $variableName) : bool
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;
}
}
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
2 changes: 1 addition & 1 deletion vendor/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

require_once __DIR__ . '/composer/autoload_real.php';

return ComposerAutoloaderInitb73cc082c899099953d09e0d9af2ec72::getLoader();
return ComposerAutoloaderInit9aeabd358130a814e3941ccf7c1484be::getLoader();
14 changes: 7 additions & 7 deletions vendor/composer/autoload_real.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// autoload_real.php @generated by Composer

class ComposerAutoloaderInitb73cc082c899099953d09e0d9af2ec72
class ComposerAutoloaderInit9aeabd358130a814e3941ccf7c1484be
{
private static $loader;

Expand All @@ -22,19 +22,19 @@ public static function getLoader()
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;
Expand All @@ -46,7 +46,7 @@ public static function getLoader()
* @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;
Expand Down
8 changes: 4 additions & 4 deletions vendor/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Composer\Autoload;

class ComposerStaticInitb73cc082c899099953d09e0d9af2ec72
class ComposerStaticInit9aeabd358130a814e3941ccf7c1484be
{
public static $files = array (
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit d94a781

Please sign in to comment.