Skip to content

Commit 6a5893f

Browse files
committed
Updated Rector to commit 84fe920db62fecb447335cbfff9081d67c672a94
rectorphp/rector-src@84fe920 [CodeQuality] Skip possibly undefined variable on CoalesceToTernaryRector (#7968)
1 parent b6383f8 commit 6a5893f

8 files changed

Lines changed: 1287 additions & 414 deletions

File tree

rules/CodeQuality/Rector/Coalesce/CoalesceToTernaryRector.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PhpParser\Node\Expr\ArrayDimFetch;
88
use PhpParser\Node\Expr\BinaryOp\Coalesce;
99
use PhpParser\Node\Expr\Ternary;
10+
use PhpParser\Node\Expr\Variable;
1011
use PHPStan\Type\ErrorType;
1112
use PHPStan\Type\MixedType;
1213
use PHPStan\Type\NullType;
@@ -75,6 +76,9 @@ public function refactor(Node $node): ?Node
7576
}
7677
}
7778
}
79+
if ($node->left instanceof Variable && !$scope->hasVariableType((string) $this->getName($node->left))->yes()) {
80+
return null;
81+
}
7882
return new Ternary($node->left, null, $node->right);
7983
}
8084
}

src/Application/VersionResolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ final class VersionResolver
1919
* @api
2020
* @var string
2121
*/
22-
public const PACKAGE_VERSION = '6200babc1974748d2ab00ec9802314a2a91e5874';
22+
public const PACKAGE_VERSION = '84fe920db62fecb447335cbfff9081d67c672a94';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2026-04-11 10:23:17';
27+
public const RELEASE_DATE = '2026-04-11 21:41:03';
2828
/**
2929
* @var int
3030
*/

vendor/composer/installed.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3301,17 +3301,17 @@
33013301
},
33023302
{
33033303
"name": "webmozart\/assert",
3304-
"version": "2.2.0",
3305-
"version_normalized": "2.2.0.0",
3304+
"version": "2.3.0",
3305+
"version_normalized": "2.3.0.0",
33063306
"source": {
33073307
"type": "git",
33083308
"url": "https:\/\/github.com\/webmozarts\/assert.git",
3309-
"reference": "1b99650e7ffcad232624a260bc7fbdec2ffc407c"
3309+
"reference": "eb0d790f735ba6cff25c683a85a1da0eadeff9e4"
33103310
},
33113311
"dist": {
33123312
"type": "zip",
3313-
"url": "https:\/\/api.github.com\/repos\/webmozarts\/assert\/zipball\/1b99650e7ffcad232624a260bc7fbdec2ffc407c",
3314-
"reference": "1b99650e7ffcad232624a260bc7fbdec2ffc407c",
3313+
"url": "https:\/\/api.github.com\/repos\/webmozarts\/assert\/zipball\/eb0d790f735ba6cff25c683a85a1da0eadeff9e4",
3314+
"reference": "eb0d790f735ba6cff25c683a85a1da0eadeff9e4",
33153315
"shasum": ""
33163316
},
33173317
"require": {
@@ -3325,7 +3325,7 @@
33253325
"ext-simplexml": "",
33263326
"ext-spl": ""
33273327
},
3328-
"time": "2026-04-09T16:54:47+00:00",
3328+
"time": "2026-04-11T10:33:05+00:00",
33293329
"type": "library",
33303330
"extra": {
33313331
"branch-alias": {
@@ -3360,7 +3360,7 @@
33603360
],
33613361
"support": {
33623362
"issues": "https:\/\/github.com\/webmozarts\/assert\/issues",
3363-
"source": "https:\/\/github.com\/webmozarts\/assert\/tree\/2.2.0"
3363+
"source": "https:\/\/github.com\/webmozarts\/assert\/tree\/2.3.0"
33643364
},
33653365
"install-path": "..\/webmozart\/assert"
33663366
}

vendor/composer/installed.php

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

vendor/webmozart/assert/CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Changelog
22
=========
33

4+
## 2.3.0
5+
6+
### Changed
7+
8+
- Clarified documentation and testing of `uniqueValues`.
9+
10+
### Added
11+
12+
- All assertions now support `string|callable` for the message.
13+
414
## 2.2.0
515

616
### Added

vendor/webmozart/assert/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,16 @@ Assert::nullOrString($middleName, 'The middle name must be a string or null. Got
242242
The `Assert` class comes with a few methods, which can be overridden to change the class behaviour. You can also extend it to
243243
add your own assertions.
244244

245+
### Lazy assertion messages
246+
247+
Assertion messages can be provided as callables to avoid unnecessary computation when the assertion passes:
248+
249+
```php
250+
Assert::string($value, fn() => expensiveMessage());
251+
```
252+
253+
The callable will only be executed if the assertion fails.
254+
245255
#### Overriding methods
246256

247257
Overriding the following methods in your assertion class allows you to change the behaviour of the assertions:

0 commit comments

Comments
 (0)