diff --git a/head/schema-php/test/inputs/schema/top-level-array.schema/default/TopLevel.php b/head/schema-php/test/inputs/schema/top-level-array.schema/default/TopLevel.php
new file mode 100644
index 0000000..712450c
--- /dev/null
+++ b/head/schema-php/test/inputs/schema/top-level-array.schema/default/TopLevel.php
@@ -0,0 +1,154 @@
+<?php
+declare(strict_types=1);
+
+// This is an autogenerated file:TopLevel
+
+class TopLevel {
+    private string $label; // json:label Required
+    private float $score; // json:score Required
+
+    /**
+     * @param string $label
+     * @param float $score
+     */
+    public function __construct(string $label, float $score) {
+        $this->label = $label;
+        $this->score = $score;
+    }
+
+    /**
+     * @param string $value
+     * @throws Exception
+     * @return string
+     */
+    public static function fromLabel(string $value): string {
+        return $value; /*string*/
+    }
+
+    /**
+     * @throws Exception
+     * @return string
+     */
+    public function toLabel(): string {
+        if (TopLevel::validateLabel($this->label))  {
+            return $this->label; /*string*/
+        }
+        throw new Exception('never get to this TopLevel::label');
+    }
+
+    /**
+     * @param string
+     * @return bool
+     * @throws Exception
+     */
+    public static function validateLabel(string $value): bool {
+        return true;
+    }
+
+    /**
+     * @throws Exception
+     * @return string
+     */
+    public function getLabel(): string {
+        if (TopLevel::validateLabel($this->label))  {
+            return $this->label;
+        }
+        throw new Exception('never get to getLabel TopLevel::label');
+    }
+
+    /**
+     * @return string
+     */
+    public static function sampleLabel(): string {
+        return 'TopLevel::label::31'; /*31:label*/
+    }
+
+    /**
+     * @param float $value
+     * @throws Exception
+     * @return float
+     */
+    public static function fromScore(float $value): float {
+        return $value; /*float*/
+    }
+
+    /**
+     * @throws Exception
+     * @return float
+     */
+    public function toScore(): float {
+        if (TopLevel::validateScore($this->score))  {
+            return $this->score; /*float*/
+        }
+        throw new Exception('never get to this TopLevel::score');
+    }
+
+    /**
+     * @param float
+     * @return bool
+     * @throws Exception
+     */
+    public static function validateScore(float $value): bool {
+        return true;
+    }
+
+    /**
+     * @throws Exception
+     * @return float
+     */
+    public function getScore(): float {
+        if (TopLevel::validateScore($this->score))  {
+            return $this->score;
+        }
+        throw new Exception('never get to getScore TopLevel::score');
+    }
+
+    /**
+     * @return float
+     */
+    public static function sampleScore(): float {
+        return 32.032; /*32:score*/
+    }
+
+    /**
+     * @throws Exception
+     * @return bool
+     */
+    public function validate(): bool {
+        return TopLevel::validateLabel($this->label)
+        || TopLevel::validateScore($this->score);
+    }
+
+    /**
+     * @return stdClass
+     * @throws Exception
+     */
+    public function to(): stdClass  {
+        $out = new stdClass();
+        $out->{'label'} = $this->toLabel();
+        $out->{'score'} = $this->toScore();
+        return $out;
+    }
+
+    /**
+     * @param stdClass $obj
+     * @return TopLevel
+     * @throws Exception
+     */
+    public static function from(stdClass $obj): TopLevel {
+        return new TopLevel(
+         TopLevel::fromLabel($obj->{'label'})
+        ,TopLevel::fromScore($obj->{'score'})
+        );
+    }
+
+    /**
+     * @return TopLevel
+     */
+    public static function sample(): TopLevel {
+        return new TopLevel(
+         TopLevel::sampleLabel()
+        ,TopLevel::sampleScore()
+        );
+    }
+}
diff --git a/head/schema-php/test/inputs/schema/top-level-enum.schema/default/TopLevel.php b/head/schema-php/test/inputs/schema/top-level-enum.schema/default/TopLevel.php
new file mode 100644
index 0000000..1602fae
--- /dev/null
+++ b/head/schema-php/test/inputs/schema/top-level-enum.schema/default/TopLevel.php
@@ -0,0 +1,55 @@
+<?php
+declare(strict_types=1);
+
+// This is an autogenerated file:TopLevel
+
+class TopLevel {
+    public static TopLevel $ONE;
+    public static TopLevel $THREE;
+    public static TopLevel $TWO;
+    public static function init() {
+        TopLevel::$ONE = new TopLevel('one');
+        TopLevel::$THREE = new TopLevel('three');
+        TopLevel::$TWO = new TopLevel('two');
+    }
+    private string $enum;
+    public function __construct(string $enum) {
+        $this->enum = $enum;
+    }
+
+    /**
+     * @param TopLevel
+     * @return string
+     * @throws Exception
+     */
+    public static function to(TopLevel $obj): string {
+        switch ($obj->enum) {
+            case TopLevel::$ONE->enum: return 'one';
+            case TopLevel::$THREE->enum: return 'three';
+            case TopLevel::$TWO->enum: return 'two';
+        }
+        throw new Exception('the give value is not an enum-value.');
+    }
+
+    /**
+     * @param mixed
+     * @return TopLevel
+     * @throws Exception
+     */
+    public static function from($obj): TopLevel {
+        switch ($obj) {
+            case 'one': return TopLevel::$ONE;
+            case 'three': return TopLevel::$THREE;
+            case 'two': return TopLevel::$TWO;
+        }
+        throw new Exception("Cannot deserialize TopLevel");
+    }
+
+    /**
+     * @return TopLevel
+     */
+    public static function sample(): TopLevel {
+        return TopLevel::$ONE;
+    }
+}
+TopLevel::init();
diff --git a/head/schema-php/test/inputs/schema/union.schema/default/TopLevel.php b/head/schema-php/test/inputs/schema/union.schema/default/TopLevel.php
new file mode 100644
index 0000000..37f94b2
--- /dev/null
+++ b/head/schema-php/test/inputs/schema/union.schema/default/TopLevel.php
@@ -0,0 +1,228 @@
+<?php
+declare(strict_types=1);
+
+// This is an autogenerated file:TopLevel
+
+class TopLevel {
+    private ?int $one; // json:one Optional
+    private bool $two; // json:two Required
+    private ?float $three; // json:three Optional
+
+    /**
+     * @param int|null $one
+     * @param bool $two
+     * @param float|null $three
+     */
+    public function __construct(?int $one, bool $two, ?float $three) {
+        $this->one = $one;
+        $this->two = $two;
+        $this->three = $three;
+    }
+
+    /**
+     * @param ?int $value
+     * @throws Exception
+     * @return ?int
+     */
+    public static function fromOne(?int $value): ?int {
+        if (!is_null($value)) {
+            return $value; /*int*/
+        } else {
+            return  null;
+        }
+    }
+
+    /**
+     * @throws Exception
+     * @return ?int
+     */
+    public function toOne(): ?int {
+        if (TopLevel::validateOne($this->one))  {
+            if (!is_null($this->one)) {
+                return $this->one; /*int*/
+            } else {
+                return  null;
+            }
+        }
+        throw new Exception('never get to this TopLevel::one');
+    }
+
+    /**
+     * @param int|null
+     * @return bool
+     * @throws Exception
+     */
+    public static function validateOne(?int $value): bool {
+        if (!is_null($value)) {
+        }
+        return true;
+    }
+
+    /**
+     * @throws Exception
+     * @return ?int
+     */
+    public function getOne(): ?int {
+        if (TopLevel::validateOne($this->one))  {
+            return $this->one;
+        }
+        throw new Exception('never get to getOne TopLevel::one');
+    }
+
+    /**
+     * @return ?int
+     */
+    public static function sampleOne(): ?int {
+        return 31; /*31:one*/
+    }
+
+    /**
+     * @param bool $value
+     * @throws Exception
+     * @return bool
+     */
+    public static function fromTwo(bool $value): bool {
+        return $value; /*bool*/
+    }
+
+    /**
+     * @throws Exception
+     * @return bool
+     */
+    public function toTwo(): bool {
+        if (TopLevel::validateTwo($this->two))  {
+            return $this->two; /*bool*/
+        }
+        throw new Exception('never get to this TopLevel::two');
+    }
+
+    /**
+     * @param bool
+     * @return bool
+     * @throws Exception
+     */
+    public static function validateTwo(bool $value): bool {
+        return true;
+    }
+
+    /**
+     * @throws Exception
+     * @return bool
+     */
+    public function getTwo(): bool {
+        if (TopLevel::validateTwo($this->two))  {
+            return $this->two;
+        }
+        throw new Exception('never get to getTwo TopLevel::two');
+    }
+
+    /**
+     * @return bool
+     */
+    public static function sampleTwo(): bool {
+        return true; /*32:two*/
+    }
+
+    /**
+     * @param ?float $value
+     * @throws Exception
+     * @return ?float
+     */
+    public static function fromThree(?float $value): ?float {
+        if (!is_null($value)) {
+            return $value; /*float*/
+        } else {
+            return  null;
+        }
+    }
+
+    /**
+     * @throws Exception
+     * @return ?float
+     */
+    public function toThree(): ?float {
+        if (TopLevel::validateThree($this->three))  {
+            if (!is_null($this->three)) {
+                return $this->three; /*float*/
+            } else {
+                return  null;
+            }
+        }
+        throw new Exception('never get to this TopLevel::three');
+    }
+
+    /**
+     * @param float|null
+     * @return bool
+     * @throws Exception
+     */
+    public static function validateThree(?float $value): bool {
+        if (!is_null($value)) {
+        }
+        return true;
+    }
+
+    /**
+     * @throws Exception
+     * @return ?float
+     */
+    public function getThree(): ?float {
+        if (TopLevel::validateThree($this->three))  {
+            return $this->three;
+        }
+        throw new Exception('never get to getThree TopLevel::three');
+    }
+
+    /**
+     * @return ?float
+     */
+    public static function sampleThree(): ?float {
+        return 33.033; /*33:three*/
+    }
+
+    /**
+     * @throws Exception
+     * @return bool
+     */
+    public function validate(): bool {
+        return TopLevel::validateOne($this->one)
+        || TopLevel::validateTwo($this->two)
+        || TopLevel::validateThree($this->three);
+    }
+
+    /**
+     * @return stdClass
+     * @throws Exception
+     */
+    public function to(): stdClass  {
+        $out = new stdClass();
+        $out->{'one'} = $this->toOne();
+        $out->{'two'} = $this->toTwo();
+        $out->{'three'} = $this->toThree();
+        return $out;
+    }
+
+    /**
+     * @param stdClass $obj
+     * @return TopLevel
+     * @throws Exception
+     */
+    public static function from(stdClass $obj): TopLevel {
+        return new TopLevel(
+         TopLevel::fromOne($obj->{'one'})
+        ,TopLevel::fromTwo($obj->{'two'})
+        ,TopLevel::fromThree($obj->{'three'})
+        );
+    }
+
+    /**
+     * @return TopLevel
+     */
+    public static function sample(): TopLevel {
+        return new TopLevel(
+         TopLevel::sampleOne()
+        ,TopLevel::sampleTwo()
+        ,TopLevel::sampleThree()
+        );
+    }
+}
