Skip to content

Instantly share code, notes, and snippets.

@SpacefulSpecies
Created September 22, 2015 17:36
Show Gist options
  • Save SpacefulSpecies/419cc138355769773087 to your computer and use it in GitHub Desktop.
Save SpacefulSpecies/419cc138355769773087 to your computer and use it in GitHub Desktop.
Phpstorm 9.0.2 bug reproduction: Namespaced functions not detected
<?php
namespace Foo;
/**
* @return \DateTime
*/
function getDateTime() {
return new \DateTime();
}
<?php
include __DIR__ . '/functions.php';
echo \Foo\getDateTime()->format('U'); // Warning: Method 'format' not found in class
# When I place the function in the root namespace, the function got recognised
# and I can autocomplete chain on its return value without a problem.
# But when the function is namespaced, PhpStorm 9 will not detect it anymore
# and it will throw an inspection error.
# (I'm sure this worked in PhpStorm 8)
@SpacefulSpecies
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment