with same meaning', [new CodeSample(<<<'CODE_SAMPLE'
final class SomeClass
{
public function run($one, $two)
{
return $one <> $two;
}
}
CODE_SAMPLE
, <<<'CODE_SAMPLE'
final class SomeClass
{
public function run($one, $two)
{
return $one != $two;
}
}
CODE_SAMPLE
)]);
}
/**
* @return array>
*/
public function getNodeTypes() : array
{
return [NotEqual::class];
}
/**
* @param NotEqual $node
*/
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;
}
}