Skip to content
This repository was archived by the owner on Mar 12, 2024. It is now read-only.

Commit c898a9b

Browse files
committed
add tests for union types
1 parent 1916fb5 commit c898a9b

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

tests/Boilerplate/TestClass.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ class TestClass
2121
private static array $static = [];
2222
private static ?array $nullable_static_array = null;
2323

24+
protected string|array|null $union_type = ['test' => false];
25+
protected static string|array|null $static_union_type = 'test';
26+
2427
public function __construct()
2528
{
2629
$this->bool = true;
@@ -30,7 +33,10 @@ public function __construct()
3033
$this->nullable_array = null;
3134
$this->collection = new Collection;
3235
$this->nullable_collection = null;
36+
$this->union_type = ['test' => true];
37+
3338
self::$static = ['static' => true];
3439
self::$nullable_static_array = null;
40+
self::$static_union_type = ['test' => true];
3541
}
3642
}

tests/RecursiveClassDumpTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ public function testCanDumpClassProperties()
1717
$this->assertArrayHasKey('array', $properties['array']);
1818
$this->assertTrue($properties['collection']->isEmpty());
1919
$this->assertArrayHasKey('static', $properties['static']);
20+
$this->assertArrayHasKey('test', $properties['union_type']);
21+
$this->assertArrayHasKey('test', $properties['static_union_type']);
2022

2123
$this->assertNull($properties['nullable_string']);
2224
$this->assertNull($properties['nullable_array']);

0 commit comments

Comments
 (0)