Skip to content

Commit

Permalink
test(TypeHints): Add test case for SlevomatCodingStandard.TypeHints.N…
Browse files Browse the repository at this point in the history
…ullableTypeForNullDefaultValue (#3471146)
  • Loading branch information
klausi committed Sep 22, 2024
1 parent cddb4b8 commit 05c5367
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/Drupal/bad/BadUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,8 @@ protected function getErrorList(string $testFile): array
838 => 1,
849 => 2,
860 => 2,
864 => 2,
867 => 1,
871 => 2,
];
}//end switch

Expand Down
7 changes: 7 additions & 0 deletions tests/Drupal/bad/bad.php
Original file line number Diff line number Diff line change
Expand Up @@ -861,4 +861,11 @@ function test29(
echo "Hello";
}

/**
* Nullable types should be annotated.
*/
function test30(TestType $a = NULL) {
echo "Hello";
}

?>
7 changes: 7 additions & 0 deletions tests/Drupal/bad/bad.php.fixed
Original file line number Diff line number Diff line change
Expand Up @@ -915,3 +915,10 @@ function test29(
) {
echo "Hello";
}

/**
* Nullable types should be annotated.
*/
function test30(?TestType $a = NULL) {
echo "Hello";
}

0 comments on commit 05c5367

Please sign in to comment.