Skip to content

Instantly share code, notes, and snippets.

@carnage
Created September 28, 2017 11:34
Show Gist options
  • Save carnage/1eda22a154554f3c2df6dcb5e4bf14d5 to your computer and use it in GitHub Desktop.
Save carnage/1eda22a154554f3c2df6dcb5e4bf14d5 to your computer and use it in GitHub Desktop.
ZF2 autocomplete in phpstorm
<?php
/**
* PhpStorm code completion
*
* Add code completion for PSR-11 Container Interface and more...
*/
namespace PHPSTORM_META {
use Interop\Container\ContainerInterface as InteropContainerInterface;
use Psr\Container\ContainerInterface as PsrContainerInterface;
use Psr\Http\Message\ServerRequestInterface;
use PSR7Session\Http\SessionMiddleware;
use PSR7Session\Session\SessionInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
// Old Interop\Container\ContainerInterface
override(InteropContainerInterface::get(0),
map([
'' => '@',
])
);
// PSR-11 Container Interface
override(PsrContainerInterface::get(0),
map([
'' => '@',
])
);
// Zend ServiceLocatorInterface
override(ServiceLocatorInterface::get(0),
map([
'' => '@',
])
);
// PSR-7 requests attributes; e.g. PSR-7 Storage-less HTTP Session
override(ServerRequestInterface::getAttribute(0),
map([
SessionMiddleware::SESSION_ATTRIBUTE instanceof SessionInterface,
])
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment