mirror of
https://github.com/rectorphp/rector.git
synced 2025-02-21 09:42:45 +01:00
[CodeQuality] Fixes #4950 Skip IssetOnPropertyObjectToPropertyExistsRector on property as variable (#4953)
This commit is contained in:
parent
9e6365cc58
commit
48eaa5c950
@ -12,6 +12,7 @@ use PhpParser\Node\Expr\BinaryOp\NotIdentical;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Expr\Isset_;
|
||||
use PhpParser\Node\Expr\PropertyFetch;
|
||||
use PhpParser\Node\Expr\Variable;
|
||||
use PhpParser\Node\Identifier;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
@ -96,10 +97,13 @@ CODE_SAMPLE
|
||||
continue;
|
||||
}
|
||||
|
||||
/** @var Identifier $name */
|
||||
/** @var Identifier|Variable $name */
|
||||
$name = $issetVar->name;
|
||||
$property = $name->toString();
|
||||
if (! $name instanceof Identifier) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$property = $name->toString();
|
||||
if ($type instanceof ObjectType) {
|
||||
/** @var string $className */
|
||||
$className = $type->getClassName();
|
||||
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace Rector\CodeQuality\Tests\Rector\Isset_\IssetOnPropertyObjectToPropertyExistsRector\Fixture;
|
||||
|
||||
class SkipPropertyAsVariable
|
||||
{
|
||||
public function run($name)
|
||||
{
|
||||
return isset($this->getStorage()->$name);
|
||||
}
|
||||
|
||||
private function getStorage(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user