You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected: there's no error for code that imports type SerializableError
Actual:
ERROR: [InvalidTypeImport](https://psalm.dev/233) - 34:25 - Type alias SerializableError imported from ExecutionResult is not defined on the source class
<?php/** * Returned after [query execution](executing-queries.md). * Represents both - result of successful execution and of a failed one * (with errors collected in `errors` prop). * * Could be converted to [spec-compliant](https://facebook.github.io/graphql/#sec-Response-Format) * serializable array using `toArray()`. * * @phpstan-type SerializableError array{ * message: string, * locations?: array<int, array{line: int, column: int}>, * path?: array<int, int|string>, * extensions?: array<string, mixed> * } * @phpstan-type SerializableErrors array<int, SerializableError> * @phpstan-type SerializableResult array{ * data?: array<string, mixed>, * errors?: SerializableErrors, * extensions?: array<string, mixed> * } * @phpstan-type ErrorFormatter callable(\Throwable): SerializableError * @phpstan-type ErrorsHandler callable(array<Error> $errors, ErrorFormatter $formatter): SerializableErrors * * @see \GraphQL\Tests\Executor\ExecutionResultTest */classExecutionResult
{}
/** * @internal * * @phpstan-import-type SerializableError from ExecutionResult */classFoo
{
/** * @return SerializableError */publicfunctionformat(\Throwable$error): array
{
return [
'message' => 'message',
];
}
}
Psalm output (using commit 7428e49):
ERROR: InvalidDocblock - 28:1 - Unexpected space
ERROR: MismatchingDocblockReturnType - 39:17 - Docblock has incorrect return type 'type-alias(ExecutionResult::SerializableError)', should be 'array<array-key, mixed>'
INFO: MixedInferredReturnType - 39:17 - Could not verify return type 'type-alias(ExecutionResult::SerializableError)' for Foo::format
ERROR: InvalidTypeImport - 34:25 - Type alias SerializableError imported from ExecutionResult is not defined on the source class
Phpstan playground https://phpstan.org/r/5da87ef6-9869-40ca-b851-d4edcac82fba
Psalm playground https://psalm.dev/r/22d155399e
Source (exported types): https://github.com/webonyx/graphql-php/blob/29b5b613bd3ee34f227650f856ee8dd4ce151b88/src/Executor/ExecutionResult.php#L9-L34
Expected: there's no error for code that imports type
SerializableError
Actual:
The text was updated successfully, but these errors were encountered: