api-platform / core

@@ -61,13 +61,15 @@
Loading
61 61
62 62
            foreach ($filter->getDescription($resourceClass) as $name => $data) {
63 63
                foreach ($this->validators as $validator) {
64 -
                    $errorList = array_merge($errorList, $validator->validate($name, $data, $queryParameters));
64 +
                    if ($errors = $validator->validate($name, $data, $queryParameters)) {
65 +
                        $errorList[] = $errors;
66 +
                    }
65 67
                }
66 68
            }
67 69
        }
68 70
69 71
        if ($errorList) {
70 -
            throw new FilterValidationException($errorList);
72 +
            throw new FilterValidationException(array_merge(...$errorList));
71 73
        }
72 74
    }
73 75
}

@@ -85,12 +85,13 @@
Loading
85 85
        $resourceMetadataCollection = $this->resourceMetadataCollectionFactory->create($attributes['resource_class']);
86 86
        /** @var HttpOperation $operation */
87 87
        $operation = $resourceMetadataCollection->getOperation($attributes['operation_name'] ?? null);
88 -
        $exceptionToStatus = $operation->getExceptionToStatus() ?: [];
88 +
        $exceptionToStatus = [$operation->getExceptionToStatus() ?: []];
89 +
89 90
        foreach ($resourceMetadataCollection as $resourceMetadata) {
90 -
            /** @var ApiResource $resourceMetadata */
91 -
            $exceptionToStatus = array_merge($exceptionToStatus, $resourceMetadata->getExceptionToStatus() ?: []);
91 +
            /* @var ApiResource $resourceMetadata */
92 +
            $exceptionToStatus[] = $resourceMetadata->getExceptionToStatus() ?: [];
92 93
        }
93 94
94 -
        return $exceptionToStatus;
95 +
        return array_merge(...$exceptionToStatus);
95 96
    }
96 97
}

@@ -198,9 +198,9 @@
Loading
198 198
199 199
        $groups = [];
200 200
        foreach ($serializerClassMetadata->getAttributesMetadata() as $serializerAttributeMetadata) {
201 -
            $groups = array_merge($groups, $serializerAttributeMetadata->getGroups());
201 +
            $groups[] = $serializerAttributeMetadata->getGroups();
202 202
        }
203 203
204 -
        return array_unique($groups);
204 +
        return array_unique(array_merge(...$groups));
205 205
    }
206 206
}

@@ -88,7 +88,7 @@
Loading
88 88
                continue;
89 89
            }
90 90
91 -
            $denormalizedFields[$this->denormalizePropertyName((string) $key, $resourceClass, $context)] = \is_array($fields[$key]) ? $this->replaceIdKeys($fields[$key], $resourceClass, $context) : $value;
91 +
            $denormalizedFields[$this->denormalizePropertyName((string) $key, $resourceClass, $context)] = \is_array($value) ? $this->replaceIdKeys($value, $resourceClass, $context) : $value;
92 92
        }
93 93
94 94
        return $denormalizedFields;

@@ -75,7 +75,8 @@
Loading
75 75
                continue;
76 76
            }
77 77
78 -
            $identifiers[$link->getParameterName()] = $this->getIdentifierValue($item, $link->getFromClass(), $link->getIdentifiers()[0], $link->getParameterName());
78 +
            $parameterName = $link->getParameterName();
79 +
            $identifiers[$parameterName] = $this->getIdentifierValue($item, $link->getFromClass(), $link->getIdentifiers()[0], $parameterName);
79 80
        }
80 81
81 82
        return $identifiers;

@@ -75,10 +75,8 @@
Loading
75 75
                        $path = str_replace(sprintf('{%s}', $parameterName), $expandedValue, $path);
76 76
                    }
77 77
78 -
                    if ($controller = $operation->getController()) {
79 -
                        if (!$this->container->has($controller)) {
80 -
                            throw new RuntimeException(sprintf('There is no builtin action for the "%s" operation. You need to define the controller yourself.', $operationName));
81 -
                        }
78 +
                    if (($controller = $operation->getController()) && !$this->container->has($controller)) {
79 +
                        throw new RuntimeException(sprintf('There is no builtin action for the "%s" operation. You need to define the controller yourself.', $operationName));
82 80
                    }
83 81
84 82
                    $route = new Route(

@@ -156,7 +156,7 @@
Loading
156 156
                throw new BadRequestHttpException('GraphQL multipart request file has not been sent correctly.');
157 157
            }
158 158
159 -
            foreach ($map[$key] as $mapValue) {
159 +
            foreach ($value as $mapValue) {
160 160
                $path = explode('.', (string) $mapValue);
161 161
162 162
                if ('variables' !== $path[0]) {

@@ -53,9 +53,9 @@
Loading
53 53
54 54
            // Instead, we'll look for the first Query available.
55 55
            foreach ($resourceMetadataCollection as $resourceMetadata) {
56 -
                foreach ($resourceMetadata->getGraphQlOperations() as $operation) {
57 -
                    if ($operation instanceof Query) {
58 -
                        $linkedOperation = $operation;
56 +
                foreach ($resourceMetadata->getGraphQlOperations() as $op) {
57 +
                    if ($op instanceof Query) {
58 +
                        $linkedOperation = $op;
59 59
                    }
60 60
                }
61 61
            }

@@ -263,7 +263,7 @@
Loading
263 263
                            throw new RuntimeException(sprintf('Cannot create an instance of %s from serialized data because the variadic parameter %s can only accept an array.', $class, $constructorParameter->name));
264 264
                        }
265 265
266 -
                        $params = array_merge($params, $data[$paramName]);
266 +
                        $params[] = $data[$paramName];
267 267
                    }
268 268
                } elseif ($allowed && !$ignored && (isset($data[$key]) || \array_key_exists($key, $data))) {
269 269
                    $params[] = $this->createConstructorArgument($data[$key], $key, $constructorParameter, $context, $format);
Files Complexity Coverage
src 5,567 90.51%
Project Totals (411 files) 5567 90.51%
behat-php8.1
Build #3050934083 -
behat
phpunit-php8.1
Build #3050934083 -
phpunit
behat-php8.1
Build #3050934083 -
behat

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading