misc: reorganize type resolver services #1069
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#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#L147
Escaped Mutant for Mutator "SpreadRemoval":
--- Original
+++ New
@@ @@
$localAliases = $localTypeAliasResolver->resolveLocalTypeAliases($type);
$importedAliases = $importedTypeAliasResolver->resolveImportedTypeAliases($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/Library/Container.php#L141
Escaped Mutant for Mutator "GreaterThan":
--- Original
+++ New
@@ @@
$builder = new InterfaceNodeBuilder($builder, $this->get(ObjectImplementations::class), $this->get(ClassDefinitionRepository::class), $this->get(ObjectBuilderFactory::class), $this->get(FilteredObjectNodeBuilder::class), new FunctionsContainer($this->get(FunctionDefinitionRepository::class), $settings->customConstructors), $settings->enableFlexibleCasting, $settings->allowSuperfluousKeys);
$builder = new CasterProxyNodeBuilder($builder);
$builder = new IterableNodeBuilder($builder);
- if (count($settings->valueModifier) > 0) {
+ if (count($settings->valueModifier) >= 0) {
$builder = new ValueAlteringNodeBuilder($builder, new FunctionsContainer($this->get(FunctionDefinitionRepository::class), $settings->valueModifier));
}
$builder = new StrictNodeBuilder($builder, $settings->allowPermissiveTypes, $settings->enableFlexibleCasting);
|
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#L42
Escaped Mutant for Mutator "TrueValue":
--- Original
+++ New
@@ @@
public static function forInterface(Arguments $arguments, mixed $value, bool $allowSuperfluousKeys) : self
{
$self = new self($arguments);
- $self->forInterface = true;
+ $self->forInterface = false;
if (count($arguments) > 0) {
$self = $self->transform($value, $allowSuperfluousKeys);
}
|
Mutation tests:
src/Mapper/Object/ArgumentsValues.php#L87
Escaped Mutant for Mutator "CloneRemoval":
--- Original
+++ New
@@ @@
}
private function transform(mixed $value, bool $allowSuperfluousKeys) : self
{
- $clone = clone $this;
+ $clone = $this;
$transformedValue = $this->transformValueForSingleArgument($value, $allowSuperfluousKeys);
if (!is_array($transformedValue)) {
throw new InvalidSource($transformedValue, $this->arguments);
|