Skip to content

Commit 05c5367

Browse files
committed
test(TypeHints): Add test case for SlevomatCodingStandard.TypeHints.NullableTypeForNullDefaultValue (#3471146)
1 parent cddb4b8 commit 05c5367

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

tests/Drupal/bad/BadUnitTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ protected function getErrorList(string $testFile): array
383383
838 => 1,
384384
849 => 2,
385385
860 => 2,
386-
864 => 2,
386+
867 => 1,
387+
871 => 2,
387388
];
388389
}//end switch
389390

tests/Drupal/bad/bad.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -861,4 +861,11 @@ function test29(
861861
echo "Hello";
862862
}
863863

864+
/**
865+
* Nullable types should be annotated.
866+
*/
867+
function test30(TestType $a = NULL) {
868+
echo "Hello";
869+
}
870+
864871
?>

tests/Drupal/bad/bad.php.fixed

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -915,3 +915,10 @@ function test29(
915915
) {
916916
echo "Hello";
917917
}
918+
919+
/**
920+
* Nullable types should be annotated.
921+
*/
922+
function test30(?TestType $a = NULL) {
923+
echo "Hello";
924+
}

0 commit comments

Comments
 (0)