Skip to content

Commit

Permalink
Updated Rector to commit 18617f9880d098bceae210512c190c8d44aa7811
Browse files Browse the repository at this point in the history
rectorphp/rector-src@18617f9 Remove isPositiveInteger() check for third argument to strpos() (#5257)
  • Loading branch information
TomasVotruba committed Dec 3, 2023
1 parent 9d01b5b commit e7fa7d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions rules/Php80/Rector/NotIdentical/StrContainsRector.php
Expand Up @@ -87,7 +87,7 @@ public function refactor(Node $node) : ?Node
}
if (isset($funcCall->getArgs()[2])) {
$secondArg = $funcCall->getArgs()[2];
if ($this->isName($funcCall->name, 'strpos') && $this->isPositiveInteger($secondArg->value)) {
if ($this->isName($funcCall->name, 'strpos') && !$this->isIntegerZero($secondArg->value)) {
$funcCall->args[0] = new Arg($this->nodeFactory->createFuncCall('substr', [$funcCall->args[0], $secondArg]));
}
unset($funcCall->args[2]);
Expand Down Expand Up @@ -127,11 +127,11 @@ private function matchIdenticalOrNotIdenticalToFalse($expr) : ?FuncCall
}
return null;
}
private function isPositiveInteger(Expr $expr) : bool
private function isIntegerZero(Expr $expr) : bool
{
if (!$expr instanceof LNumber) {
return \false;
}
return $expr->value > 0;
return $expr->value === 0;
}
}
4 changes: 2 additions & 2 deletions src/Application/VersionResolver.php
Expand Up @@ -19,12 +19,12 @@ final class VersionResolver
* @api
* @var string
*/
public const PACKAGE_VERSION = 'd9c5d8f09bfd68e7496c07c23ddac03447cfbb32';
public const PACKAGE_VERSION = '18617f9880d098bceae210512c190c8d44aa7811';
/**
* @api
* @var string
*/
public const RELEASE_DATE = '2023-12-03 22:47:38';
public const RELEASE_DATE = '2023-12-03 17:54:43';
/**
* @var int
*/
Expand Down

0 comments on commit e7fa7d1

Please sign in to comment.