Skip to content

Commit 1ed1033

Browse files
committed
TypeString: add more tests with FQN true/false/null
1 parent a3ddbb1 commit 1ed1033

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-0
lines changed

Tests/Utils/TypeString/FilterTypesTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,14 @@ public static function dataFilterTypes()
290290
'\Fully\Qualified' => '\Fully\Qualified',
291291
],
292292
],
293+
'keyed array containing FQN and uppercase true/false/null keywords' => [
294+
'keywords' => [
295+
'\FALSE' => '\FALSE',
296+
'\NULL' => '\NULL',
297+
'\TRUE' => '\TRUE',
298+
],
299+
'oonames' => [],
300+
],
293301
'keyed array containing both keywords and oo names, keys not the same as values' => [
294302
'keywords' => [
295303
'float' => 'callable',

Tests/Utils/TypeString/ToArrayTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,23 @@ public static function dataToArrayNormalized()
372372
'void' => 'void',
373373
],
374374
],
375+
'union type: \true|\false|\null (FQN)' => [
376+
'type' => '\true|\false|\null',
377+
'expected' => [
378+
'true' => 'true',
379+
'false' => 'false',
380+
'null' => 'null',
381+
],
382+
],
383+
'union type: \TRUE|\FALSE|\NULL (FQN + uppercase)' => [
384+
'type' => '\TRUE|\FALSE|\NULL',
385+
'expected' => [
386+
'true' => 'true',
387+
'false' => 'false',
388+
'null' => 'null',
389+
],
390+
],
391+
375392
'DNF type: keywords in mixed case' => [
376393
'type' => 'FALSE|(B&A)|Null',
377394
'expected' => [
@@ -423,6 +440,23 @@ public static function dataToArrayNotNormalized()
423440
'void' => 'void',
424441
],
425442
],
443+
'union type: \true|\false|\null (FQN)' => [
444+
'type' => '\true|\false|\null',
445+
'expected' => [
446+
'\true' => '\true',
447+
'\false' => '\false',
448+
'\null' => '\null',
449+
],
450+
],
451+
'union type: \TRUE|\FALSE|\NULL (FQN + uppercase)' => [
452+
'type' => '\TRUE|\FALSE|\NULL',
453+
'expected' => [
454+
'\TRUE' => '\TRUE',
455+
'\FALSE' => '\FALSE',
456+
'\NULL' => '\NULL',
457+
],
458+
],
459+
426460
'DNF type: keywords in mixed case' => [
427461
'type' => 'FALSE|(B&A)|Null',
428462
'expected' => [

0 commit comments

Comments
 (0)