Skip to content

Commit 3179ad7

Browse files
authored
Merge pull request #221 from PHPCSStandards/feature/file-getmemberproperties-improve-tests
File::getMemberProperties(): improve tests
2 parents fad8ffe + fcc764b commit 3179ad7

File tree

2 files changed

+479
-237
lines changed

2 files changed

+479
-237
lines changed

tests/Core/File/GetMemberPropertiesTest.inc

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ class TestMemberProperties
3939
var static $varG = true;
4040

4141
/* testPublicStatic */
42-
public static $varH = true;
42+
public // comment
43+
// phpcs:ignore Stnd.Cat.Sniff -- For reasons.
44+
static
45+
$varH = true;
4346

4447
/* testProtectedStatic */
4548
static protected $varI = true;
@@ -245,7 +248,7 @@ $anon = class() {
245248
public readonly int $readonly;
246249

247250
/* testPHP81ReadonlyWithNullableType */
248-
public readonly ?array $array;
251+
public readonly ?array $readonlyWithNullableType;
249252

250253
/* testPHP81ReadonlyWithUnionType */
251254
public readonly string|int $readonlyWithUnionType;
@@ -255,6 +258,16 @@ $anon = class() {
255258

256259
/* testPHP81OnlyReadonlyWithUnionType */
257260
readonly string|int $onlyReadonly;
261+
262+
/* testPHP81OnlyReadonlyWithUnionTypeMultiple */
263+
readonly \InterfaceA|\Sub\InterfaceB|false
264+
$onlyReadonly;
265+
266+
/* testPHP81ReadonlyAndStatic */
267+
readonly private static ?string $readonlyAndStatic;
268+
269+
/* testPHP81ReadonlyMixedCase */
270+
public ReadONLY static $readonlyMixedCase;
258271
};
259272

260273
$anon = class {
@@ -318,3 +331,11 @@ $anon = class() {
318331
// Intentional fatal error - Type contains both true and false, bool should be used instead, but that's not the concern of the method.
319332
readonly true|FALSE $pseudoTypeFalseAndTrue;
320333
};
334+
335+
class WhitespaceAndCommentsInTypes {
336+
/* testUnionTypeWithWhitespaceAndComment */
337+
public int | /*comment*/ string $hasWhitespaceAndComment;
338+
339+
/* testIntersectionTypeWithWhitespaceAndComment */
340+
public \Foo /*comment*/ & Bar $hasWhitespaceAndComment;
341+
}

0 commit comments

Comments
 (0)