Update dependency phpstan/phpstan-strict-rules to ^2.0.12
This commit is contained in:
parent
3f33ba4c67
commit
62b71e89b8
|
|
@ -2,7 +2,7 @@
|
|||
"require-dev": {
|
||||
"phpstan/phpstan": "^2.2.5",
|
||||
"phpstan/extension-installer": "^1.4.3",
|
||||
"phpstan/phpstan-strict-rules": "^2.0.11",
|
||||
"phpstan/phpstan-strict-rules": "^2.0.12",
|
||||
"tomasvotruba/type-coverage": "^2.2.2",
|
||||
"ergebnis/phpstan-rules": "^2.13.1"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "f2f0502dde6131231f7156bb150bc1fa",
|
||||
"content-hash": "34012cc3393d0e121c017d366ac2ad1e",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
|
|
@ -194,27 +194,28 @@
|
|||
},
|
||||
{
|
||||
"name": "phpstan/phpstan-strict-rules",
|
||||
"version": "2.0.11",
|
||||
"version": "2.0.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan-strict-rules.git",
|
||||
"reference": "9b000a578b85b32945b358b172c7b20e91189024"
|
||||
"reference": "2bc5ae19ae965663b62ac907ee6342c3903ec93b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/9b000a578b85b32945b358b172c7b20e91189024",
|
||||
"reference": "9b000a578b85b32945b358b172c7b20e91189024",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/2bc5ae19ae965663b62ac907ee6342c3903ec93b",
|
||||
"reference": "2bc5ae19ae965663b62ac907ee6342c3903ec93b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"phpstan/phpstan": "^2.1.39"
|
||||
"phpstan/phpstan": "^2.1.52"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/phpstan-deprecation-rules": "^2.0",
|
||||
"phpstan/phpstan-phpunit": "^2.0",
|
||||
"phpunit/phpunit": "^9.6"
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"shipmonk/name-collision-detector": "^2.1"
|
||||
},
|
||||
"type": "phpstan-extension",
|
||||
"extra": {
|
||||
|
|
@ -239,9 +240,9 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
|
||||
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.11"
|
||||
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.12"
|
||||
},
|
||||
"time": "2026-05-02T06:54:10+00:00"
|
||||
"time": "2026-07-19T07:24:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "tomasvotruba/type-coverage",
|
||||
|
|
|
|||
|
|
@ -196,30 +196,31 @@
|
|||
},
|
||||
{
|
||||
"name": "phpstan/phpstan-strict-rules",
|
||||
"version": "2.0.11",
|
||||
"version_normalized": "2.0.11.0",
|
||||
"version": "2.0.12",
|
||||
"version_normalized": "2.0.12.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan-strict-rules.git",
|
||||
"reference": "9b000a578b85b32945b358b172c7b20e91189024"
|
||||
"reference": "2bc5ae19ae965663b62ac907ee6342c3903ec93b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/9b000a578b85b32945b358b172c7b20e91189024",
|
||||
"reference": "9b000a578b85b32945b358b172c7b20e91189024",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/2bc5ae19ae965663b62ac907ee6342c3903ec93b",
|
||||
"reference": "2bc5ae19ae965663b62ac907ee6342c3903ec93b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"phpstan/phpstan": "^2.1.39"
|
||||
"phpstan/phpstan": "^2.1.52"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/phpstan-deprecation-rules": "^2.0",
|
||||
"phpstan/phpstan-phpunit": "^2.0",
|
||||
"phpunit/phpunit": "^9.6"
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"shipmonk/name-collision-detector": "^2.1"
|
||||
},
|
||||
"time": "2026-05-02T06:54:10+00:00",
|
||||
"time": "2026-07-19T07:24:06+00:00",
|
||||
"type": "phpstan-extension",
|
||||
"extra": {
|
||||
"phpstan": {
|
||||
|
|
@ -244,7 +245,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
|
||||
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.11"
|
||||
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.12"
|
||||
},
|
||||
"install-path": "../phpstan/phpstan-strict-rules"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
'name' => '__root__',
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => '33eb9b136b2312642002f4287bbdb796233c54b5',
|
||||
'reference' => '3f33ba4c670a2555e0ffa53bf075539c8b41966d',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
|
@ -13,7 +13,7 @@
|
|||
'__root__' => array(
|
||||
'pretty_version' => 'dev-main',
|
||||
'version' => 'dev-main',
|
||||
'reference' => '33eb9b136b2312642002f4287bbdb796233c54b5',
|
||||
'reference' => '3f33ba4c670a2555e0ffa53bf075539c8b41966d',
|
||||
'type' => 'library',
|
||||
'install_path' => __DIR__ . '/../../',
|
||||
'aliases' => array(),
|
||||
|
|
@ -47,9 +47,9 @@
|
|||
'dev_requirement' => true,
|
||||
),
|
||||
'phpstan/phpstan-strict-rules' => array(
|
||||
'pretty_version' => '2.0.11',
|
||||
'version' => '2.0.11.0',
|
||||
'reference' => '9b000a578b85b32945b358b172c7b20e91189024',
|
||||
'pretty_version' => '2.0.12',
|
||||
'version' => '2.0.12.0',
|
||||
'reference' => '2bc5ae19ae965663b62ac907ee6342c3903ec93b',
|
||||
'type' => 'phpstan-extension',
|
||||
'install_path' => __DIR__ . '/../phpstan/phpstan-strict-rules',
|
||||
'aliases' => array(),
|
||||
|
|
|
|||
|
|
@ -8,13 +8,14 @@
|
|||
"keywords": ["static analysis"],
|
||||
"require": {
|
||||
"php": "^7.4 || ^8.0",
|
||||
"phpstan/phpstan": "^2.1.39"
|
||||
"phpstan/phpstan": "^2.1.52"
|
||||
},
|
||||
"require-dev": {
|
||||
"php-parallel-lint/php-parallel-lint": "^1.2",
|
||||
"phpstan/phpstan-deprecation-rules": "^2.0",
|
||||
"phpstan/phpstan-phpunit": "^2.0",
|
||||
"phpunit/phpunit": "^9.6"
|
||||
"phpunit/phpunit": "^9.6",
|
||||
"shipmonk/name-collision-detector": "^2.1"
|
||||
},
|
||||
"config": {
|
||||
"platform": {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace PHPStan\Rules\Operators;
|
||||
|
||||
use PhpParser\Node\Expr;
|
||||
use PhpParser\Node\Scalar\Int_;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use PHPStan\Rules\RuleLevelHelper;
|
||||
use PHPStan\Type\Accessory\AccessoryNumericStringType;
|
||||
|
|
@ -38,7 +39,20 @@ class OperatorRuleHelper
|
|||
return true;
|
||||
}
|
||||
|
||||
return $this->isSubtypeOfNumber($scope, $expr);
|
||||
if ($this->isSubtypeOfNumber($scope, $expr)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if the type supports arithmetic via operator overloading extensions
|
||||
// (only applies to object types like GMP, BCMath\Number)
|
||||
if ($type->isObject()->yes()) {
|
||||
$resultType = $scope->getType(new Expr\BinaryOp\Plus($expr, new Int_(1)));
|
||||
if (!$resultType instanceof ErrorType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isValidForIncrement(Scope $scope, Expr $expr): bool
|
||||
|
|
@ -53,7 +67,18 @@ class OperatorRuleHelper
|
|||
return true;
|
||||
}
|
||||
|
||||
return $this->isSubtypeOfNumber($scope, $expr);
|
||||
if ($this->isSubtypeOfNumber($scope, $expr)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($type->isObject()->yes()) {
|
||||
$resultType = $scope->getType(new Expr\PreInc($expr));
|
||||
if (!$resultType instanceof ErrorType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isValidForDecrement(Scope $scope, Expr $expr): bool
|
||||
|
|
@ -63,7 +88,18 @@ class OperatorRuleHelper
|
|||
return true;
|
||||
}
|
||||
|
||||
return $this->isSubtypeOfNumber($scope, $expr);
|
||||
if ($this->isSubtypeOfNumber($scope, $expr)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if ($type->isObject()->yes()) {
|
||||
$resultType = $scope->getType(new Expr\PreDec($expr));
|
||||
if (!$resultType instanceof ErrorType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private function isSubtypeOfNumber(Scope $scope, Expr $expr): bool
|
||||
|
|
|
|||
Loading…
Reference in New Issue