Skip to content

Commit 2055dd5

Browse files
committed
Add some extra test cases
1 parent 417e95c commit 2055dd5

File tree

2 files changed

+39
-12
lines changed

2 files changed

+39
-12
lines changed

tests/expected.log

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,33 @@ PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
3030

3131
FILE: tests/incorrect/type-hints.php
3232
------------------------------------------------------------------------------------------------------------------------
33-
FOUND 13 ERRORS AFFECTING 10 LINES
33+
FOUND 17 ERRORS AFFECTING 14 LINES
3434
------------------------------------------------------------------------------------------------------------------------
3535
9 | ERROR | [x] Function doesNotNeedDocumentationComment() does not need documentation comment.
3636
16 | ERROR | [x] Function uselessReturnAnnotation() has useless @return annotation.
3737
23 | ERROR | [x] Function uselessParamAnnotation() has useless @param annotation for parameter $string.
38-
32 | ERROR | [x] There must be no whitespace between parameter type hint nullability symbol and parameter type hint of
38+
35 | ERROR | [x] Function uselessAnnotationsWithUsefulComment() has useless @param annotation for parameter $string.
39+
37 | ERROR | [x] Function uselessAnnotationsWithUsefulComment() has useless @return annotation.
40+
46 | ERROR | [x] Function uselessAnnotationsWithUsefulAnnotation() has useless @param annotation for parameter
41+
| | $string.
42+
48 | ERROR | [x] Function uselessAnnotationsWithUsefulAnnotation() has useless @return annotation.
43+
54 | ERROR | [x] There must be no whitespace between parameter type hint nullability symbol and parameter type hint of
3944
| | parameter $input.
40-
36 | ERROR | [x] There must be exactly one space between return type hint colon and return type hint.
41-
36 | ERROR | [x] There must be no whitespace between closing parenthesis and return type colon.
42-
40 | ERROR | [ ] Function missingTypeHints() does not have parameter type hint nor @param annotation for its parameter
45+
58 | ERROR | [x] There must be exactly one space between return type hint colon and return type hint.
46+
58 | ERROR | [x] There must be no whitespace between closing parenthesis and return type colon.
47+
62 | ERROR | [ ] Function missingTypeHints() does not have parameter type hint nor @param annotation for its parameter
4348
| | $input.
44-
40 | ERROR | [ ] Function missingTypeHints() does not have return type hint nor @return annotation for its return
49+
62 | ERROR | [ ] Function missingTypeHints() does not have return type hint nor @return annotation for its return
4550
| | value.
46-
45 | ERROR | [ ] Function missingTraversableAnnotations() does not have @param annotation for its traversable
51+
67 | ERROR | [ ] Function missingTraversableAnnotations() does not have @param annotation for its traversable
4752
| | parameter $input.
48-
45 | ERROR | [ ] Function missingTraversableAnnotations() does not have @return annotation for its traversable return
53+
67 | ERROR | [ ] Function missingTraversableAnnotations() does not have @return annotation for its traversable return
4954
| | value.
50-
49 | ERROR | [x] Parameter $input has null default value, but is not marked as nullable.
51-
54 | ERROR | [x] Expected "int" but found "integer" in @param annotation.
52-
56 | ERROR | [x] Expected "bool" but found "boolean" in @return annotation.
55+
71 | ERROR | [x] Parameter $input has null default value, but is not marked as nullable.
56+
76 | ERROR | [x] Expected "int" but found "integer" in @param annotation.
57+
78 | ERROR | [x] Expected "bool" but found "boolean" in @return annotation.
5358
------------------------------------------------------------------------------------------------------------------------
54-
PHPCBF CAN FIX THE 9 MARKED SNIFF VIOLATIONS AUTOMATICALLY
59+
PHPCBF CAN FIX THE 13 MARKED SNIFF VIOLATIONS AUTOMATICALLY
5560
------------------------------------------------------------------------------------------------------------------------
5661

5762

tests/incorrect/type-hints.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,28 @@ function uselessParamAnnotation(string $string, array $numbers): array
2929
{
3030
}
3131

32+
/**
33+
* This is a useful comment that should be kept
34+
*
35+
* @param string $string
36+
*
37+
* @return void
38+
*/
39+
function uselessAnnotationsWithUsefulComment(string $string): void
40+
{
41+
}
42+
43+
/**
44+
* @whatever
45+
*
46+
* @param string $string
47+
*
48+
* @return void
49+
*/
50+
function uselessAnnotationsWithUsefulAnnotation(string $string): void
51+
{
52+
}
53+
3254
function wrongNullabilitySymbolSpacing(? string $input): string
3355
{
3456
}

0 commit comments

Comments
 (0)