[String] Check if function exists before declaring it#40203
[String] Check if function exists before declaring it#40203nicolas-grekas merged 1 commit intosymfony:5.2from
Conversation
|
I've updated the code to use |
e94abb1 to
cc00e0e
Compare
|
Thank you @Nyholm. |
|
Thank you for merging. |
Ironically, this broke Psalm tests: https://github.com/vimeo/psalm/runs/2037304361#step:7:42 I would suggest to replace if (!\function_exists(u::class)) {with if (!\function_exists(__NAMESPACE__ . '\\u')) { |
|
The current implementation is valid PHP code. I’m not sure what the benefits are to implement to your suggestion. I don’t want to be disrespectful, but this is a problem psalm should fix, isn’t it? |
Clearer code, mostly. I had this little 'huh?' moment looking at it, thinking 'What are those weirdly named classes? And why are they used in
Perhaps. Hardly a high-priority issue though, as in practice it will only happen when people run Psalm with badly written custom autoloader. |
…nt (#5335) These appeared in symfony/symfony#40203
If you installed a command line tool like
psalmwith composer and then try to run it on a project that included the String component you will get an error like:That is because we are loading two installations of the string component.