@@ -34,16 +34,23 @@ class MyClass {
34
34
/* testMessyNullableReturnMethod */
35
35
public function myFunction () /* comment
36
36
*/ :
37
- /* comment */ ? //comment
37
+ /* comment */ ? // phpcs:ignore Stnd.Cat.Sniff -- For reasons.
38
38
array {}
39
39
40
40
/* testReturnNamespace */
41
41
function myFunction (): \MyNamespace \MyClass {}
42
42
43
43
/* testReturnMultilineNamespace */
44
+ // Parse error in PHP 8.0.
44
45
function myFunction (): \MyNamespace /** comment *\/ comment */
45
46
\MyClass /* comment */
46
47
\Foo {}
48
+
49
+ /* testReturnUnqualifiedName */
50
+ private function myFunction (): ?MyClass {}
51
+
52
+ /* testReturnPartiallyQualifiedName */
53
+ function myFunction (): Sub \Level \MyClass {}
47
54
}
48
55
49
56
abstract class MyClass
@@ -157,3 +164,27 @@ function pseudoTypeTrue(): ?true {}
157
164
/* testPHP82PseudoTypeFalseAndTrue */
158
165
// Intentional fatal error - Type contains both true and false, bool should be used instead, but that's not the concern of the method.
159
166
function pseudoTypeFalseAndTrue (): true |false {}
167
+
168
+ /* testNotAFunction */
169
+ return true ;
170
+
171
+ /* testPhpcsIssue1264 */
172
+ function foo () : array {
173
+ echo $ foo ;
174
+ }
175
+
176
+ /* testArrowFunctionArrayReturnValue */
177
+ $ fn = fn (): array => [a ($ a , $ b )];
178
+
179
+ /* testArrowFunctionReturnByRef */
180
+ fn &(?string $ a ) : ?string => $ b ;
181
+
182
+ /* testFunctionCallFnPHPCS353-354 */
183
+ $ value = $ obj ->fn (true );
184
+
185
+ /* testFunctionDeclarationNestedInTernaryPHPCS2975 */
186
+ return (!$ a ? [ new class { public function b (): c {} } ] : []);
187
+
188
+ /* testArrowFunctionLiveCoding */
189
+ // Intentional parse error. This has to be the last test in the file.
190
+ $ fn = fn
0 commit comments