slimphp / Slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
http://slimframework.com
MIT License
11.98k stars 1.95k forks source link

php doc issues #1667

Closed mbretter closed 8 years ago

mbretter commented 8 years ago

within the \Slim\Container there are @property-read hints which helps, but they are returning the Interface type not the real one, so some methods are always missing:

@property-read \Psr\Http\Message\ServerRequestInterface request does not show isPut, isGet etc.

@property-read \Slim\Http\Request|\Psr\Http\Message\ServerRequestInterface request would show the additional methods beyond PSR-7 spec to, which would help a lot, atm I have to dig into the source code, to find the additional methods.

mathmarques commented 8 years ago

First see: https://github.com/slimphp/Slim/pull/1654

You can use this in your code:

/* @var \Slim\Interfaces\RouterInterface $router */
$router = $container->get('router');
mbretter commented 8 years ago

sure, but I have to put this everytime into a var and write the phpdoc for it, instead of simply wrinting and geting the code completion: $container->router->whatever

mbretter commented 8 years ago

I could put these docs myself by extending the containert, but Slim\Container has this f*\ final keyword, no chance to make a subclass and put my @property-reads there. academic vs. practical solution

mbretter commented 8 years ago

since the final keyword has been removed, this could be done by inheriting from Container and adding property-reads