Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CodeQuality] Handle crash on return array constant on ExplicitReturnNullRector #6458

Merged
merged 2 commits into from
Nov 20, 2024

Conversation

samsonasik
Copy link
Member

@samsonasik samsonasik commented Nov 20, 2024

Given the following code:

class SkipReturnArrayConstant
{
    public static function provideClearSession()
    {
        return [
            ['Default', ['Foo' => ['foo' => 'fooValue']]],
            [null, []],
        ];
    }
}

got crash:

There was 1 error:

1) Rector\Tests\CodeQuality\Rector\ClassMethod\ExplicitReturnNullRector\ExplicitReturnNullRectorTest::test with data set #1 ('/Users/samsonasik/www/rector-...hp.inc')
Rector\Exception\Reflection\MissingPrivatePropertyException: Property "$keyType" was not found in "PHPStan\Type\Constant\ConstantArrayType" class

This PR fix it.

@samsonasik
Copy link
Member Author

Fixed 🎉

@samsonasik samsonasik enabled auto-merge (squash) November 20, 2024 21:35
@samsonasik samsonasik closed this Nov 20, 2024
auto-merge was automatically disabled November 20, 2024 21:37

Pull request was closed

@samsonasik samsonasik reopened this Nov 20, 2024
@samsonasik samsonasik enabled auto-merge (squash) November 20, 2024 21:37
@samsonasik samsonasik merged commit e16c1d5 into main Nov 20, 2024
72 checks passed
@samsonasik samsonasik deleted the crash-array-constant branch November 20, 2024 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant