File tree Expand file tree Collapse file tree 3 files changed +62
-2
lines changed Expand file tree Collapse file tree 3 files changed +62
-2
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,15 @@ public function enterNode(Node $node): void
128
128
$ node instanceof Node \Stmt \ClassMethod ||
129
129
$ node instanceof Node \Expr \Closure ||
130
130
$ node instanceof Node \Stmt \Trait_) {
131
+ if ($ node instanceof Node \Stmt \Function_ || $ node instanceof Node \Stmt \ClassMethod) {
132
+ foreach ($ node ->getParams () as $ param ) {
133
+ foreach (range ($ param ->getStartLine (), $ param ->getEndLine ()) as $ line ) {
134
+ $ this ->unsets [$ line ] = true ;
135
+ }
136
+ }
137
+ unset($ this ->unsets [$ node ->getEndLine ()]);
138
+ }
139
+
131
140
$ isConcreteClassLike = $ node instanceof Node \Stmt \Enum_ || $ node instanceof Node \Stmt \Class_ || $ node instanceof Node \Stmt \Trait_;
132
141
133
142
if (null !== $ node ->stmts ) {
Original file line number Diff line number Diff line change @@ -32,3 +32,54 @@ interface MyIntersection
32
32
public function check (MyIntOne &MyIntTwo $ intersection );
33
33
public function neverReturn (): never;
34
34
}
35
+
36
+ // New in initializers
37
+ class NewInInit_NoInit
38
+ {
39
+ public function __construct (private DateTimeInterface $ dateTime ) {
40
+ } // +1
41
+ public function noinit (DateTimeInterface $ dateTime ) {
42
+ } // +1
43
+ }
44
+ class NewInInit_OneLineNewLine
45
+ {
46
+ public function __construct (private DateTimeInterface $ dateTime = new DateTime ()) {
47
+ } // +1
48
+ public function onelinenewline (DateTimeInterface $ dateTime = new DateTime ()) {
49
+ } // +2
50
+ }
51
+ class NewInInit_OneLineSameLine
52
+ {
53
+ public function __construct (private DateTimeInterface $ dateTime = new DateTime ()) {} // +2
54
+ public function onelinesameline (DateTimeInterface $ dateTime = new DateTime ()) {} // +1
55
+ }
56
+ class NewInInit_MultiLine
57
+ {
58
+ public function __construct (
59
+ private
60
+ DateTimeInterface
61
+ $ dateTime
62
+ =
63
+ new
64
+ DateTime ()
65
+ ,
66
+ private
67
+ bool
68
+ $ var
69
+ =
70
+ true
71
+ )
72
+ {
73
+ } // +1
74
+ public function multiline (
75
+ DateTimeInterface $ dateTime = new DateTime ()
76
+ ) {
77
+ } // +2
78
+ }
79
+ function newInInit_OneLineNewLine (DateTimeInterface $ dateTime = new DateTime ()) {
80
+ } // +2
81
+ function newInInit_OneLineSameLine (DateTimeInterface $ dateTime = new DateTime ()) {} // +2
82
+ function newInInit_multiline (
83
+ DateTimeInterface $ dateTime = new DateTime ()
84
+ ) {
85
+ } // +1
Original file line number Diff line number Diff line change @@ -28,13 +28,13 @@ public function testExecutableLinesAreGroupedByBranch(): void
28
28
$ this ->doTestSelfDescribingAsset (TEST_FILES_PATH . 'source_for_branched_exec_lines.php ' );
29
29
}
30
30
31
- #[RequiresPhp('8.1.* ' )]
31
+ #[RequiresPhp('>= 8.1 ' )]
32
32
public function testExecutableLinesAreGroupedByBranchPhp81 (): void
33
33
{
34
34
$ this ->doTestSelfDescribingAsset (TEST_FILES_PATH . 'source_for_branched_exec_lines_php81.php ' );
35
35
}
36
36
37
- #[RequiresPhp('8.2.* ' )]
37
+ #[RequiresPhp('>= 8.2 ' )]
38
38
public function testExecutableLinesAreGroupedByBranchPhp82 (): void
39
39
{
40
40
$ this ->doTestSelfDescribingAsset (TEST_FILES_PATH . 'source_for_branched_exec_lines_php82.php ' );
You can’t perform that action at this time.
0 commit comments