misc: refactor file system cache to improve performance #98
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/[email protected]. 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#L170
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#L192
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/ReflectionTypeResolver.php#L47
Escaped Mutant for Mutator "InstanceOf_":
--- Original
+++ New
@@ @@
if (!$typeFromDocBlock) {
return $nativeType;
}
- if (!$typeFromDocBlock instanceof UnresolvableType && !$nativeType instanceof UnresolvableType && !$typeFromDocBlock->matches($nativeType)) {
+ if (!false && !$nativeType instanceof UnresolvableType && !$typeFromDocBlock->matches($nativeType)) {
throw new TypesDoNotMatch($reflection, $typeFromDocBlock, $nativeType);
}
return $typeFromDocBlock;
|
Mutation tests:
src/Definition/Repository/Reflection/ReflectionTypeResolver.php#L106
Escaped Mutant for Mutator "UnwrapTrim":
--- Original
+++ New
@@ @@
try {
return $parser->parse($raw);
} catch (InvalidType $exception) {
- $raw = trim($raw);
+ $raw = $raw;
$signature = Reflection::signature($reflection);
if ($reflection instanceof ReflectionProperty) {
return UnresolvableType::forProperty($raw, $signature, $exception);
|
Mutation tests:
src/Mapper/Object/Argument.php#L79
Escaped Mutant for Mutator "AssignCoalesce":
--- Original
+++ New
@@ @@
}
public function attributes() : Attributes
{
- return $this->attributes ??= Attributes::empty();
+ return $this->attributes = Attributes::empty();
}
}
|
Mutation tests:
src/Mapper/Object/ArgumentsValues.php#L41
Escaped Mutant for Mutator "TrueValue":
--- Original
+++ New
@@ @@
public static function forInterface(Arguments $arguments, mixed $value) : self
{
$self = new self($arguments);
- $self->forInterface = true;
+ $self->forInterface = false;
if (count($arguments) > 0) {
$self = $self->transform($value);
}
|
Mutation tests:
src/Mapper/Object/ArgumentsValues.php#L86
Escaped Mutant for Mutator "CloneRemoval":
--- Original
+++ New
@@ @@
}
private function transform(mixed $value) : self
{
- $clone = clone $this;
+ $clone = $this;
$transformedValue = $this->transformValueForSingleArgument($value);
if (!is_array($transformedValue)) {
throw new InvalidSource($transformedValue, $this->arguments);
|
Mutation tests:
src/Mapper/Object/Factory/ConstructorObjectBuilderFactory.php#L146
Escaped Mutant for Mutator "Continue_":
--- Original
+++ New
@@ @@
foreach ($this->constructors as $constructor) {
$function = $constructor->definition;
if (enum_exists($function->class ?? '') && in_array($function->name, ['from', 'tryFrom'], true)) {
- continue;
+ break;
}
if (!$function->returnType instanceof ObjectType) {
throw new InvalidConstructorReturnType($function);
|