Refactor ContextualTypeParser #8
check.yml
on: push
check
/
composer
30s
check
/
php-cs-fixer
24s
check
/
infection
28s
Matrix: check / phpstan
Matrix: check / psalm
Matrix: check / test
Annotations
1 error and 10 warnings
|
check / infection
Process completed with exit code 1.
|
|
check / infection:
src/Internal/ContextualTypeParser.php#L85
Escaped Mutant for Mutator "InstanceOf_":
@@ @@
return match (true) {
$node instanceof ConstExprNullNode => nullT,
$node instanceof ConstExprFalseNode => falseT,
- $node instanceof ConstExprTrueNode => trueT,
+ false => trueT,
$node instanceof ConstExprIntegerNode => match (true) {
is_numeric($node->value) => intT($node->value),
default => throw new \LogicException(),
|
|
check / infection:
src/Internal/ContextualTypeParser.php#L84
Escaped Mutant for Mutator "InstanceOf_":
@@ @@
{
return match (true) {
$node instanceof ConstExprNullNode => nullT,
- $node instanceof ConstExprFalseNode => falseT,
+ false => falseT,
$node instanceof ConstExprTrueNode => trueT,
$node instanceof ConstExprIntegerNode => match (true) {
is_numeric($node->value) => intT($node->value),
|
|
check / infection:
src/Internal/ContextualTypeParser.php#L83
Escaped Mutant for Mutator "InstanceOf_":
@@ @@
private static function parseConstExpr(ConstExprNode $node): Type
{
return match (true) {
- $node instanceof ConstExprNullNode => nullT,
+ false => nullT,
$node instanceof ConstExprFalseNode => falseT,
$node instanceof ConstExprTrueNode => trueT,
$node instanceof ConstExprIntegerNode => match (true) {
|
|
check / infection:
src/Internal/ContextualTypeParser.php#L82
Escaped Mutant for Mutator "MatchArmRemoval":
@@ @@
default => throw new \LogicException(),
},
$node instanceof ConstExprStringNode => stringT($node->value),
- default => throw new \LogicException(\sprintf('PhpDoc node %s is not supported', $node::class)),
};
}
/**
|
|
check / infection:
src/Internal/ContextualTypeParser.php#L82
Escaped Mutant for Mutator "MatchArmRemoval":
@@ @@
return match (true) {
$node instanceof ConstExprNullNode => nullT,
$node instanceof ConstExprFalseNode => falseT,
- $node instanceof ConstExprTrueNode => trueT,
$node instanceof ConstExprIntegerNode => match (true) {
is_numeric($node->value) => intT($node->value),
default => throw new \LogicException(),
|
|
check / infection:
src/Internal/ContextualTypeParser.php#L82
Escaped Mutant for Mutator "MatchArmRemoval":
@@ @@
{
return match (true) {
$node instanceof ConstExprNullNode => nullT,
- $node instanceof ConstExprFalseNode => falseT,
$node instanceof ConstExprTrueNode => trueT,
$node instanceof ConstExprIntegerNode => match (true) {
is_numeric($node->value) => intT($node->value),
|
|
check / infection:
src/Internal/ContextualTypeParser.php#L82
Escaped Mutant for Mutator "MatchArmRemoval":
@@ @@
private static function parseConstExpr(ConstExprNode $node): Type
{
return match (true) {
- $node instanceof ConstExprNullNode => nullT,
$node instanceof ConstExprFalseNode => falseT,
$node instanceof ConstExprTrueNode => trueT,
$node instanceof ConstExprIntegerNode => match (true) {
|
|
check / infection:
src/Internal/ContextualTypeParser.php#L76
Escaped Mutant for Mutator "Throw_":
@@ @@
$node instanceof GenericTypeNode => $this->parseIdentifier($node->type->name, $node->genericTypes),
$node instanceof UnionTypeNode => orT(...array_map($this->parseTypeNode(...), $node->types)),
$node instanceof IntersectionTypeNode => andT(...array_map($this->parseTypeNode(...), $node->types)),
- default => throw new \LogicException(\sprintf('`%s` is not supported', $node::class)),
+ default => new \LogicException(\sprintf('`%s` is not supported', $node::class)),
};
}
private static function parseConstExpr(ConstExprNode $node): Type
|
|
check / infection:
src/Internal/ContextualTypeParser.php#L75
Escaped Mutant for Mutator "InstanceOf_":
@@ @@
$node instanceof IdentifierTypeNode => $this->parseIdentifier($node->name),
$node instanceof GenericTypeNode => $this->parseIdentifier($node->type->name, $node->genericTypes),
$node instanceof UnionTypeNode => orT(...array_map($this->parseTypeNode(...), $node->types)),
- $node instanceof IntersectionTypeNode => andT(...array_map($this->parseTypeNode(...), $node->types)),
+ true => andT(...array_map($this->parseTypeNode(...), $node->types)),
default => throw new \LogicException(\sprintf('`%s` is not supported', $node::class)),
};
}
|
|
check / infection:
src/Internal/ContextualTypeParser.php#L69
Escaped Mutant for Mutator "MatchArmRemoval":
@@ @@
$node instanceof GenericTypeNode => $this->parseIdentifier($node->type->name, $node->genericTypes),
$node instanceof UnionTypeNode => orT(...array_map($this->parseTypeNode(...), $node->types)),
$node instanceof IntersectionTypeNode => andT(...array_map($this->parseTypeNode(...), $node->types)),
- default => throw new \LogicException(\sprintf('`%s` is not supported', $node::class)),
};
}
private static function parseConstExpr(ConstExprNode $node): Type
|