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

Unexpected item 'parameters › type_coverage'. #10

Closed
michaelzangerle opened this issue Jan 26, 2023 · 6 comments
Closed

Unexpected item 'parameters › type_coverage'. #10

michaelzangerle opened this issue Jan 26, 2023 · 6 comments

Comments

@michaelzangerle
Copy link

I am trying to set it up but ran into the following error

Unexpected item 'parameters › type_coverage'.
phpstan/phpdoc-parser        1.14.0 PHPDoc parser with support for nullable, intersection and generic types
phpstan/phpstan              1.9.14 PHPStan - PHP Static Analysis Tool
phpstan/phpstan-doctrine     1.3.23 Doctrine extensions for PHPStan
phpstan/phpstan-phpunit      1.2.2  PHPUnit extensions and rules for PHPStan
phpstan/phpstan-strict-rules 1.4.4  Extra strict and opinionated rules for PHPStan
phpstan/phpstan-symfony      1.2.16 Symfony Framework extensions and rules for PHPStan
tomasvotruba/type-coverage 0.0.9 Measure type coverage of your project
php 8.1.14
parameters:
    level: 8
    paths:
        - src
        - tests
    excludePaths:
        - tests/bootstrap.php
        - config/bootstrap.php
    symfony:
        container_xml_path: 'var/cache/dev/App_KernelDevDebugContainer.xml'
    scanDirectories:
        - var/cache/dev/Symfony/Config
    type_coverage:
        return_type: 50
        param_type: 30
        property_type: 70
        print_suggestions: false

includes:
    - vendor/phpstan/phpstan-doctrine/extension.neon
    - vendor/phpstan/phpstan-symfony/extension.neon
    - vendor/phpstan/phpstan-symfony/rules.neon
    - vendor/phpstan/phpstan-strict-rules/rules.neon
    - vendor/phpstan/phpstan-phpunit/extension.neon

I just ran the composer command + added the config in the readme to phpstan.neon. Did I miss something when installing / configuring it? 🤔

@TomasVotruba
Copy link
Owner

Hi, do you have phpstan extension installer installed?

@michaelzangerle
Copy link
Author

Hey @TomasVotruba. I don't know how I miss that something like https://github.com/phpstan/extension-installer exists in the first place but I guess that also explains why the line where you mention it in the readme didn't trigger me 🙈

In case somebody else stumbles upon this: You can alternatively also solve this by adding the following line to your includes section in your phpstan.neon file:

includes:
    - vendor/tomasvotruba/type-coverage/config/extension.neon

Thank you Tomas 🙏

@scollovati
Copy link

Even if I have installed phpstan/extension-installer before this extension I still need to include that file.

Instead if I install PHPStan, PHPStan Extension installer and then this extension globally the issue does not arise.

@TomasVotruba
Copy link
Owner

TomasVotruba commented Sep 8, 2023

Sometimes I have similar glitches.

Running composer install usually helps, as only composer install triggers the extensions in some cases.

@scollovati
Copy link

scollovati commented Sep 8, 2023

Thanks Tomas. It's a subtle issue of https://github.com/phpstan/extension-installer as referenced here phpstan/extension-installer#76 (comment) and here phpstan/extension-installer#65

It seems that if you have the installer installed globally and locally, the second one does not find the extensions locally. Very strange.

@TomasVotruba
Copy link
Owner

I see. I had similar issues with other dev packages, so I stopped using global scope. It also makes the project vendor locked to your local setup.

Also this leads to version conflicts.

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

No branches or pull requests

3 participants