mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Feature request: Namespace internal functions and constants #5757
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @michsk on GitHub (Nov 2, 2017).
Originally assigned to: @Majkl578 on GitHub.
Couldn't find any other issue mentioning it. If interested i could make a pull request. There are multiple tools to achieve this:
https://github.com/nilportugues/php-backslasher
https://github.com/Roave/FunctionFQNReplacer
https://github.com/kelunik/fqn-check
https://github.com/FriendsOfPHP/PHP-CS-Fixer (native_function_invocation )
@Majkl578 commented on GitHub (Dec 9, 2017):
I'm personally not convinced this is a good approach, it makes code much harder to read... I'd be +1 only if there is noticeable speedup at runtime which I doubt this would bring. 😕
@michsk commented on GitHub (Dec 11, 2017):
@Ocramius commented on GitHub (Dec 11, 2017):
@Majkl578 a better approach is to import them via
use function foo;- simple and same effects.@Majkl578 commented on GitHub (Jan 1, 2018):
If we want to do this, we can use
SlevomatCodingStandard.Namespaces.FullyQualifiedGlobalFunctionsfor CS enforcement, but it currently sees no difference between\anduse function- if we only want one (use function), we need to extend it a bit.Also be aware that this approach could easily end up with 20+ use statements for functions (typically collapsed by IDE, but still).
@Ocramius commented on GitHub (Jan 1, 2018):
Not worried by amount of imports: better than inline diffs by far, plus we
can grep it if we ever need to get rid of something bad coming from core.
On 1 Jan 2018 23:44, "Michael Moravec" notifications@github.com wrote:
@Majkl578 commented on GitHub (Jan 3, 2018):
Provided CS sniff extension for enforcing(moved to https://github.com/slevomat/coding-standard/issues/236) I guess it now depends on IDE (PhpStorm assumed) how clever it would be when handling this. Will try later and eventually propose this for doctrine/coding-standard.use function/use constin slevomat/coding-standard#235.@Majkl578 commented on GitHub (Jan 3, 2018):
Checked PhpStorm, looks it can handle it as fine as classes.

@Majkl578 commented on GitHub (Jan 8, 2018):
I prepared this in
15968c3495, example of how noisy it'd be is here:2b69bd9594I also tested PHP with VLD with multiple scenarios and didn't find any drawback of using
userather than\- functions were correctly inlined and/or specialized to custom opcodes, even aliased ones. https://3v4l.org/YiCjS/vld#output@Majkl578 commented on GitHub (Apr 12, 2018):
This has already been done in master. :)