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

Reflection error when using Silverstripe 4 #25

Open
jamsea opened this issue Apr 1, 2022 · 1 comment
Open

Reflection error when using Silverstripe 4 #25

jamsea opened this issue Apr 1, 2022 · 1 comment

Comments

@jamsea
Copy link

jamsea commented Apr 1, 2022

I'm trying to get this working with Silverstripe 4 and Visual Studio Code. I went through and followed the guides, made sure to install the shim of phpstan too but I'm still getting this error:

PHP Fatal error:  Declaration of SilbinaryWolf\SilverstripePHPStan\Reflection\MethodClassReflectionExtension::setBroker(PHPStan\Broker\Broker $broker) must be compatible with PHPStan\Reflection\BrokerAwareExtension::setBroker(PHPStan\Broker\Broker $broker): void in /Users/jamsea/git/tinyhouse/vendor/symbiote/silverstripe-phpstan/src/Reflection/MethodClassReflectionExtension.php on line 53


Fatal error: Declaration of SilbinaryWolf\SilverstripePHPStan\Reflection\MethodClassReflectionExtension::setBroker(PHPStan\Broker\Broker $broker) must be compatible with PHPStan\Reflection\BrokerAwareExtension::setBroker(PHPStan\Broker\Broker $broker): void in /Users/jamsea/git/tinyhouse/vendor/symbiote/silverstripe-phpstan/src/Reflection/MethodClassReflectionExtension.php on line 53

# Spawn error
Unexpected token F in JSON at position 1

My phpstan.neon file looks like this:

includes:
    - vendor/symbiote/silverstripe-phpstan/phpstan.neon
parameters:
    level: 5
    paths:
        - app
        - _modules/*/src
        - _modules/*/tests

The require-dev block in composer.json looks like this:

    "require-dev": {
        "squizlabs/php_codesniffer": "3.*",
        "friendsofphp/php-cs-fixer": "*",
        "lekoala/silverstripe-debugbar": "^2.0",
        "symbiote/silverstripe-phpstan": "2.0.0",
        "phpstan/phpstan-shim": "~0.11.0"
    },

Any ideas?

@mleutenegger
Copy link
Contributor

The version of the symbiote/silverstripe-phpstan is incorrect, it should be ^4.0. This is wrongly documented in the readme as it seems.

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

2 participants