diff --git a/phpstan.neon.dist b/phpstan.neon.dist index f930e2637c1..c89e42edec1 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -83,7 +83,6 @@ parameters: path: src/GraphQl/Tests/Type/TypesContainerTest.php # Expected, due to backward compatibility - - '#Method GraphQL\\Type\\Definition\\WrappingType::getWrappedType\(\) invoked with 1 parameter, 0 required\.#' - '#Access to an undefined property GraphQL\\Type\\Definition\\NamedType&GraphQL\\Type\\Definition\\Type::\$name\.#' - "#Call to function method_exists\\(\\) with 'Symfony\\\\\\\\Component\\\\\\\\PropertyInfo\\\\\\\\PropertyInfoExtractor' and 'getType' will always evaluate to true\\.#" - "#Call to function method_exists\\(\\) with 'Symfony\\\\\\\\Component\\\\\\\\HttpFoundation\\\\\\\\Request' and 'getContentTypeFormat' will always evaluate to true\\.#" diff --git a/src/GraphQl/Type/FieldsBuilder.php b/src/GraphQl/Type/FieldsBuilder.php index 4d674368723..7f63a2d1ba5 100644 --- a/src/GraphQl/Type/FieldsBuilder.php +++ b/src/GraphQl/Type/FieldsBuilder.php @@ -435,11 +435,7 @@ private function getResourceFieldConfiguration(?string $property, ?string $field $graphqlWrappedType = $graphqlType; if ($graphqlType instanceof WrappingType) { - if (method_exists($graphqlType, 'getInnermostType')) { - $graphqlWrappedType = $graphqlType->getInnermostType(); - } else { - $graphqlWrappedType = $graphqlType->getWrappedType(true); - } + $graphqlWrappedType = $graphqlType->getInnermostType(); } $isStandardGraphqlType = \in_array($graphqlWrappedType, GraphQLType::getStandardTypes(), true); if ($isStandardGraphqlType) { diff --git a/src/Laravel/Tests/Console/DumpMetadataCommandTest.php b/src/Laravel/Tests/Console/DumpMetadataCommandTest.php index 1506bc75c39..c72099dac5f 100644 --- a/src/Laravel/Tests/Console/DumpMetadataCommandTest.php +++ b/src/Laravel/Tests/Console/DumpMetadataCommandTest.php @@ -123,7 +123,7 @@ private function seedCommandModelMetadata(array $attributes, array $relations): } /** - * @param list $classes + * @param list $classes */ private function stubResourceClasses(array $classes): void { @@ -144,7 +144,7 @@ private function runDump(): PendingCommand } /** - * @return array{fingerprint: string, attributes: array, relations: array} + * @return array{fingerprint: string, attributes: array, relations: array} */ private function readDump(): array { @@ -158,6 +158,13 @@ private function readDump(): array $this->fail('The dump file did not contain an array.'); } - return $dumped; + $fingerprint = $dumped['fingerprint'] ?? null; + $attributes = $dumped['attributes'] ?? null; + $relations = $dumped['relations'] ?? null; + if (!\is_string($fingerprint) || !\is_array($attributes) || !\is_array($relations)) { + $this->fail('The dump file did not contain the expected structure.'); + } + + return ['fingerprint' => $fingerprint, 'attributes' => $attributes, 'relations' => $relations]; } } diff --git a/src/Laravel/Tests/Metadata/DumpedMetadataBootTest.php b/src/Laravel/Tests/Metadata/DumpedMetadataBootTest.php index 8267d1f92e2..fb2c9dfda1c 100644 --- a/src/Laravel/Tests/Metadata/DumpedMetadataBootTest.php +++ b/src/Laravel/Tests/Metadata/DumpedMetadataBootTest.php @@ -75,12 +75,12 @@ public function testItWarnsWhenTheDumpFingerprintIsStale(): void { // The canned dump written in setUp() carries no fingerprint, so it never matches the // current migrations and must be reported as stale. - Log::spy(); + Log::shouldReceive('warning') + ->once() + ->withArgs(static fn (string $message): bool => str_contains($message, 'stale')); $this->app->forgetInstance(ModelMetadata::class); $this->app->make(ModelMetadata::class); - - Log::shouldHaveReceived('warning')->withArgs(static fn (string $message): bool => str_contains($message, 'stale'))->once(); } public function testItDoesNotWarnWhenTheFingerprintMatches(): void @@ -91,12 +91,10 @@ public function testItDoesNotWarnWhenTheFingerprintMatches(): void 'relations' => [Book::class => self::CANNED_RELATIONS], ])); - Log::spy(); + Log::shouldReceive('warning')->never(); $this->app->forgetInstance(ModelMetadata::class); $this->app->make(ModelMetadata::class); - - Log::shouldNotHaveReceived('warning'); } public function testItIsNotSeededWhenDebugIsEnabled(): void