-
Notifications
You must be signed in to change notification settings - Fork 95
Make private props readonly; fix tests #319
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
Make private props readonly; fix tests #319
Conversation
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.
Instead of adding those wither methods in the public API just for usage in tests (including some normalization logic which is needed only because we don't "yet" handle the description the same way than upstream and we hide that difference in compatibility tests), I'd rather fix the test:
- try to fix the difference in parsing descriptions so that we don't need custom normalization anymore
- figure out the reason for changing the
keywordTypeandargumentsduring normalization (argumentslooks especially weird to me, as this drops some part that should be compared IMO). then, this should be solved if possible. And otherwise, maybe register a custom comparator to hook into the comparison ofassertEqualsinstead of normalizing objects.
|
@stof on the normalisation:
I think each of these are probably separate things to discuss / address in their own issues / PRs. In the meantime, I agree that we should either register a custom comparator to the |
|
Done, I simply expanded the normalizer method since it sounded more natural than having with/copy methods. I considered a custom comparator, but:
|
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.
Thanks @uuf6429 this generally looks great - a couple of personal-preference nits on style, and I've suggested adding more information on why the StepNode needs to be normalised for future reference.
Co-authored-by: Andrew Coulton <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #319 +/- ##
============================================
+ Coverage 96.70% 96.86% +0.16%
+ Complexity 602 600 -2
============================================
Files 36 36
Lines 1760 1724 -36
============================================
- Hits 1702 1670 -32
+ Misses 58 54 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
Thanks
|
I'm fine with using readonly properties. However, I suggest having a policy banning the usage of readonly classes (even though our support of PHP 8.1 currently forbids it until we bump our min PHP versions). |
@stof agreed. Are you otherwise happy with this PR? |
* Update ArrayKeywords.php * Change null assign syntax
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.
Thanks @uuf6429
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.
@uuf6429 I would have really preferred to see this as two separate PRs, one covering the use of readonly properties, and another with the normaliser changes. Thanks for your work anyway
|
@carlos-granados that wouldn't have worked - as soon as the properties are made private, tests would fail. The only way is if I did the normalizers first and then made the properties private in a child branch, but it would have ended up messier and somewhat counterintuitive. On a related note, GitHub makes a mess out of contributed PRs (e.g. showing huge diffs without factoring in other PRs), which slows down reviewing a lot - which is why I'm avoiding dependent PRs, despite being my day-to-day flow. I'd like to point out that my plan was to fully integrate PHPStan by the end of January - at this point I don't even remember anymore what I was doing that required or warranted setting up PHPStan... and now I just don't want to leave it half-finished. (to be clear, I appreciate everyone's efforts) |
Closes #318.
readonly)