From e7fa7d1aa0af63b8a50ca1c2d953a863b9ad755f Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Sun, 3 Dec 2023 16:56:59 +0000 Subject: [PATCH] Updated Rector to commit 18617f9880d098bceae210512c190c8d44aa7811 https://github.com/rectorphp/rector-src/commit/18617f9880d098bceae210512c190c8d44aa7811 Remove isPositiveInteger() check for third argument to strpos() (#5257) --- rules/Php80/Rector/NotIdentical/StrContainsRector.php | 6 +++--- src/Application/VersionResolver.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/rules/Php80/Rector/NotIdentical/StrContainsRector.php b/rules/Php80/Rector/NotIdentical/StrContainsRector.php index 4fc36b3b685..a14791031c5 100644 --- a/rules/Php80/Rector/NotIdentical/StrContainsRector.php +++ b/rules/Php80/Rector/NotIdentical/StrContainsRector.php @@ -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; } } diff --git a/src/Application/VersionResolver.php b/src/Application/VersionResolver.php index 56085d75055..ce81ee91de9 100644 --- a/src/Application/VersionResolver.php +++ b/src/Application/VersionResolver.php @@ -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 */