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 @@ -85,7 +85,6 @@ parameters:
# 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 GraphQL\\\\Type\\\\Definition\\\\Type&GraphQL\\\\Type\\\\Definition\\\\WrappingType and 'getInnermostType' will always evaluate to true\\.#"
- "#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\\.#"
- '#Call to an undefined method Symfony\\Component\\HttpFoundation\\Request::getContentType\(\)\.#'
Expand Down
6 changes: 3 additions & 3 deletions src/GraphQl/Action/EntrypointAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private function parseRequest(Request $request): array
*/
private function parseData(?string $query, ?string $operationName, array $variables, string $jsonContent): array
{
if (!\is_array($data = json_decode($jsonContent, true, 512, \JSON_ERROR_NONE))) {
if (!\is_array($data = json_decode($jsonContent, true))) {
throw new BadRequestHttpException('GraphQL data is not valid JSON.');
}

Expand Down Expand Up @@ -162,7 +162,7 @@ private function parseMultipartRequest(?string $query, ?string $operationName, a
[$query, $operationName, $variables] = $this->parseData($query, $operationName, $variables, $operations);

/** @var string $map */
if (!\is_array($decodedMap = json_decode($map, true, 512, \JSON_ERROR_NONE))) {
if (!\is_array($decodedMap = json_decode($map, true))) {
throw new BadRequestHttpException('GraphQL multipart request map is not valid JSON.');
}

Expand Down Expand Up @@ -218,7 +218,7 @@ private function applyMapToVariables(array $map, array $variables, array $files)
*/
private function decodeVariables(string $variables): array
{
if (!\is_array($decoded = json_decode($variables, true, 512, \JSON_ERROR_NONE))) {
if (!\is_array($decoded = json_decode($variables, true))) {
throw new BadRequestHttpException('GraphQL variables are not valid JSON.');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,13 @@ public function create(string $resourceClass): ResourceMetadataCollection
if ($this->partialPatchValidation && $operation instanceof Patch) {
$rules = $operation->getRules();
if (\is_array($rules)) {
$operation = $operation->withRules($this->replaceRequiredWithSometimes($rules));
$stringKeyedRules = [];
foreach ($rules as $field => $fieldRules) {
if (\is_string($field)) {
$stringKeyedRules[$field] = $fieldRules;
}
}
$operation = $operation->withRules($this->replaceRequiredWithSometimes($stringKeyedRules));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ private function getProperties(string $resourceClass, ?Parameter $parameter = nu
}

if (($filter = $this->getFilterInstance($parameter->getFilter())) && $filter instanceof PropertyAwareFilterInterface) {
if (!method_exists($filter, 'getProperties')) { // @phpstan-ignore-line todo 5.x remove this check
if (!method_exists($filter, 'getProperties')) { // todo 5.x remove this check
trigger_deprecation('api-platform/core', 'In API Platform 5.0 "%s" will implement a method named "getProperties"', PropertyAwareFilterInterface::class);
$refl = new \ReflectionClass($filter);
$filterProperties = $refl->hasProperty('properties') ? $refl->getProperty('properties')->getValue($filter) : [];
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Bundle/Test/ApiTestAssertionsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public static function getMercureMessage(int $index = 0, ?string $hubName = null
public static function assertMercureUpdateMatchesJsonSchema(Update $update, array $topics, array|object|string $jsonSchema = '', bool $private = false, ?string $id = null, ?string $type = null, ?int $retry = null, string $message = ''): void
{
static::assertSame($topics, $update->getTopics(), $message);
static::assertThat(json_decode($update->getData(), true, \JSON_THROW_ON_ERROR), new MatchesJsonSchema($jsonSchema), $message);
static::assertThat(json_decode($update->getData(), true, flags: \JSON_THROW_ON_ERROR), new MatchesJsonSchema($jsonSchema), $message);
static::assertSame($private, $update->isPrivate(), $message);
static::assertSame($id, $update->getId(), $message);
static::assertSame($type, $update->getType(), $message);
Expand Down
Loading