zendframework / zend-expressive-skeleton

Begin developing PSR-7 middleware applications in seconds!
BSD 3-Clause "New" or "Revised" License
136 stars 90 forks source link

typehint $app in routes.php and pipeline.php #154

Closed belgattitude closed 7 years ago

belgattitude commented 7 years ago

Just a tiny addition in config files that helps code completion.

Can be useful to typehint $app in routes.php and pipeline.php like this:

/** @var \Zend\Expressive\Application $app */

I'll make a P/R soon.

belgattitude commented 7 years ago

Side note for people using phpstan.

To prevent phpstan to complain, simply create the phpstan.neon file and add

parameters:
    reportUnmatchedIgnoredErrors: false
    ignoreErrors:
        # For zend-expressive tests, the routes.php and pipeline.php
        # will break with phpstan.
        - '#Undefined variable: \$app#'

and refer it with

$ vendor/bin/phpstan analyse -l 5 -c phpstan.neon src tests
geerteltink commented 7 years ago

Merged with #155 into develop.