Skip to content

Commit

Permalink
BCFile/Variables::getMemberProperties(): add tests with PHP 8 "mixed"…
Browse files Browse the repository at this point in the history
… property type

No changes needed to the actual method, the type is already handled correctly.
  • Loading branch information
jrfnl committed Jul 10, 2020
1 parent 5fadd5a commit cf89158
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Tests/BackCompat/BCFile/GetMemberPropertiesTest.inc
Expand Up @@ -182,3 +182,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;
}
24 changes: 24 additions & 0 deletions Tests/BackCompat/BCFile/GetMemberPropertiesTest.php
Expand Up @@ -579,6 +579,30 @@ public function dataGetMemberProperties()
'nullable_type' => false,
],
],
[
'/* testPHP8MixedTypeHint */',
[
'scope' => 'public',
'scope_specified' => true,
'is_static' => true,
'type' => 'miXed',
'type_token' => -2, // Offset from the T_VARIABLE token.
'type_end_token' => -2, // Offset from the T_VARIABLE token.
'nullable_type' => false,
],
],
[
'/* testPHP8MixedTypeHintNullable */',
[
'scope' => 'private',
'scope_specified' => true,
'is_static' => false,
'type' => '?mixed',
'type_token' => -2, // Offset from the T_VARIABLE token.
'type_end_token' => -2, // Offset from the T_VARIABLE token.
'nullable_type' => true,
],
],
];
}

Expand Down

0 comments on commit cf89158

Please sign in to comment.