Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.12.2] adding {@inheritdoc} breaks phpstan #2879

Closed
jacekkarczmarczyk opened this issue Nov 7, 2019 · 4 comments
Closed

[3.12.2] adding {@inheritdoc} breaks phpstan #2879

jacekkarczmarczyk opened this issue Nov 7, 2019 · 4 comments
Labels

Comments

@jacekkarczmarczyk
Copy link

jacekkarczmarczyk commented Nov 7, 2019

Following change in 3.12.2 breaks the phpstan

https://github.com/slimphp/Slim/compare/3.12.1..3.12.2#diff-0662ca8cf8d9ad2868ffab7a85a61847R21

Not sure if it's a slim regression or phpstan issue, See the relevant report in phpstan repo for more details: phpstan/phpstan#2561

To workaround it in my code I had to change

$request = Slim\Http\Request::createFromEnvironment(Slim\Http\Environment::mock([...]));

to

/** @var Slim\Http\Environment $env */
$env = Slim\Http\Environment::mock([...]);
$request = Slim\Http\Request::createFromEnvironment($env);
@jacekkarczmarczyk
Copy link
Author

Seems like a Slim issue phpstan/phpstan#2561 (comment)

@adriansuter
Copy link
Contributor

Hi @jacekkarczmarczyk

PHPStan does not currently support overriding of @inheritdoc. But as I understand, overriding of @inheritdoc should be allowed, although there is no standard and PSR-5 is still a draft. Hence I think this is not really a Slim issue.

@jacekkarczmarczyk
Copy link
Author

I understand, feel free to close the issue, workaround is fine for me

@adriansuter
Copy link
Contributor

We could also change the phpdoc of \Slim\Interfaces\Http\EnvironmentInterface to return static and remove the override from \Slim\Http\Environment::mock().

interface EnvironmentInterface
{
    /**
     * Create mock environment
     *
     * @param  array $settings Array of custom environment keys and values
     *
     * @return static
     */
    public static function mock(array $settings = []);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants