FunctionFQNReplacer icon indicating copy to clipboard operation
FunctionFQNReplacer copied to clipboard

Does importing a global namespace for methods still work?

Open danon opened this issue 7 years ago • 1 comments

I can see why this

namespace App;

if (\is_string($s))

is supposed to work faster then this

namespace App;

if (is_string($s))

but I was wondering if, without changing your code much, one could import a function from global namespace like so

namespace App;

use function is_string;

if (is_string($s))

...and still benefit from improved performance?

danon avatar Sep 16 '18 15:09 danon

Yes, that would still work and is the preferred approach: doctrine/coding-standard doea that for you (automatically), so if you want to suggest that instead of this package, please feel free to submit a patch to the README of this repository.

Ocramius avatar Sep 16 '18 15:09 Ocramius