fix: properly handle array arguments during attributes compilation #1181
Annotations
11 warnings
Mutation tests
The following actions use a deprecated Node.js version and will be forced to run on node20: actions/checkout@v3, actions/cache@v3, actions/[email protected]. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|
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/Reflection/ReflectionClassDefinitionRepository.php#L138
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/Definition/Repository/Reflection/TypeResolver/ParameterTypeResolver.php#L73
Escaped Mutant for Mutator "FalseValue":
--- Original
+++ New
@@ @@
foreach ($annotations as $annotation) {
$tokens = $annotation->filtered();
$dollarSignKey = array_search('$', $tokens, true);
- if ($dollarSignKey === false) {
+ if ($dollarSignKey === true) {
continue;
}
$parameterName = $tokens[$dollarSignKey + 1] ?? null;
|
Mutation tests:
src/Library/Container.php#L136
Escaped Mutant for Mutator "GreaterThan":
--- Original
+++ New
@@ @@
$builder = new InterfaceNodeBuilder($builder, $this->get(ObjectImplementations::class), $this->get(ClassDefinitionRepository::class), new FunctionsContainer($this->get(FunctionDefinitionRepository::class), $settings->customConstructors));
$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);
|
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#L43
Escaped Mutant for Mutator "TrueValue":
--- Original
+++ New
@@ @@
public static function forInterface(Arguments $arguments, Shell $shell) : self
{
$self = new self($arguments);
- $self->forInterface = true;
+ $self->forInterface = false;
if (count($arguments) > 0) {
$self->transform($shell);
}
|
Mutation tests:
src/Mapper/Object/Factory/ConstructorObjectBuilderFactory.php#L131
Escaped Mutant for Mutator "UnwrapArrayValues":
--- Original
+++ New
@@ @@
} elseif ($methods->hasConstructor() && $methods->constructor()->isPublic && (count($builders) === 0 || $methods->constructor()->attributes->has(Constructor::class) || array_key_exists($className, $this->nativeConstructors))) {
$builders[] = new NativeConstructorObjectBuilder($class);
}
- return array_values($builders);
+ return $builders;
}
private function constructorMatches(FunctionObject $function, ObjectType $classType) : bool
{
|