mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit b5f434b53c4c6fceb88c19d4656e4f11c6092f3c
b5f434b53c
[CodeQuality] Make CommonNotEqualRector skip if not <> (#5292)
This commit is contained in:
parent
8486081737
commit
3aaf5b74fb
|
@ -47,10 +47,28 @@ CODE_SAMPLE
|
|||
/**
|
||||
* @param NotEqual $node
|
||||
*/
|
||||
public function refactor(Node $node) : NotEqual
|
||||
public function refactor(Node $node) : ?NotEqual
|
||||
{
|
||||
if (!$this->doesNotEqualContainsShipCompareToken($node)) {
|
||||
return null;
|
||||
}
|
||||
// invoke override to default "!="
|
||||
$node->setAttribute(AttributeKey::ORIGINAL_NODE, null);
|
||||
return $node;
|
||||
}
|
||||
private function doesNotEqualContainsShipCompareToken(NotEqual $notEqual) : bool
|
||||
{
|
||||
$tokenStartPos = $notEqual->getStartTokenPos();
|
||||
$tokenEndPos = $notEqual->getEndTokenPos();
|
||||
for ($i = $tokenStartPos; $i < $tokenEndPos; ++$i) {
|
||||
$token = $this->file->getOldTokens()[$i];
|
||||
if (!isset($token[1])) {
|
||||
continue;
|
||||
}
|
||||
if ($token[1] === '<>') {
|
||||
return \true;
|
||||
}
|
||||
}
|
||||
return \false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = 'e66754adeaad2e9cb67cf1784a6255285dfc542d';
|
||||
public const PACKAGE_VERSION = 'b5f434b53c4c6fceb88c19d4656e4f11c6092f3c';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-11-27 13:43:57';
|
||||
public const RELEASE_DATE = '2023-11-27 16:01:26';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue