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

CorrectDefaultTypesOnEntityPropertyRector throws error with null default value for integer doctrine entity field #5454

Closed
runawaycoin opened this issue Feb 8, 2021 · 4 comments · Fixed by rectorphp/rector-doctrine#52
Labels

Comments

@runawaycoin
Copy link

Question

Not sure if this is a bug / not catered for yet or I'm doing something wrong?

When using the CorrectDefaultTypesOnEntityPropertyRector i'm hitting the NotImplementedYetException inside refactorToIntType with the following Doctrine Entity code. Its due to the null default value.

 /**
     * @ORM\Column(type="integer", nullable=true)
     */
    private ?int $myInt = null;

The error i get is:

[ERROR] Could not process "src/Entity/MyEntity.php" file by                                                            
         "Rector\DoctrineCodeQuality\Rector\Property\CorrectDefaultTypesOnEntityPropertyRector", due to:                
         "".                                                                                                            
                 
@TomasVotruba
Copy link
Member

Hi, we'll need a failing demo link to have context: https://getrector.org/demo

@runawaycoin
Copy link
Author

Hi,

Great tool, sorry i didn't use this in my initial post.

I think this is reproducing it:
https://getrector.org/demo/3b637639-ed29-4fd9-941c-caf89cb9bf22

Thanks.

@TomasVotruba
Copy link
Member

Thank you for your report and demo link!

Could you send a failing test case in a pull-request, so we have it covered in Rector?
Here is step by step tutorial how to add it: https://github.com/rectorphp/rector/blob/master/docs/how_to_add_test_for_rector_rule.md

@TomasVotruba
Copy link
Member

We've just switch to a custom static doctrine annotation parser, where this issues should be resolved.

#5974

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants