Created
September 17, 2018 07:06
-
-
Save thexpand/4127a6b04062d7b380cc5577324eeb69 to your computer and use it in GitHub Desktop.
PSR-11 Autocomplete for PhpStorm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
// Old Interop\Container\ContainerInterface | |
override(InteropContainerInterface::get(0), | |
map([ | |
'' => '@', | |
]) | |
); | |
// PSR-11 Container Interface | |
override(PsrContainerInterface::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