Skip to content

Commit

Permalink
Merge pull request #221 from PHPCSStandards/feature/file-getmemberpro…
Browse files Browse the repository at this point in the history
…perties-improve-tests

File::getMemberProperties(): improve tests
  • Loading branch information
jrfnl authored Jan 2, 2024
2 parents fad8ffe + fcc764b commit 3179ad7
Show file tree
Hide file tree
Showing 2 changed files with 479 additions and 237 deletions.
25 changes: 23 additions & 2 deletions tests/Core/File/GetMemberPropertiesTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ class TestMemberProperties
var static $varG = true;

/* testPublicStatic */
public static $varH = true;
public // comment
// phpcs:ignore Stnd.Cat.Sniff -- For reasons.
static
$varH = true;

/* testProtectedStatic */
static protected $varI = true;
Expand Down Expand Up @@ -245,7 +248,7 @@ $anon = class() {
public readonly int $readonly;

/* testPHP81ReadonlyWithNullableType */
public readonly ?array $array;
public readonly ?array $readonlyWithNullableType;

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

/* testPHP81OnlyReadonlyWithUnionType */
readonly string|int $onlyReadonly;

/* testPHP81OnlyReadonlyWithUnionTypeMultiple */
readonly \InterfaceA|\Sub\InterfaceB|false
$onlyReadonly;

/* testPHP81ReadonlyAndStatic */
readonly private static ?string $readonlyAndStatic;

/* testPHP81ReadonlyMixedCase */
public ReadONLY static $readonlyMixedCase;
};

$anon = class {
Expand Down Expand Up @@ -318,3 +331,11 @@ $anon = class() {
// Intentional fatal error - Type contains both true and false, bool should be used instead, but that's not the concern of the method.
readonly true|FALSE $pseudoTypeFalseAndTrue;
};

class WhitespaceAndCommentsInTypes {
/* testUnionTypeWithWhitespaceAndComment */
public int | /*comment*/ string $hasWhitespaceAndComment;

/* testIntersectionTypeWithWhitespaceAndComment */
public \Foo /*comment*/ & Bar $hasWhitespaceAndComment;
}
Loading

0 comments on commit 3179ad7

Please sign in to comment.