Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks wrong to me. The code for Symfony 3.0 would now also be executed on Symfony 2.8 which might not be what you want to do (as all the deprecated code would not be available anymore).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One thing is sure : if it can be executed on 2.8.1, it should also be executed in 2.8.0, right? And looking at the condition as it is before my change, it can be executed for symfony 2.8.1, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xabbuh : not sure if you're saying that my change is wrong, or that the thing before is even wronger for other reasons, can you please clarify?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, I did not think about
2.8.1. What do you think if we changed the condition to something likeKernel::VERSION_ID < 30000then?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the time, you do want to get the shift on
2.8.0, that's what we do on sonata :See for instance : https://github.com/sonata-project/SonataAdminBundle/blob/48cc780dbcd026193e0e98fb2ad6a2a997e2ec22/Form/Type/AclMatrixType.php#L39
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you please change this to
2 === Kernel::MAJOR_VERSION?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wouterj I don't think it is relevant, because this will be true for both 2.7 and 2.8, right? And the code change should generally apply when switching from 2.7 to 2.8, instead of between 2 and 3, otherwise you get deprecation notices for 2.8.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course there are situations when you can need both switches, like
choices_as_values, but IMO the most frequent and encourages should be 2.7 to 2.8There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@xabbuh @wouterj still think this "Needs Work" ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think you are right. When targetting Symfony 2.8 you will not want to use the deprecated code paths.