Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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\\.#"
Expand Down
6 changes: 1 addition & 5 deletions src/GraphQl/Type/FieldsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
13 changes: 10 additions & 3 deletions src/Laravel/Tests/Console/DumpMetadataCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private function seedCommandModelMetadata(array $attributes, array $relations):
}

/**
* @param list<class-string> $classes
* @param list<string> $classes
*/
private function stubResourceClasses(array $classes): void
{
Expand All @@ -144,7 +144,7 @@ private function runDump(): PendingCommand
}

/**
* @return array{fingerprint: string, attributes: array<class-string, mixed>, relations: array<class-string, mixed>}
* @return array{fingerprint: string, attributes: array<mixed, mixed>, relations: array<mixed, mixed>}
*/
private function readDump(): array
{
Expand All @@ -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];
}
}
10 changes: 4 additions & 6 deletions src/Laravel/Tests/Metadata/DumpedMetadataBootTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading