-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
minor: "Callback" must not be fixed to "callback" by default #7011
Conversation
7d85177
to
d573d16
Compare
b08eccb
to
432b5fc
Compare
432b5fc
to
a6e4da5
Compare
I think this PR solves more your project's issue than issue in general.. Changing how fixer works by default should be done only if there's valid reason for that. Right now you can just configure this fixer explicitly and achieve the same result, without breaking backward compatibility for other users (fixer is included in It would be better to ad some configuration option to the fixer so single types could be excluded from the list, without the need to disable whole group. Alternatively, fixer could check imports in the file and if there's class with such name imported, it shouldn't modify the casing of phpDoc type. |
IIUC this also applies for
👍 it would provide the flexibility for the endusers to just pick and choose what to fix and what to leave alone. |
No, Fixing |
@mvorisek yeah, I did nod find any reference to |
Think I tried to say is, |
What about other |
@mvorisek |
|
To be clear: I know that |
PR is updated, |
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.
👍 from me, but I would like to hear word from someone with bigger experience here.
I would prefer to leave these in and instead; deprecate all options, create a new option called |
@SpacePossum this PR is based on currect static analysers support, |
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.
No,
mixed
- https://3v4l.org/eWEfi and other types fromsimple
/meta
groups are reserved keywords of php-src engine and fixing the case is safe transformation.
Not really true, resource
and (as already mentioned) scalar
are not reserved keywords, the same as all 5 aliases: https://3v4l.org/NDi77
Please, update the test case with config
as after this change the callback
type there could be misleading.
done |
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 @mvorisek 🍻 |
Callback
is very legit class name [1] andalias
group should not be fixed by default by any rule/ruleset by default.In the past it was maybe helpful, but nowdays static analysers can detect invalid class name easily (like
Callback
) and advise the user to fix it manually tocallable
.callback
is still fixed tocallable
byphpdoc_scalar
rule.[1] Used for ex. in https://github.com/atk4/ui/blob/4.0.0/src/Callback.php project heavily and almost any project that depends on it refers to this classname, ie. all projects had to disable the the rule explicitly - https://github.com/atk4/ui/blob/4.0.0/.php-cs-fixer.dist.php#L24 - which is definitely not expected from any default config