Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Refactor: implementsStringable when possible#62305
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:8.0
Are you sure you want to change the base?
Refactor: implementsStringable when possible#62305
Conversation
Stringable when possibleStringable when possibleStringable when possibleStringable when possibleI targeted the 8.0 branch because I think we are in feature freeze. So I think this change could be added (if you like it) for the 8.1 🤔 |
I think the errors aren't relevant and were resolved by thiscontribution. |
src/Symfony/Component/Scheduler/Trigger/CronExpressionTrigger.php OutdatedShow resolvedHide resolved
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.
Overall I'm -0 on this: it's strictly equivalent - except the explicit casts which might hide bugs.
I'm not totally convinced either by this addition. Even though I never felt the need (or lack) of it, why not if it is recommended by the docs. |
I agree with@nicolas-grekas and@alexandre-daubois, the only thing I like is the readability and that you see directly that it is string able when reading the class |
We have rejected PRs that only change code-style without being able to enfore the new style. |
5ac5f7e toe16e36fCompare
If you and the other core members agree with this change, I can try to add this rule (probably over the weekend) tophp-cs-fixer, since Symfony uses this tool. |
That'd be fine to me yes, thanks for proposing ! |
Status: needs work I will try to implement the new rule over this weekend |
Uh oh!
There was an error while loading.Please reload this page.
Reference from thephp manual
From the manual: "The
Stringableinterface denotes a class as having a__toString() method. Unlike most interfaces,Stringableis implicitly present on any class that has the magic__toString() method defined, although it can andshould be declared explicitly."I used the Rector ruleStringableForToStringRector
The
rector.phpfile I used.Also, I want to mention that this change is allowed under theBackward Compatibility Promise.