TomasVotruba / bladestan

PHPStan analysis for Blade templates
https://tomasvotruba.com/blog/introducing-bladestan-phpstan-analysis-of-blade-templates/
MIT License
286 stars 13 forks source link

Invalid configuration #34

Closed paddockDev closed 1 year ago

paddockDev commented 1 year ago

Based on the fact that I already use Larastan in my projects, I wanted to try bladestan in addition. Unfortunately, however, I make the experience, no matter how I configure phpstan.neon, I am always told invalid configuration.

Invalid configuration:
Unexpected item 'parameters › bladestan'.

I tried it together with larastan configuration, but also just took out that configuration and wanted to run the bladestan configuration alone.

TomasVotruba commented 1 year ago

Could you share minimal reproducer? I suspect missing phpstan extension-installler

paddockDev commented 1 year ago

For example, my larastan configuration looks like this

includes:
    - ./vendor/nunomaduro/larastan/extension.neon

parameters:

    paths:
        - app

    level: 8

    ignoreErrors:

    checkMissingIterableValueType: false

    checkModelProperties: true

    checkGenericClassInNonGenericObjectType: false

According to my understanding, if I want to run both bladestan and larastan through phpstan.neon, then the configuartion should look like this.

includes:
    - ./vendor/nunomaduro/larastan/extension.neon

parameters:
    bladestan:
        template_paths:
            # default
            - resources/views

    paths:
        - app

    level: 8

    ignoreErrors:

    checkMissingIterableValueType: false

    checkModelProperties: true

    checkGenericClassInNonGenericObjectType: false

But even with your example of configuration alone I get the above error

cpfpolkehn commented 1 year ago

just another example of a config that causes the error mentioned above:

includes:
    - ./vendor/nunomaduro/larastan/extension.neon
    - ./vendor/phpstan/phpstan-mockery/extension.neon
    - ./vendor/timeweb/phpstan-enum/extension.neon

parameters:
    reportUnmatchedIgnoredErrors: false
    checkGenericClassInNonGenericObjectType: false

    universalObjectCratesClasses:
        - Webwizo\Shortcodes\Compilers\Shortcode
        - Juanparati\Trustpilot\API\BusinessUnit\Review\Review

    bladestan:
        template_paths:
            - resources/views

    paths:
        - app
        - public
        - config
        - database
        - resources
        - routes
        - tests

    # The level 9 is the highest level
    level: 8

    ignoreErrors:
        - '#PHPDoc tag @mixin contains unknown class Eloquent.#'
        - '#Call to static method has(Table|Column)\(\) on an unknown class (DB|Schema)#'
        - '#Call to static method (create|table|dropIfExists)\(\) on an unknown class (DB|Schema).#'
        - '#Unsafe usage of new static#'
        - "#^Call to an undefined method Pest\\\\Expectation\\|Pest\\\\Support\\\\Extendable\\:\\:toBe\\(\\)\\.#"
        - "#orWhereTranslationLike#"
        - "#Call to an undefined static method Illuminate\\\\Support\\\\Facades\\\\Route::(singleton|module)\\(\\)#"
        - "#Call to an undefined method Illuminate\\\\Database\\\\Eloquent\\\\Builder<A17\\\\Twill\\\\Models\\\\Model>::orderByTranslation\\(\\).#"

    excludePaths:
        - %rootDir%/../../../app/Hooks
        - %rootDir%/../../../database/factories
        - %rootDir%/../../../routes/console.php
        - %rootDir%/../../../server.php
        - %rootDir%/../../../config/insights.php
        - %rootDir%/../../../vendor
        - %rootDir%/../../../tests/Unit/
        - %rootDir%/../../../tests/Component/
        - %rootDir%/../../../database/migrations
        - %rootDir%/../../../app/Providers/AuthServiceProvider.php

    checkMissingIterableValueType: false
TomasVotruba commented 1 year ago

Add this package https://github.com/phpstan/extension-installer