Skip to content

Commit

Permalink
File::getMemberProperties(): add tests with PHP 8 "mixed" property type
Browse files Browse the repository at this point in the history
No changes needed to the actual method, the property type is already handled correctly.
  • Loading branch information
jrfnl committed Jul 15, 2020
1 parent 17b2c66 commit 6d6b0eb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/Core/File/GetMemberPropertiesTest.inc
Original file line number Diff line number Diff line change
Expand Up @@ -179,3 +179,12 @@ function_call( 'param', new class {
/* testNestedMethodParam 2 */
public function __construct( $open, $post_id ) {}
}, 10, 2 );

class PHP8Mixed {
/* testPHP8MixedTypeHint */
public static miXed $mixed;

/* testPHP8MixedTypeHintNullable */
// Intentional fatal error - nullability is not allowed with mixed, but that's not the concern of the method.
private ?mixed $nullableMixed;
}
20 changes: 20 additions & 0 deletions tests/Core/File/GetMemberPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,26 @@ public function dataGetMemberProperties()
'nullable_type' => false,
],
],
[
'/* testPHP8MixedTypeHint */',
[
'scope' => 'public',
'scope_specified' => true,
'is_static' => true,
'type' => 'miXed',
'nullable_type' => false,
],
],
[
'/* testPHP8MixedTypeHintNullable */',
[
'scope' => 'private',
'scope_specified' => true,
'is_static' => false,
'type' => '?mixed',
'nullable_type' => true,
],
],
];

}//end dataGetMemberProperties()
Expand Down

0 comments on commit 6d6b0eb

Please sign in to comment.