File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88class AnArray extends Base
99{
1010
11- private Base $ items ;
11+ private ? Base $ items ;
1212 private ?int $ minItems , $ maxItems ;
1313 private ?bool $ uniqueItems ;
1414
1515 #[Pure]
16- private function __construct ($ items )
16+ private function __construct (? Base $ items )
1717 {
1818
1919 $ this ->minItems = null ;
@@ -26,7 +26,7 @@ private function __construct($items)
2626 final public static function naked (): self
2727 {
2828
29- return new self ([] );
29+ return new self (null );
3030 }
3131
3232 /**
@@ -89,7 +89,10 @@ final public function jsonSerialize(): array
8989
9090 $ return = parent ::jsonSerialize ();
9191 $ return ['type ' ] = 'array ' ;
92- $ return ['items ' ] = $ this ->items ;
92+
93+ if ($ this ->items !== null ) {
94+ $ return ['items ' ] = $ this ->items ;
95+ }
9396
9497 if ($ this ->minItems !== null ) {
9598 $ return ['minItems ' ] = $ this ->minItems ;
You can’t perform that action at this time.
0 commit comments