Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 2 composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"phpstan/phpstan": "^2.1.32",
"phpstan/phpstan-webmozart-assert": "^2.0",
"phpunit/phpunit": "^11.5",
"rector/rector-src": "dev-main",
"rector/rector-src": "dev-tv-traverse-optimize",
"rector/type-perfect": "^2.1",
"symplify/easy-coding-standard": "^12.3",
"symplify/phpstan-extensions": "^12.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ private function markConstantKnownInInnerStmts(If_ $if): void
SimpleNodeTraverser::decorateWithAttributeValue($if, self::PHP73_JSON_CONSTANT_IS_KNOWN, true);
}

private function resolveFuncCall(Expression $Expression): ?FuncCall
private function resolveFuncCall(Expression $expression): ?FuncCall
{
$expr = $Expression->expr;
$expr = $expression->expr;
if ($expr instanceof Assign) {
if ($expr->expr instanceof FuncCall) {
return $expr->expr;
Expand Down Expand Up @@ -154,8 +154,6 @@ private function refactorExpression(Expression $expression): ?array

// retrieve a `FuncCall`, if any, from the statement
$funcCall = $this->resolveFuncCall($expression);

// Nothing to do if no `FuncCall` found
if (! $funcCall instanceof FuncCall) {
return null;
}
Expand Down Expand Up @@ -203,8 +201,7 @@ private function hasConstFetchInArgs(array $args, string $constName): bool
{
foreach ($args as $arg) {
$value = $arg->value;

if ($value instanceof ConstFetch && $this->getName($value) === $constName) {
if ($value instanceof ConstFetch && $this->isName($value, $constName)) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion 2 tests/Issues/DowngradeNullJson/Fixture/fixture.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Fixture
{
public function run(?int $flags = null)
{
$flags = $flags ?? JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_PRESERVE_ZERO_FRACTION;
$flags = $flags ?? JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT | JSON_PRESERVE_ZERO_FRACTION | 0;

json_encode([], $flags);
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.