Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved mutation score #1221

Merged
merged 14 commits into from
Sep 23, 2022
Merged

Improved mutation score #1221

merged 14 commits into from
Sep 23, 2022

Conversation

kukulich
Copy link
Collaborator

No description provided.

@kukulich kukulich added this to the 6.0.0 milestone Sep 23, 2022
@@ -25,12 +24,12 @@ public function __construct(
IntersectionType $type,
) {
/** @var non-empty-list<ReflectionNamedType> $types */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory not needed? Should be inferred 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERROR: MixedPropertyTypeCoercion - src/Reflection/ReflectionIntersectionType.php:33:24 - $this->types expects 'non-empty-list<Roave\BetterReflection\Reflection\ReflectionNamedType>',  parent type `array<array-key, Roave\BetterReflection\Reflection\ReflectionNamedType>` provided (see https://psalm.dev/196)
        $this->types = $types;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just did an array_map() with a closure with well defined return types, and it failed inference? :O

@@ -28,12 +27,12 @@ public function __construct(
UnionType $type,
) {
/** @var non-empty-list<ReflectionNamedType|ReflectionIntersectionType> $types */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also not be needed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ERROR: MixedPropertyTypeCoercion - src/Reflection/ReflectionUnionType.php:36:24 - $this->types expects 'non-empty-list<Roave\BetterReflection\Reflection\ReflectionIntersectionType|Roave\BetterReflection\Reflection\ReflectionNamedType>',  parent type `array<array-key, Roave\BetterReflection\Reflection\ReflectionIntersectionType|Roave\BetterReflection\Reflection\ReflectionNamedType>` provided (see https://psalm.dev/196)
        $this->types = $types;

);
}

return $parameters;
}

/** @param list<Node\Param> $parameterNodes */
private function isParameterOptional(array $parameterNodes, ParamNode $parameterNode, int $parameterIndex): bool
private function isParameterOptional(array $parameterNodes, int $parameterIndex): bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow, roave/backward-compatibility-check picked up this change:

[BC] CHANGED: The parameter $parameterNode of Roave\BetterReflection\Reflection\ReflectionFunctionAbstract#isParameterOptional() changed from PhpParser\Node\Param to a non-contravariant int
[BC] CHANGED: The parameter $parameterNode of Roave\BetterReflection\Reflection\ReflectionFunctionAbstract#isParameterOptional() changed from PhpParser\Node\Param to int
[BC] CHANGED: Parameter 1 of Roave\BetterReflection\Reflection\ReflectionFunctionAbstract#isParameterOptional() changed name from parameterNode to parameterIndex

Ignoring for now, just an interesting bug though: possibly due to abstract class not having many filters on method visibility analysis.

Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kukulich!

@Ocramius Ocramius marked this pull request as ready for review September 23, 2022 08:44
@Ocramius Ocramius self-assigned this Sep 23, 2022
@Ocramius Ocramius merged commit 45eafbe into Roave:6.0.x Sep 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants