Updated Rector to commit 18617f9880d098bceae210512c190c8d44aa7811

18617f9880 Remove isPositiveInteger() check for third argument to strpos() (#5257)
This commit is contained in:
Tomas Votruba 2023-12-03 16:56:59 +00:00
parent 9d01b5b403
commit e7fa7d1aa0
2 changed files with 5 additions and 5 deletions

View File

@ -87,7 +87,7 @@ CODE_SAMPLE
}
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]);
@ -127,11 +127,11 @@ CODE_SAMPLE
}
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;
}
}

View File

@ -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
*/