Rector: Doctrine Default Options

Created on 26 May 2020  路  6Comments  路  Source: rectorphp/rector

Bug Report

| Subject | Details |
| :------------- | :---------------------------------------------------------------|
| Rector version | v0.7.26 |
| Installed as | composer dependency |

I'm trying to understand what Rector rule produces this diff and why. Is this a bug or a feature?

image

I tried reproducing it on Rector demo, but I get different output there:

https://getrector.org/demo/628bca03-12c5-41f3-b549-72fa7122b528

Most helpful comment

Snippet from Doctrine's documentation:

image

All 6 comments

Demo had a 1 month old version untill few minutes ago.

This should be fixed now in dev-master:
https://getrector.org/demo/39e1cf93-b153-4d1a-8b07-6a4cd156a3b7#result

Next Rector version will be released after Symfony 5.1 release. Untill then you can use dev-master

Not sure you understood my statement: {"default":1} should be transformed to {"default"=1}? And if so, which rule/transformer does that?

It should not and is not. See the demo link in my comment, there is no change.

My bad, I assumed it was related to doctrine, but seems to be related to "symfony50" ruleset. See demo https://getrector.org/demo/f35c24d0-21e5-4bd8-b90c-68c0c77f212a#result

This is a design choice based on official Symfony/Doctrine docs, since there is no parsing tool for ":/=" in annotations.

See:

The meaning is the same, I recommend using = consistently in all Symfony/Doctrine annotations in nested arrays.

Snippet from Doctrine's documentation:

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pavarnos picture pavarnos  路  4Comments

carusogabriel picture carusogabriel  路  5Comments

HDVinnie picture HDVinnie  路  3Comments

sidux picture sidux  路  5Comments

donbrico picture donbrico  路  4Comments