feat: allow JSON normalizer to set JSON formatting options #1063
Annotations
11 warnings
Mutation tests
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v3, actions/cache@v3, actions/cache@v3.2.5. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
Mutation tests:
src/Cache/ChainCache.php#L109
Escaped Mutant for Mutator "LogicalAndSingleSubExprNegation":
--- Original
+++ New
@@ @@
{
$saved = true;
foreach ($values as $key => $value) {
- $saved = $this->set($key, $value, $ttl) && $saved;
+ $saved = $this->set($key, $value, $ttl) && !$saved;
}
return $saved;
}
|
Mutation tests:
src/Cache/FileSystemCache.php#L133
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
/** @var FilesystemIterator $file */
foreach (new FilesystemIterator($this->cacheDir) as $file) {
if ($file->getFilename() === '.valinor.tmp') {
- $success = @rmdir($this->cacheDir . DIRECTORY_SEPARATOR . $file->getFilename()) && $success;
+ $success = @rmdir($this->cacheDir . DIRECTORY_SEPARATOR . $file->getFilename()) || $success;
continue;
}
if (!$file->isFile()) {
|
Mutation tests:
src/Cache/FileSystemCache.php#L149
Escaped Mutant for Mutator "LogicalAnd":
--- Original
+++ New
@@ @@
$shouldDeleteRootDir = false;
continue;
}
- $success = @Unlink($this->cacheDir . DIRECTORY_SEPARATOR . $file->getFilename()) && $success;
+ $success = @Unlink($this->cacheDir . DIRECTORY_SEPARATOR . $file->getFilename()) || $success;
}
if ($shouldDeleteRootDir) {
$success = @rmdir($this->cacheDir) && $success;
|
Mutation tests:
src/Cache/FileSystemCache.php#L183
Escaped Mutant for Mutator "LogicalAndSingleSubExprNegation":
--- Original
+++ New
@@ @@
{
$deleted = true;
foreach ($keys as $key) {
- $deleted = $this->delete($key) && $deleted;
+ $deleted = $this->delete($key) && !$deleted;
}
return $deleted;
}
|
Mutation tests:
src/Definition/Repository/Cache/Compiler/AttributesCompiler.php#L64
Escaped Mutant for Mutator "IfNegation":
--- Original
+++ New
@@ @@
}
$argumentsCode = [];
foreach ($arguments as $argument) {
- if (is_object($argument)) {
+ if (!is_object($argument)) {
$argumentsCode[] = 'unserialize(' . var_export(serialize($argument), true) . ')';
} elseif (is_array($argument)) {
$argumentsCode[] = '[' . $this->compileAttributeArguments($argument) . ']';
|
Mutation tests:
src/Definition/Repository/Reflection/ReflectionClassDefinitionRepository.php#L155
Escaped Mutant for Mutator "SpreadRemoval":
--- Original
+++ New
@@ @@
$localAliases = $this->localTypeAliases($type);
$importedAliases = $this->importedTypeAliases($type);
$duplicates = [];
- $keys = [...array_keys($generics), ...array_keys($localAliases), ...array_keys($importedAliases)];
+ $keys = [...array_keys($generics), ...array_keys($localAliases), array_keys($importedAliases)];
foreach ($keys as $key) {
$sameKeys = array_filter($keys, fn($value) => $value === $key);
if (count($sameKeys) > 1) {
|
Mutation tests:
src/Definition/Repository/Reflection/ReflectionClassDefinitionRepository.php#L199
Escaped Mutant for Mutator "UnwrapTrim":
--- Original
+++ New
@@ @@
try {
$types[$name] = $typeParser->parse($raw);
} catch (InvalidType $exception) {
- $raw = trim($raw);
+ $raw = $raw;
$types[$name] = UnresolvableType::forLocalAlias($raw, $name, $type, $exception);
}
}
|
Mutation tests:
src/Definition/Repository/Reflection/ReflectionClassDefinitionRepository.php#L247
Escaped Mutant for Mutator "ArrayItemRemoval":
--- Original
+++ New
@@ @@
}
private function typeParser(ObjectType $type) : TypeParser
{
- $specs = [new ClassContextSpecification($type->className()), new AliasSpecification(Reflection::class($type->className())), new GenericCheckerSpecification()];
+ $specs = [new AliasSpecification(Reflection::class($type->className())), new GenericCheckerSpecification()];
if ($type instanceof GenericType) {
$specs[] = new TypeAliasAssignerSpecification($type->generics());
}
|
Mutation tests:
src/Definition/Repository/Reflection/ReflectionParameterDefinitionBuilder.php#L42
Escaped Mutant for Mutator "InstanceOf_":
--- Original
+++ New
@@ @@
} else {
$defaultValue = null;
}
- if ($isOptional && !$type instanceof UnresolvableType && !$type->accepts($defaultValue)) {
+ if ($isOptional && !false && !$type->accepts($defaultValue)) {
$type = UnresolvableType::forInvalidParameterDefaultValue($signature, $type, $defaultValue);
}
return new ParameterDefinition($name, $signature, $type, $nativeType, $isOptional, $isVariadic, $defaultValue, new Attributes(...$this->attributes($reflection)));
|
Mutation tests:
src/Definition/Repository/Reflection/ReflectionPropertyDefinitionBuilder.php#L37
Escaped Mutant for Mutator "InstanceOf_":
--- Original
+++ New
@@ @@
$hasDefaultValue = $this->hasDefaultValue($reflection, $type);
$defaultValue = $reflection->getDefaultValue();
$isPublic = $reflection->isPublic();
- if ($hasDefaultValue && !$type instanceof UnresolvableType && !$type->accepts($defaultValue)) {
+ if ($hasDefaultValue && !false && !$type->accepts($defaultValue)) {
$type = UnresolvableType::forInvalidPropertyDefaultValue($signature, $type, $defaultValue);
}
return new PropertyDefinition($name, $signature, $type, $nativeType, $hasDefaultValue, $defaultValue, $isPublic, new Attributes(...$this->attributes($reflection)));
|