Skip to content

Commit 6159e7f

Browse files
committed
Updated Rector to commit d46cc1a601f7c5e6f0e1fecebf36ed0a30559b1f
rectorphp/rector-src@d46cc1a Rectify (#7216)
1 parent 064c784 commit 6159e7f

3 files changed

Lines changed: 12 additions & 10 deletions

File tree

rules/Php80/Rector/NotIdentical/StrContainsRector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
use PhpParser\Node\Name;
1616
use PhpParser\Node\Scalar\Int_;
1717
use Rector\Php80\NodeResolver\StrFalseComparisonResolver;
18-
use Rector\PhpParser\Node\Value\ValueResolver;
1918
use Rector\Rector\AbstractRector;
2019
use Rector\ValueObject\PhpVersionFeature;
2120
use Rector\ValueObject\PolyfillPackage;

rules/Php83/Rector/BooleanAnd/JsonValidateRector.php

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ final class JsonValidateRector extends AbstractRector implements MinPhpVersionIn
3030
* @readonly
3131
*/
3232
private BinaryOpManipulator $binaryOpManipulator;
33+
/**
34+
* @readonly
35+
*/
3336
private ValueResolver $valueResolver;
3437
protected const ARG_NAMES = ['json', 'associative', 'depth', 'flags'];
3538
private const JSON_MAX_DEPTH = 0x7fffffff;
@@ -51,7 +54,7 @@ public function getRuleDefinition() : RuleDefinition
5154
CODE_SAMPLE
5255
, <<<'CODE_SAMPLE'
5356
if (json_validate($json)) {
54-
}
57+
}
5558
CODE_SAMPLE
5659
)]);
5760
}
@@ -95,26 +98,26 @@ public function matchJsonValidateArg(BooleanAnd $booleanAnd) : ?FuncCall
9598
if (!$booleanAnd->left instanceof NotIdentical) {
9699
return null;
97100
}
98-
$decodeMatch = $this->binaryOpManipulator->matchFirstAndSecondConditionNode($booleanAnd->left, fn($node) => $node instanceof FuncCall && $this->isName($node->name, 'json_decode'), fn($node) => $node instanceof ConstFetch && $this->isName($node->name, 'null'));
101+
$decodeMatch = $this->binaryOpManipulator->matchFirstAndSecondConditionNode($booleanAnd->left, fn(Node $node): bool => $node instanceof FuncCall && $this->isName($node->name, 'json_decode'), fn(Node $node): bool => $node instanceof ConstFetch && $this->isName($node->name, 'null'));
99102
if (!$decodeMatch instanceof TwoNodeMatch) {
100103
return null;
101104
}
102105
// match: json_last_error() === JSON_ERROR_NONE OR JSON_ERROR_NONE === json_last_error()
103106
if (!$booleanAnd->right instanceof Identical) {
104107
return null;
105108
}
106-
$errorMatch = $this->binaryOpManipulator->matchFirstAndSecondConditionNode($booleanAnd->right, fn($node) => $node instanceof FuncCall && $this->isName($node->name, 'json_last_error'), fn($node) => $node instanceof ConstFetch && $this->isName($node->name, 'JSON_ERROR_NONE'));
109+
$errorMatch = $this->binaryOpManipulator->matchFirstAndSecondConditionNode($booleanAnd->right, fn(Node $node): bool => $node instanceof FuncCall && $this->isName($node->name, 'json_last_error'), fn(Node $node): bool => $node instanceof ConstFetch && $this->isName($node->name, 'JSON_ERROR_NONE'));
107110
if (!$errorMatch instanceof TwoNodeMatch) {
108111
return null;
109112
}
110113
// always return the json_decode(...) call
111-
$funcCall = $decodeMatch->getFirstExpr();
112-
if (!$funcCall instanceof FuncCall) {
114+
$expr = $decodeMatch->getFirstExpr();
115+
if (!$expr instanceof FuncCall) {
113116
return null;
114117
}
115-
return $funcCall;
118+
return $expr;
116119
}
117-
protected function validateArgs(FuncCall $funcCall) : bool
120+
private function validateArgs(FuncCall $funcCall) : bool
118121
{
119122
$depth = $funcCall->getArg('depth', 2);
120123
$flags = $funcCall->getArg('flags', 3);

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 = 'a72065d1676018c9fa346f11ff0cdd2dd7bbe27d';
22+
public const PACKAGE_VERSION = 'd46cc1a601f7c5e6f0e1fecebf36ed0a30559b1f';
2323
/**
2424
* @api
2525
* @var string
2626
*/
27-
public const RELEASE_DATE = '2025-09-04 20:31:57';
27+
public const RELEASE_DATE = '2025-09-04 14:10:50';
2828
/**
2929
* @var int
3030
*/

0 commit comments

Comments
 (0)