Skip to content

fix: correctly handle multiline type alias in classes #93

fix: correctly handle multiline type alias in classes

fix: correctly handle multiline type alias in classes #93

Triggered via push September 11, 2023 12:00
Status Success
Total duration 4m 39s
Artifacts
This run and associated checks have been archived and are scheduled for deletion. Learn more about checks retention

mutation.yml

on: push
Fit to window
Zoom out
Zoom in

Annotations

10 warnings
Mutation tests: src/Definition/Repository/Reflection/ReflectionClassDefinitionRepository.php#L133
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#L176
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#L224
Escaped Mutant for Mutator "ArrayItemRemoval": --- Original +++ New @@ @@ } private function typeParser(ClassType $type) : TypeParser { - $specs = [new ClassContextSpecification($type->className()), new AliasSpecification(Reflection::class($type->className()))]; + $specs = [new AliasSpecification(Reflection::class($type->className()))]; if ($type instanceof GenericType) { $specs[] = new TypeAliasAssignerSpecification($type->generics()); }
Mutation tests: src/Definition/Repository/Reflection/ReflectionParameterDefinitionBuilder.php#L36
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, $isOptional, $isVariadic, $defaultValue, $attributes); } }
Mutation tests: src/Definition/Repository/Reflection/ReflectionPropertyDefinitionBuilder.php#L31
Escaped Mutant for Mutator "InstanceOf_": --- Original +++ New @@ @@ $defaultValue = $reflection->getDefaultValue(); $isPublic = $reflection->isPublic(); $attributes = $this->attributesRepository->for($reflection); - 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, $hasDefaultValue, $defaultValue, $isPublic, $attributes);
Mutation tests: src/Definition/Repository/Reflection/ReflectionTypeResolver.php#L45
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#L105
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/Library/Container.php#L132
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(ObjectNodeBuilder::class), $settings->enableFlexibleCasting); $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#L80
Escaped Mutant for Mutator "AssignCoalesce": --- Original +++ New @@ @@ } public function attributes() : Attributes { - return $this->attributes ??= AttributesContainer::empty(); + return $this->attributes = AttributesContainer::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); }