Skip to content

Commit f1d5173

Browse files
Merge branch '11.5' into 12.2
2 parents 56e1c0e + 61782f4 commit f1d5173

File tree

14 files changed

+209
-94
lines changed

14 files changed

+209
-94
lines changed

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/.phpstan/composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"require-dev": {
3-
"phpstan/phpstan": "^2.1.18",
3+
"phpstan/phpstan": "^2.1.20",
44
"phpstan/extension-installer": "^1.4.3",
5-
"phpstan/phpstan-strict-rules": "^2.0.4",
5+
"phpstan/phpstan-strict-rules": "^2.0.6",
66
"tomasvotruba/type-coverage": "^2.0.2",
77
"ergebnis/phpstan-rules": "^2.10.5"
88
},

tools/.phpstan/composer.lock

Lines changed: 12 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/.phpstan/vendor/composer/installed.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -219,17 +219,17 @@
219219
},
220220
{
221221
"name": "phpstan/phpstan",
222-
"version": "2.1.18",
223-
"version_normalized": "2.1.18.0",
222+
"version": "2.1.20",
223+
"version_normalized": "2.1.20.0",
224224
"source": {
225225
"type": "git",
226226
"url": "https://github.com/phpstan/phpstan.git",
227-
"reference": "ee1f390b7a70cdf74a2b737e554f68afea885db7"
227+
"reference": "a9ccfef95210f92ba6feea6e8d1eef42b5605499"
228228
},
229229
"dist": {
230230
"type": "zip",
231-
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/ee1f390b7a70cdf74a2b737e554f68afea885db7",
232-
"reference": "ee1f390b7a70cdf74a2b737e554f68afea885db7",
231+
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/a9ccfef95210f92ba6feea6e8d1eef42b5605499",
232+
"reference": "a9ccfef95210f92ba6feea6e8d1eef42b5605499",
233233
"shasum": ""
234234
},
235235
"require": {
@@ -238,7 +238,7 @@
238238
"conflict": {
239239
"phpstan/phpstan-shim": "*"
240240
},
241-
"time": "2025-07-17T17:22:31+00:00",
241+
"time": "2025-07-26T20:45:26+00:00",
242242
"bin": [
243243
"phpstan",
244244
"phpstan.phar"
@@ -280,17 +280,17 @@
280280
},
281281
{
282282
"name": "phpstan/phpstan-strict-rules",
283-
"version": "2.0.4",
284-
"version_normalized": "2.0.4.0",
283+
"version": "2.0.6",
284+
"version_normalized": "2.0.6.0",
285285
"source": {
286286
"type": "git",
287287
"url": "https://github.com/phpstan/phpstan-strict-rules.git",
288-
"reference": "3e139cbe67fafa3588e1dbe27ca50f31fdb6236a"
288+
"reference": "f9f77efa9de31992a832ff77ea52eb42d675b094"
289289
},
290290
"dist": {
291291
"type": "zip",
292-
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/3e139cbe67fafa3588e1dbe27ca50f31fdb6236a",
293-
"reference": "3e139cbe67fafa3588e1dbe27ca50f31fdb6236a",
292+
"url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/f9f77efa9de31992a832ff77ea52eb42d675b094",
293+
"reference": "f9f77efa9de31992a832ff77ea52eb42d675b094",
294294
"shasum": ""
295295
},
296296
"require": {
@@ -303,7 +303,7 @@
303303
"phpstan/phpstan-phpunit": "^2.0",
304304
"phpunit/phpunit": "^9.6"
305305
},
306-
"time": "2025-03-18T11:42:40+00:00",
306+
"time": "2025-07-21T12:19:29+00:00",
307307
"type": "phpstan-extension",
308308
"extra": {
309309
"phpstan": {
@@ -325,7 +325,7 @@
325325
"description": "Extra strict and opinionated rules for PHPStan",
326326
"support": {
327327
"issues": "https://github.com/phpstan/phpstan-strict-rules/issues",
328-
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.4"
328+
"source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.6"
329329
},
330330
"install-path": "../phpstan/phpstan-strict-rules"
331331
},

tools/.phpstan/vendor/composer/installed.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
'name' => '__root__',
44
'pretty_version' => '12.2.x-dev',
55
'version' => '12.2.9999999.9999999-dev',
6-
'reference' => '015b77379230e5dc165546f2f43b10e9069ce466',
6+
'reference' => '56e1c0e13a2d74376f37abdb41e22b0e46b263b7',
77
'type' => 'library',
88
'install_path' => __DIR__ . '/../../',
99
'aliases' => array(),
@@ -13,7 +13,7 @@
1313
'__root__' => array(
1414
'pretty_version' => '12.2.x-dev',
1515
'version' => '12.2.9999999.9999999-dev',
16-
'reference' => '015b77379230e5dc165546f2f43b10e9069ce466',
16+
'reference' => '56e1c0e13a2d74376f37abdb41e22b0e46b263b7',
1717
'type' => 'library',
1818
'install_path' => __DIR__ . '/../../',
1919
'aliases' => array(),
@@ -47,18 +47,18 @@
4747
'dev_requirement' => true,
4848
),
4949
'phpstan/phpstan' => array(
50-
'pretty_version' => '2.1.18',
51-
'version' => '2.1.18.0',
52-
'reference' => 'ee1f390b7a70cdf74a2b737e554f68afea885db7',
50+
'pretty_version' => '2.1.20',
51+
'version' => '2.1.20.0',
52+
'reference' => 'a9ccfef95210f92ba6feea6e8d1eef42b5605499',
5353
'type' => 'library',
5454
'install_path' => __DIR__ . '/../phpstan/phpstan',
5555
'aliases' => array(),
5656
'dev_requirement' => true,
5757
),
5858
'phpstan/phpstan-strict-rules' => array(
59-
'pretty_version' => '2.0.4',
60-
'version' => '2.0.4.0',
61-
'reference' => '3e139cbe67fafa3588e1dbe27ca50f31fdb6236a',
59+
'pretty_version' => '2.0.6',
60+
'version' => '2.0.6.0',
61+
'reference' => 'f9f77efa9de31992a832ff77ea52eb42d675b094',
6262
'type' => 'phpstan-extension',
6363
'install_path' => __DIR__ . '/../phpstan/phpstan-strict-rules',
6464
'aliases' => array(),

tools/.phpstan/vendor/phpstan/extension-installer/src/GeneratedConfig.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ final class GeneratedConfig
3535
0 => 'rules.neon',
3636
),
3737
),
38-
'version' => '2.0.4',
38+
'version' => '2.0.6',
3939
'phpstanVersionConstraint' => '>=2.0.4.0-dev, <3.0.0.0-dev',
4040
),
4141
'tomasvotruba/type-coverage' =>

tools/.phpstan/vendor/phpstan/phpstan-strict-rules/README.md

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,29 @@
66

77
[PHPStan](https://phpstan.org/) focuses on finding bugs in your code. But in PHP there's a lot of leeway in how stuff can be written. This repository contains additional rules that revolve around strictly and strongly typed code with no loose casting for those who want additional safety in extremely defensive programming:
88

9-
* Require booleans in `if`, `elseif`, ternary operator, after `!`, and on both sides of `&&` and `||`.
10-
* Require booleans in `while` and `do while` loop conditions.
11-
* Require numeric operands or arrays in `+` and numeric operands in `-`/`*`/`/`/`**`/`%`.
12-
* Require numeric operand in `$var++`, `$var--`, `++$var`and `--$var`.
13-
* These functions contain a `$strict` parameter for better type safety, it must be set to `true`:
14-
* `in_array` (3rd parameter)
15-
* `array_search` (3rd parameter)
16-
* `array_keys` (3rd parameter; only if the 2nd parameter `$search_value` is provided)
17-
* `base64_decode` (2nd parameter)
18-
* Variables assigned in `while` loop condition and `for` loop initial assignment cannot be used after the loop.
19-
* Variables set in foreach that's always looped thanks to non-empty arrays cannot be used after the loop.
20-
* Types in `switch` condition and `case` value must match. PHP compares them loosely by default and that can lead to unexpected results.
21-
* Check that statically declared methods are called statically.
22-
* Disallow `empty()` - it's a very loose comparison (see [manual](https://php.net/empty)), it's recommended to use more strict one.
23-
* Disallow short ternary operator (`?:`) - implies weak comparison, it's recommended to use null coalesce operator (`??`) or ternary operator with strict condition.
24-
* Disallow variable variables (`$$foo`, `$this->$method()` etc.)
25-
* Disallow overwriting variables with foreach key and value variables
26-
* Always true `instanceof`, type-checking `is_*` functions and strict comparisons `===`/`!==`. These checks can be turned off by setting `checkAlwaysTrueInstanceof`/`checkAlwaysTrueCheckTypeFunctionCall`/`checkAlwaysTrueStrictComparison` to false.
27-
* Correct case for referenced and called function names.
28-
* Correct case for inherited and implemented method names.
29-
* Contravariance for parameter types and covariance for return types in inherited methods (also known as Liskov substitution principle - LSP)
30-
* Check LSP even for static methods
31-
* Require calling parent constructor
32-
* Disallow usage of backtick operator (`` $ls = `ls -la` ``)
33-
* Closure should use `$this` directly instead of using `$this` variable indirectly
9+
| Configuration Parameters | Rule Description |
10+
|:---------------------------------------|:--------------------------------------------------------------------------------------------------------|
11+
| `booleansInConditions` | Require booleans in `if`, `elseif`, ternary operator, after `!`, and on both sides of `&&` and `\|\|`. |
12+
| `booleansInLoopConditions` | Require booleans in `while` and `do while` loop conditions. |
13+
| `numericOperandsInArithmeticOperators` | Require numeric operand in `+$var`, `-$var`, `$var++`, `$var--`, `++$var` and `--$var`. |
14+
| `numericOperandsInArithmeticOperators` | Require numeric operand in `$var++`, `$var--`, `++$var`and `--$var`. |
15+
| `strictFunctionCalls` | These functions contain a `$strict` parameter for better type safety, it must be set to `true`:<br>* `in_array` (3rd parameter)<br>* `array_search` (3rd parameter)<br>* `array_keys` (3rd parameter; only if the 2nd parameter `$search_value` is provided)<br>* `base64_decode` (2nd parameter). |
16+
| `overwriteVariablesWithLoop` | Variables assigned in `while` loop condition and `for` loop initial assignment cannot be used after the loop. |
17+
| `overwriteVariablesWithLoop` | Variables set in foreach that's always looped thanks to non-empty arrays cannot be used after the loop. |
18+
| `switchConditionsMatchingType` | Types in `switch` condition and `case` value must match. PHP compares them loosely by default and that can lead to unexpected results. |
19+
| `dynamicCallOnStaticMethod` | Check that statically declared methods are called statically. |
20+
| `disallowedEmpty` | Disallow `empty()` - it's a very loose comparison (see [manual](https://php.net/empty)), it's recommended to use more strict one. |
21+
| `disallowedShortTernary` | Disallow short ternary operator (`?:`) - implies weak comparison, it's recommended to use null coalesce operator (`??`) or ternary operator with strict condition. |
22+
| `noVariableVariables` | Disallow variable variables (`$$foo`, `$this->$method()` etc.). |
23+
| `overwriteVariablesWithLoop` | Disallow overwriting variables with foreach key and value variables. |
24+
| `checkAlwaysTrueInstanceof`, `checkAlwaysTrueCheckTypeFunctionCall`, `checkAlwaysTrueStrictComparison` | Always true `instanceof`, type-checking `is_*` functions and strict comparisons `===`/`!==`. These checks can be turned off by setting `checkAlwaysTrueInstanceof`, `checkAlwaysTrueCheckTypeFunctionCall` and `checkAlwaysTrueStrictComparison` to false. |
25+
| | Correct case for referenced and called function names. |
26+
| `matchingInheritedMethodNames` | Correct case for inherited and implemented method names. |
27+
| | Contravariance for parameter types and covariance for return types in inherited methods (also known as Liskov substitution principle - LSP).|
28+
| | Check LSP even for static methods. |
29+
| `requireParentConstructorCall` | Require calling parent constructor. |
30+
| `disallowedBacktick` | Disallow usage of backtick operator (`` $ls = `ls -la` ``). |
31+
| `closureUsesThis` | Closure should use `$this` directly instead of using `$this` variable indirectly. |
3432

3533
Additional rules are coming in subsequent releases!
3634

@@ -84,7 +82,7 @@ parameters:
8482
illegalConstructorMethodCall: false
8583
```
8684

87-
Aside from introducing new custom rules, phpstan-strict-rules also [change the default values of some configuration parameters](https://github.com/phpstan/phpstan-strict-rules/blob/1.6.x/rules.neon#L1) that are present in PHPStan itself. These parameters are [documented on phpstan.org](https://phpstan.org/config-reference#stricter-analysis).
85+
Aside from introducing new custom rules, phpstan-strict-rules also [change the default values of some configuration parameters](./rules.neon#L1) that are present in PHPStan itself. These parameters are [documented on phpstan.org](https://phpstan.org/config-reference#stricter-analysis).
8886

8987
## Enabling rules one-by-one
9088

@@ -107,4 +105,4 @@ parameters:
107105
booleansInConditions: true
108106
```
109107

110-
Even with `strictRules.allRules` set to `false`, part of this package is still in effect. That's because phpstan-strict-rules also [change the default values of some configuration parameters](https://github.com/phpstan/phpstan-strict-rules/blob/1.6.x/rules.neon#L1) that are present in PHPStan itself. These parameters are [documented on phpstan.org](https://phpstan.org/config-reference#stricter-analysis).
108+
Even with `strictRules.allRules` set to `false`, part of this package is still in effect. That's because phpstan-strict-rules also [change the default values of some configuration parameters](./rules.neon#L1) that are present in PHPStan itself. These parameters are [documented on phpstan.org](https://phpstan.org/config-reference#stricter-analysis).

tools/.phpstan/vendor/phpstan/phpstan-strict-rules/rules.neon

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ conditionalTags:
106106
phpstan.rules.rule: %strictRules.numericOperandsInArithmeticOperators%
107107
PHPStan\Rules\Operators\OperandInArithmeticPreIncrementRule:
108108
phpstan.rules.rule: %strictRules.numericOperandsInArithmeticOperators%
109+
PHPStan\Rules\Operators\OperandInArithmeticUnaryMinusRule:
110+
phpstan.rules.rule: [%strictRules.numericOperandsInArithmeticOperators%, %featureToggles.bleedingEdge%]
111+
PHPStan\Rules\Operators\OperandInArithmeticUnaryPlusRule:
112+
phpstan.rules.rule: [%strictRules.numericOperandsInArithmeticOperators%, %featureToggles.bleedingEdge%]
109113
PHPStan\Rules\Operators\OperandsInArithmeticAdditionRule:
110114
phpstan.rules.rule: %strictRules.numericOperandsInArithmeticOperators%
111115
PHPStan\Rules\Operators\OperandsInArithmeticDivisionRule:
@@ -242,6 +246,12 @@ services:
242246
-
243247
class: PHPStan\Rules\Operators\OperandInArithmeticPreIncrementRule
244248

249+
-
250+
class: PHPStan\Rules\Operators\OperandInArithmeticUnaryMinusRule
251+
252+
-
253+
class: PHPStan\Rules\Operators\OperandInArithmeticUnaryPlusRule
254+
245255
-
246256
class: PHPStan\Rules\Operators\OperandsInArithmeticAdditionRule
247257

tools/.phpstan/vendor/phpstan/phpstan-strict-rules/src/Rules/Cast/UselessCastRule.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,12 @@ public function processNode(Node $node, Scope $scope): array
5555
return $ruleErrorBuilder;
5656
}
5757

58-
$expressionTypeWithoutPhpDoc = $scope->getNativeType($node->expr);
59-
if ($castType->isSuperTypeOf($expressionTypeWithoutPhpDoc)->yes()) {
58+
if (!$this->treatPhpDocTypesAsCertainTip) {
6059
return $ruleErrorBuilder;
6160
}
6261

63-
if (!$this->treatPhpDocTypesAsCertainTip) {
62+
$expressionTypeWithoutPhpDoc = $scope->getNativeType($node->expr);
63+
if ($castType->isSuperTypeOf($expressionTypeWithoutPhpDoc)->yes()) {
6464
return $ruleErrorBuilder;
6565
}
6666

0 commit comments

Comments
 (0)