Autocomplete of SPL Library Functions

SPL Library Functions are included as part of PHP as standard.

So when I'm typing in something like

$dir = new RecursiveDirectoryIterator

I'd expect autocompletion on RecursiveDirectoryIterator to save me typing it in. but I get nothing and have to type it out long hand.

How do I get PhpStorm to autocomplete function names like this that are specified in the SPL library ??


Hi there,

Could you please be more specific and specify where exactly code completion does not work?

(P.S. This screenshot was taken when I already completed such statement for first time -- that's why required class in on first position)


If I'm working in a project, with lots of other files and autocompletion working fine on everything else like html and css

Within a php code block, I type $dir = new rec

Nothing happens. No autocompletion.


I wonder if there is a comfiguration option or something that has become unset.

Or do I need to link to any External Libraries, Interpreters or Include Paths ???

My external libraries are showing PHP Runtime and within that standard library root.

If I create a brand new dummy project, then create a blank php file and do the same, still no autocompetion for SPL functions like RecursiveDirectoryIterator


1) It's not "SPL functions" -- it's a class

2) Try invoking code completion again (Ctrl+Space would be default shortcut -- otherwise check what you have for "Code | Completion | Basic"). It also did not worked for me from first press. But then it worked just fine.

P.S. I assume that your RecursiveDirectoryIterator (once completed) is not marked with any warnings or errors? And you can Ctrl+Click on it (it should take you to the stub file).


Just in case:

1) Disable all 3rd party plugins (not bundled by default)

2) Try "File | Invalidate Caches..." and restart IDE (that's if my P.S. in previous comment highlights such code)

3) Check idea.log for possible hints (Help | Show Log in XXX)


>If I'm working in a project, with lots of other files and autocompletion working fine on everything else like html and css

>Within a php code block, I type $dir = new rec

>Nothing happens. No autocompletion.

Just to clear things up -- are we talking about actual auto completion (when popup appears automatically) that does not work .. or even manual invocation (e.g. Ctrl+Space) does not work (in other words -- completion popup does not work here at all)?



disabled all plugins, invalidated caches - all did nothing. Can't see anything obvious in the error logs.


Once I type in my RecursiveDirectoryIterator creation code, code completion then works fine on the actual variable (see below).

This is just at the point of typing $dir = new rec (then press ctrl space - yes this is the configured keymap)

There is no code completion for RecursiveDirectoryIterator - either automatically or manually



Thanks for update.


1) If you type "Rec" instead of "rec" -- will it behave the same (no completion)?

2) Does code completion pops up automatically when you type "$dir->" ? Even for "$dir" variable itself?

3) If it does .. then you must be using default settings for code completion (or enabled/disabled it manually later). If so -- is there is anything poping up after you type "new[SPACE]"?

4) Will it behave any differently if you try using it inside the class (e.g. in some method)?

5) In any case -- please show your Code Completion settings --- "Settings/Preferences | Editor | General | Code Completion"

6) You must be using 2016.3.x or newer (based on the fact that you have PHP stubs under External Libraries branch). Have you tried 2017.1 EAP build? If you can try it without importing settings from 2016.3 (happens on first launch) -- will it be any different?

P.S. If you wish we can try TeamViewer session -- maybe I will spot something...



Yes if I type Rec (with a capital R) instead of rec (all lowercase) - code completion works.

That's really frustrating.

especially as once 'Rec' has been typed and the list of available classes is displayed, I can then type 'dir' (in lower case) to filter the list to show just the item I want. Even through Directory has an upper case D.




Screenshot of your settings please (as per my last #5)

That's mine below .. and highlighted option might be your issue (very likely, but not 100% though)


Yes - sorry - missed that.

Set the 'Case sensitive completion" to none and the world is a better place.

Thank you for this.

Frustrating how one little setting can casue so much confusion.


Please sign in to leave a comment.