misc: handle trailing comma in shaped array declaration #1226
Annotations
12 warnings
Mutation tests
Your workflow is using a version of actions/cache that is scheduled for deprecation, actions/cache@v3.2.5. Please update your workflow to use either v3 or v4 of actions/cache to avoid interruptions. Learn more: https://github.blog/changelog/2024-12-05-notice-of-upcoming-releases-and-breaking-changes-for-github-actions/#actions-cache-v1-v2-and-actions-toolkit-cache-package-closing-down
|
Mutation tests
ubuntu-latest pipelines will use ubuntu-24.04 soon. For more details, see https://github.com/actions/runner-images/issues/10636
|
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/ReflectionAttributesRepository.php#L49
Escaped Mutant for Mutator "UnwrapArrayValues":
--- Original
+++ New
@@ @@
$parentAttributes = Reflection::class($attribute->getName())->getAttributes(AsTransformer::class);
return $parentAttributes !== [];
});
- return array_values(array_map(fn(ReflectionAttribute $attribute) => new AttributeDefinition($this->classDefinitionRepository->for(new NativeClassType($attribute->getName())), array_values($attribute->getArguments())), $attributes));
+ return array_values(array_map(fn(ReflectionAttribute $attribute) => new AttributeDefinition($this->classDefinitionRepository->for(new NativeClassType($attribute->getName())), $attribute->getArguments()), $attributes));
}
/**
* @param ReflectionAttribute<object> $attribute
|
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#L119
Escaped Mutant for Mutator "GreaterThan":
--- Original
+++ New
@@ @@
$this->factories = [TreeMapper::class => fn() => new TypeTreeMapper($this->get(TypeParser::class), $this->get(RootNodeBuilder::class), $settings), ArgumentsMapper::class => fn() => new TypeArgumentsMapper($this->get(FunctionDefinitionRepository::class), $this->get(RootNodeBuilder::class), $settings), RootNodeBuilder::class => fn() => new RootNodeBuilder($this->get(NodeBuilder::class)), NodeBuilder::class => function () use($settings) {
$builder = new TypeNodeBuilder(new ArrayNodeBuilder(), new ListNodeBuilder(), new ShapedArrayNodeBuilder(), new ScalarNodeBuilder(), new UnionNodeBuilder(), new NullNodeBuilder(), new MixedNodeBuilder(), new UndefinedObjectNodeBuilder(), new ObjectNodeBuilder($this->get(ClassDefinitionRepository::class), $this->get(ObjectBuilderFactory::class), $settings->exceptionFilter));
$builder = new InterfaceNodeBuilder($builder, $this->get(ObjectImplementations::class), $this->get(ClassDefinitionRepository::class), new FunctionsContainer($this->get(FunctionDefinitionRepository::class), $settings->customConstructors), $settings->exceptionFilter);
- if (count($settings->valueModifier) > 0) {
+ if (count($settings->valueModifier) >= 0) {
$builder = new ValueAlteringNodeBuilder($builder, new FunctionsContainer($this->get(FunctionDefinitionRepository::class), $settings->valueModifier));
}
return $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#L45
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);
}
|