Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Does importing a global namespace for methods still work? #8

Open
danon opened this issue Sep 16, 2018 · 1 comment
Open

Does importing a global namespace for methods still work? #8

danon opened this issue Sep 16, 2018 · 1 comment

Comments

@danon
Copy link

danon commented Sep 16, 2018

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?

@Ocramius
Copy link
Member

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.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants