Skip to content

Commit

Permalink
remove ctype_ dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Apr 8, 2024
1 parent 6515398 commit 1e874c5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Type/Php/StrRepeatFunctionReturnTypeExtension.php
Expand Up @@ -2,6 +2,7 @@

namespace PHPStan\Type\Php;

use Nette\Utils\Strings;
use PhpParser\Node\Expr\FuncCall;
use PHPStan\Analyser\Scope;
use PHPStan\Reflection\FunctionReflection;
Expand All @@ -18,7 +19,6 @@
use PHPStan\Type\StringType;
use PHPStan\Type\Type;
use function count;
use function ctype_digit;
use function str_repeat;
use function strlen;

Expand Down Expand Up @@ -78,7 +78,7 @@ public function getTypeFromFunctionCall(
if ($inputType->isNumericString()->yes()) {
$onlyNumbers = true;
foreach ($inputType->getConstantStrings() as $constantString) {
if (!ctype_digit($constantString->getValue())) {
if (Strings::match($constantString->getValue(), '#^[0-9]+$#') === null) {
$onlyNumbers = false;
break;
}
Expand Down

0 comments on commit 1e874c5

Please sign in to comment.