1

I always used standard php lib functions without any use statement as this is the right way to do so and I am certain of it. However recently I updated my PhpStorm and now it automatically autocompletes any standard function (like var_dump, array_fill etc) with use. This is an example:

use function array_fill;
use function array_key_exists;
use function var_dump;

$x = array_fill(0, 5, 'a');
var_dump($x);

Is there any reason behind this? Obviously, it works fine with or without these uses.

1 Answer 1

3

Please check your auto import settings for PHP in Settings/Preferences | Editor | General | Auto Import.

In particular -- Enable auto-import from the global namespace option -- looks like it's enabled on your setup.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.