I have a module Decoupled Passkeys that adds JSON-RPC module endpoints, so it depends on JSON-RPC.
When I run tests with a custom phpstan.neon
, I'm getting a lot of errors because phpstan cannot find the JSON-RPC module:
130 Call to static method internalError() on an unknown class
Drupal\jsonrpc\Object\Error.
💡 Learn more at https://phpstan.org/user-guide/discovering-symbols
Here's a failed pipeline.
The JSON-RPC module is required in composer.json
:
{
"name": "drupal/decoupled_passkeys",
"description": "Enables passkey login/registration via JSON:RPC and Webauthn.",
"type": "drupal-module",
"require": {
"php": ">=8.2",
"ext-json": "*",
"drupal/jsonrpc": "^2",
"drupal/public_key_credential_source": "^1.0@alpha"
},
The phpstan.neon
looks like this:
parameters:
checkGenericClassInNonGenericObjectType: false
# Sometimes Drupal gets it wrong.
treatPhpDocTypesAsCertain: false
level: 9
ignoreErrors:
# Drupal does not define its own arrays.
- '#no value type specified in iterable type array#'
- '#no value type specified in iterable type Drupal\\Core\\Field\\FieldItemListInterface#'
# Level 9 has lots of annoying offset errors.
- '#Cannot access offset#'
When running phpstan from Gitlab CI via Drupal.org, how do I tell phpstan where the dependent modules are installed? I don't want to check the dependencies for errors with phpstan, but I need phpstan to be able to access the classes in the dependencies to see what is being extended.