Skip to content

Instantly share code, notes, and snippets.

@thexpand
Created September 17, 2018 07:06
Show Gist options
  • Save thexpand/4127a6b04062d7b380cc5577324eeb69 to your computer and use it in GitHub Desktop.
Save thexpand/4127a6b04062d7b380cc5577324eeb69 to your computer and use it in GitHub Desktop.
PSR-11 Autocomplete for 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;
// 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