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

[Renaming] Handle error on RenameClassRector when method return static #1243

Merged
merged 5 commits into from Nov 15, 2021

Conversation

samsonasik
Copy link
Member

@TomasVotruba given the following class:

class ReturnStaticDocCloneThis extends \DateTime
{
    /**
     * @return static
     */
    public function run(\DateTime $dateTime)
    {
        $obj = clone $this;
        return $obj;
    }
}

It cause error:

There was 1 error:

1) Rector\Tests\Renaming\Rector\Name\RenameClassRector\RenameClassRectorTest::test with data set #20 (Symplify\SmartFileSystem\SmartFileInfo Object (...))
TypeError: Rector\StaticTypeMapper\PhpDocParser\IdentifierTypeMapper::mapStatic(): Argument #1 ($scope) must be of type PHPStan\Analyser\Scope, null given, called in /Users/samsonasik/www/rector-src/packages/StaticTypeMapper/PhpDocParser/IdentifierTypeMapper.php on line 81

/Users/samsonasik/www/rector-src/packages/StaticTypeMapper/PhpDocParser/IdentifierTypeMapper.php:121
/Users/samsonasik/www/rector-src/packages/StaticTypeMapper/PhpDocParser/IdentifierTypeMapper.php:81

like in #1240

@samsonasik
Copy link
Member Author

Fixed 🎉

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba it is ready for review.

@TomasVotruba
Copy link
Member

Thank you 👍

@TomasVotruba TomasVotruba merged commit 2fe1394 into main Nov 15, 2021
@TomasVotruba TomasVotruba deleted the error-return-static-rename-class-rector branch November 15, 2021 13:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants