Skip to content

Commit c775cbb

Browse files
committed
minor #4589 PhpdocToReturnType - Add support for Foo[][] (SpacePossum)
This PR was merged into the 2.15 branch. Discussion ---------- PhpdocToReturnType - Add support for Foo[][] fixes point two of #4511 backport of fixes done in #4583 by @jg-development , thanks! Commits ------- 35e96ed PhpdocToReturnType - Add support for Foo[][].
2 parents d731065 + 35e96ed commit c775cbb

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/DocBlock/Annotation.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Annotation
3636
(?<types>
3737
(?<type>
3838
(?<array>
39-
(?&simple)\[\]
39+
(?&simple)(\[\])*
4040
)
4141
|
4242
(?<simple>

tests/DocBlock/AnnotationTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ public function provideTypeParsingCases()
233233
' * @method int method()',
234234
['int'],
235235
],
236+
[
237+
' * @method Foo[][] method()',
238+
['Foo[][]'],
239+
],
236240
[
237241
' * @method int[] method()',
238242
['int[]'],

tests/Fixer/FunctionNotation/PhpdocToReturnTypeFixerTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,10 @@ class Foo {
217217
'<?php /** @return Foo[] */ function my_foo(): array {}',
218218
'<?php /** @return Foo[] */ function my_foo() {}',
219219
],
220-
'skip array of array of types' => [
220+
'array of array of types' => [
221+
'<?php /** @return Foo[][] */ function my_foo(): array {}',
221222
'<?php /** @return Foo[][] */ function my_foo() {}',
223+
70000,
222224
],
223225
'nullable array of types' => [
224226
'<?php /** @return null|Foo[] */ function my_foo(): ?array {}',

0 commit comments

Comments
 (0)