Skip to content

Commit 8d53362

Browse files
committed
misc
1 parent 76c5038 commit 8d53362

File tree

4 files changed

+7
-11
lines changed

4 files changed

+7
-11
lines changed

phpstan.neon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ includes:
55
parameters:
66
level: 8
77
errorFormat: symplify
8-
# reportUnmatchedIgnoredErrors: false
8+
reportUnmatchedIgnoredErrors: false
99

1010
# see https://phpstan.org/writing-php-code/phpdoc-types#global-type-aliases
1111
typeAliases:

rules-tests/DowngradePhp80/Rector/MethodCall/DowngradeReflectionGetAttributesRector/Fixture/class_is_nullable.php

Whitespace-only changes.

rules/DowngradePhp73/Rector/ConstFetch/DowngradePhp73JsonConstRector.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ private function markConstantKnownInInnerStmts(If_ $if): void
118118
SimpleNodeTraverser::decorateWithAttributeValue($if, self::PHP73_JSON_CONSTANT_IS_KNOWN, true);
119119
}
120120

121-
private function resolveFuncCall(Expression $Expression): ?FuncCall
121+
private function resolveFuncCall(Expression $expression): ?FuncCall
122122
{
123-
$expr = $Expression->expr;
123+
$expr = $expression->expr;
124124
if ($expr instanceof Assign) {
125125
if ($expr->expr instanceof FuncCall) {
126126
return $expr->expr;
@@ -152,20 +152,17 @@ private function refactorExpression(Expression $expression): ?array
152152
return null;
153153
}
154154

155-
// retrieve a `FuncCall`, if any, from the statement
156155
$funcCall = $this->resolveFuncCall($expression);
157-
158-
// Nothing to do if no `FuncCall` found
159156
if (! $funcCall instanceof FuncCall) {
160157
return null;
161158
}
162159

163-
// Nothing to do if not a refactored function
164-
if (! $this->isNames($funcCall, self::JSON_FUNCTIONS)) {
160+
if ($funcCall->isFirstClassCallable()) {
165161
return null;
166162
}
167163

168-
if ($funcCall->isFirstClassCallable()) {
164+
// Nothing to do if not a refactored function
165+
if (! $this->isNames($funcCall, self::JSON_FUNCTIONS)) {
169166
return null;
170167
}
171168

@@ -203,7 +200,6 @@ private function hasConstFetchInArgs(array $args, string $constName): bool
203200
{
204201
foreach ($args as $arg) {
205202
$value = $arg->value;
206-
207203
if ($value instanceof ConstFetch && $this->getName($value) === $constName) {
208204
return true;
209205
}

tests/Issues/DowngradeNullJson/Fixture/fixture.php.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Fixture
2222
{
2323
public function run(?int $flags = null)
2424
{
25-
$flags = $flags ?? JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_PRESERVE_ZERO_FRACTION;
25+
$flags = $flags ?? JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_PRESERVE_ZERO_FRACTION | 0;
2626

2727
json_encode([], $flags);
2828
}

0 commit comments

Comments
 (0)