mirror of
https://github.com/rectorphp/rector.git
synced 2024-06-03 01:40:49 +00:00
Updated Rector to commit 18617f9880d098bceae210512c190c8d44aa7811
18617f9880
Remove isPositiveInteger() check for third argument to strpos() (#5257)
This commit is contained in:
parent
9d01b5b403
commit
e7fa7d1aa0
|
@ -87,7 +87,7 @@ CODE_SAMPLE
|
||||||
}
|
}
|
||||||
if (isset($funcCall->getArgs()[2])) {
|
if (isset($funcCall->getArgs()[2])) {
|
||||||
$secondArg = $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]));
|
$funcCall->args[0] = new Arg($this->nodeFactory->createFuncCall('substr', [$funcCall->args[0], $secondArg]));
|
||||||
}
|
}
|
||||||
unset($funcCall->args[2]);
|
unset($funcCall->args[2]);
|
||||||
|
@ -127,11 +127,11 @@ CODE_SAMPLE
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
private function isPositiveInteger(Expr $expr) : bool
|
private function isIntegerZero(Expr $expr) : bool
|
||||||
{
|
{
|
||||||
if (!$expr instanceof LNumber) {
|
if (!$expr instanceof LNumber) {
|
||||||
return \false;
|
return \false;
|
||||||
}
|
}
|
||||||
return $expr->value > 0;
|
return $expr->value === 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const PACKAGE_VERSION = 'd9c5d8f09bfd68e7496c07c23ddac03447cfbb32';
|
public const PACKAGE_VERSION = '18617f9880d098bceae210512c190c8d44aa7811';
|
||||||
/**
|
/**
|
||||||
* @api
|
* @api
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public const RELEASE_DATE = '2023-12-03 22:47:38';
|
public const RELEASE_DATE = '2023-12-03 17:54:43';
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user