fix: skip node build for NullType when value is not null #1078
Annotations
4 warnings
Mutation tests
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/checkout@v3, actions/cache@v3, actions/cache@v3.2.5. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
Mutation tests:
src/Mapper/Tree/Builder/UnionNodeBuilder.php#L44
Escaped Mutant for Mutator "InstanceOf_":
--- Original
+++ New
@@ @@
foreach ($type->types() as $subType) {
// Performance optimisation: No need to perform a node build for NullType if the value is not null.
// This speeds up the very common case of nullable types by halving the amount of node build calls.
- if ($subType instanceof NullType && $shell->value() !== null) {
+ if (false && $shell->value() !== null) {
continue;
}
$node = $rootBuilder->build($shell->withType($subType));
|
Mutation tests:
src/Mapper/Tree/Builder/UnionNodeBuilder.php#L44
Escaped Mutant for Mutator "NotIdentical":
--- Original
+++ New
@@ @@
foreach ($type->types() as $subType) {
// Performance optimisation: No need to perform a node build for NullType if the value is not null.
// This speeds up the very common case of nullable types by halving the amount of node build calls.
- if ($subType instanceof NullType && $shell->value() !== null) {
+ if ($subType instanceof NullType && $shell->value() === null) {
continue;
}
$node = $rootBuilder->build($shell->withType($subType));
|
Mutation tests:
src/Mapper/Tree/Builder/UnionNodeBuilder.php#L44
Escaped Mutant for Mutator "LogicalAndAllSubExprNegation":
--- Original
+++ New
@@ @@
foreach ($type->types() as $subType) {
// Performance optimisation: No need to perform a node build for NullType if the value is not null.
// This speeds up the very common case of nullable types by halving the amount of node build calls.
- if ($subType instanceof NullType && $shell->value() !== null) {
+ if (!$subType instanceof NullType && !($shell->value() !== null)) {
continue;
}
$node = $rootBuilder->build($shell->withType($subType));
|