vojtech-dobes/phpstan-php-graphql-server

dev-master 2025-06-05 13:08 UTC

This package is auto-updated.

Last update: 2025-06-05 13:09:00 UTC


README

Checks

This is super-convenient companion if you use vojtech-dobes/php-graphql-server and PHPStan. With this extension, PHPStan will be able to point out:

  • mismatch between GraphQL Schema & what your resolvers actually return
  • mismatch between GraphQL Schema & what your resolvers actually accept as arguments
  • mismatch between declared parent value type and what resolver will actually receive
  • supports utility resolvers like PropertyFieldResolver etc.

Installation

To install the latest version, run the following command:

composer require vojtech-dobes/phpstan-php-graphql-server

Then you can register in your phpstan.neon:

includes:
  - vendor/vojtech-dobes/phpstan-php-graphql-server/extension.neon

graphql:
  generatedDir: "<path to temp directory>"
  schemas:
    - "<path to your Schema file>"

Next you have to tell the extension about your resolvers. If you're using framework integration, use corresponding package:

In case of custom setup, please implement Vojtechdobes\PHPStan\GraphQL\Adapter interface and register like this in phpstan.neon:

services:
  - class: MyCustomAdapter