- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Went searching for something like this. I think this could be better titlted: "Require backslash prefix for global functions and constants" so renamed.
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Article on the performance improvement of using FQNS'd global functions https://veewee.github.io/blog/optimizing-php-performance-by-fq-function-...
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
I think it would be easier if this was only required for new code.
- π¬π§United Kingdom catch
Agreed we should do this. There are also compiler-level optimisations for
\array_key_exists()
that only work when it's explicitly namespaced.I think we could 'require' it for all code, but not enable the rule until core is actually compliant?
- π©πͺGermany donquixote
Is there any argument for "use" vs in-place backslash?
Personally I think I prefer in-place backslash, but "use" seems more common in composer packages.Clearly in-place backslash is more git-friendly, that is, it reduces merge conflicts from changes in unrelated places.
(In my day to day work I currently don't use either of the two methods, because I would have to convince my colleagues first.)
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
phpcbf can fix this so we can turn the rule on and make the decision at the same time
- π¬π§United Kingdom catch
I think we should only use
use
for functions where they're namespaced functions, which we currently don't have any/many of but could in the future. - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
#8 yeah that makes sense to me too.
- π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
I think this is just
SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctions
? - π¦πΊAustralia kim.pepper πββοΈπ¦πΊSydney, Australia
Added the template to the issue summary.
- π¦πΊAustralia larowlan π¦πΊπ.au GMT+10
Added myself and @kim.pepper as two supporters
- π¦πΊAustralia dpi Perth, Australia
+ support
Discussion for core: π± Call PHP native functions fully qualified (like \array_key_exists()) Active
External discussion in derivative standard: https://github.com/previousnext/coding-standard/pull/69