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
NativeFunctionInvocationFixer - namespaced strict to remove backslash #4220
NativeFunctionInvocationFixer - namespaced strict to remove backslash #4220
Conversation
Thank you @kubawerlos. |
… backslash (kubawerlos) This PR was merged into the 2.14-dev branch. Discussion ---------- NativeFunctionInvocationFixer - namespaced strict to remove backslash When we want only namespaced calls to have `\` in strict mode we should remove `\` for global namespace call. Commits ------- 1241bda NativeFunctionInvocationFixer - namespaced strict to remove backslash
fixing milestone... |
Can I have more information about the bug? I don't understand why we remove the slash in the function call. |
@voskobovich take a look at the test - we remove backslash only for function in global namespace when fixer configured scope is |
@kubawerlos Ok. I understand what you are doing. But I do not understand why this is necessary? Hard specification of the global namespace for a function should speed up its search when executing code. |
@voskobovich this is not necessary, you can use scope
That is not true - opcode is the same, not matter if backaslash is used: https://3v4l.org/aK4ZR/vld#output and https://3v4l.org/NCSFH/vld#output. |
@kubawerlos Thank! This was new information for me)) |
PHP CS Fixer sharing the knowledge and good practices ;) |
Can I use this rule for the opposite, ensuring that all I read the current readme for "native_function_invocation" but I'm unsure.
I figured maybe with this I can achieve this, but it doesn't work: 'native_function_invocation' => [
'exclude' => ['@all'],
'strict' => true,
], Still adds Thanks :) |
Apologies, I re-read my comment and I think it's not really clear: |
@mfn try: 'native_function_invocation' => [
'include' => [],
'strict' => true,
], |
How on eart… Re-reading the readme I guess it makes sense but I still fail to distill this from the text 🤷♀️ Anyway, the one combination I did not try 😅, it works, so thank you 👍 |
When we want only namespaced calls to have
\
in strict mode we should remove\
for global namespace call.