diff --git a/phpstan.neon.dist b/phpstan.neon.dist index d12a599c7..be88d756c 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -33,32 +33,6 @@ parameters: path: src/Utils/Utils.php count: 2 - # In PHP 8.2, PHPStan no longer believes @property works without magic methods, - # but all implementors of the interfaces actually have those properties. - - - message: "~Access to an undefined property .*GraphQL\\\\Type\\\\Definition\\\\NamedType.*::\\$name~" - reportUnmatched: false - - - message: "~Access to an undefined property .*GraphQL\\\\Type\\\\Definition\\\\NamedType.*::\\$description~" - reportUnmatched: false - - - message: "~Access to an undefined property .*GraphQL\\\\Type\\\\Definition\\\\NamedType.*::\\$astNode~" - reportUnmatched: false - - - message: "~Access to an undefined property .*GraphQL\\\\Type\\\\Definition\\\\NamedType.*::\\$extensionASTNodes~" - reportUnmatched: false - - - message: "~Access to an undefined property .*GraphQL\\\\Language\\\\AST\\\\TypeDefinitionNode.*::\\$name~" - reportUnmatched: false - - - message: "~Access to an undefined property .*GraphQL\\\\Language\\\\AST\\\\TypeExtensionNode.*::\\$name~" - reportUnmatched: false - - # In PHP 8.2, PHPStan seems to not allow dynamic checks for properties on classes, even when they are not final. - - - message: "~Call to function property_exists\\(\\) with .* will always evaluate to false\\.~" - reportUnmatched: false - # PHPStan does not play nicely with markTestSkipped() - message: "~Unreachable statement - code above always terminates~" path: tests diff --git a/src/Type/Definition/Argument.php b/src/Type/Definition/Argument.php index 136faa55b..27c62abc3 100644 --- a/src/Type/Definition/Argument.php +++ b/src/Type/Definition/Argument.php @@ -108,6 +108,8 @@ public function assertValid(FieldDefinition $parentField, Type $parentType): voi { $error = Utils::isValidNameError($this->name); if ($error !== null) { + assert($parentType instanceof NamedType); + throw new InvariantViolation("{$parentType->name}.{$parentField->name}({$this->name}:) {$error->getMessage()}"); }