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

phpstan.neon paths not working #202

Open
loic-lopez opened this issue Nov 10, 2018 · 6 comments

Comments

@loic-lopez
Copy link

commented Nov 10, 2018

  • Larastan Version: 0.3.8
  • --level used: max

Description:

Modifying paths in phpstan.neon changes nothing, it always use my app directory and only.

Laravel code where the issue was found:

Bellow my phpstan.neon

includes:
    - ./vendor/nunomaduro/larastan/extension.neon
parameters:
    excludes_analyse:
        - /*/Definitions/*
    level: max
    ignoreErrors:
        - '#Laravel\\Passport\\ClientRepository::createPasswordGrantClient()#'
        - '#Illuminate\\Database\\Query\\Builder::dynamicWhere()#'
    paths:
        - %rootDir%/../../../app
        - %rootDir%/../../../routes
        - %rootDir%/../../../tests
        - %rootDir%/../../../database
@nunomaduro

This comment has been minimized.

Copy link
Owner

commented Nov 11, 2018

Thanks for reporting this. Are you able to debug this and propose a pull request?

@nunomaduro nunomaduro added the bug label Nov 11, 2018

@loic-lopez

This comment has been minimized.

Copy link
Author

commented Nov 13, 2018

Thanks for reply, unfortunately I would not have time to propose a pull request.

@johanvanhelden

This comment has been minimized.

Copy link
Contributor

commented Nov 19, 2018

@loic-lopez

I had the same issue, but with the excludes_analyse option. What I ended up doing was using wildcard characters. Like so:

    excludes_analyse:
        - /*/*/NovaServiceProvider.php

Maybe this would work for you. Not ideal, and diffidently an issue tho. But it works for now.

@staudenmeir

This comment has been minimized.

Copy link
Contributor

commented Dec 2, 2018

AFAICS, you can't specify paths in phpstan.neon when you run Larastan using php artisan code:analyse.

When you don't specify the --paths= option, Larastan will pass the app directory to PHPStan by default. PHPStan will only use the paths parameter from phpstan.neon when Larastan doesn't provide a path (so in this case: never).

The example from the documentation only works in combination with ./vendor/bin/phpstan analyse.

@blackfyre

This comment has been minimized.

Copy link

commented Dec 18, 2018

@staudenmeir Can confirm this behavior!

@nunomaduro

This comment has been minimized.

Copy link
Owner

commented Dec 18, 2018

@staudenmeir @blackfyre Thanks for the input on this folks, fell free to improve this feature adding proposing a Pull Request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.