Skip to content

Commit 6b27be5

Browse files
committed
chore: configure linters and fixers
1 parent 9d23d7d commit 6b27be5

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/Factory/ReflectorFactory.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
use function Constructo\Cast\arrayify;
1616

17+
use const CONSTRUCTO_SCHEMATA;
18+
1719
readonly class ReflectorFactory
1820
{
1921
use MakeExtension;
@@ -29,9 +31,8 @@ public function __construct(
2931

3032
public static function createFrom(array $specs = [], array $types = [], Notation $notation = Notation::SNAKE): self
3133
{
32-
$schemata = CONSTRUCTO_SCHEMATA;
33-
$specs = array_merge(arrayify($schemata['specs'] ?? null), $specs);
34-
$types = array_merge(arrayify($schemata['types'] ?? null), $types);
34+
$specs = array_merge(self::extract('specs'), $specs);
35+
$types = array_merge(self::extract('types'), $types);
3536
$builder = new Builder($notation);
3637
$specsFactory = new DefaultSpecsFactory($builder, $specs);
3738
return new self(
@@ -48,4 +49,11 @@ public function make(): Reflector
4849
$types = $this->typesFactory->make();
4950
return new Reflector($this->schemaFactory, $types, $this->cache, $this->introspector, $this->notation);
5051
}
52+
53+
private static function extract(string $key): array
54+
{
55+
$schemata = CONSTRUCTO_SCHEMATA;
56+
$extracted = $schemata[$key] ?? null;
57+
return is_array($extracted) ? $extracted : [];
58+
}
5159
}

src/_/@schemata.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
declare(strict_types=1);
44

5-
65
use Constructo\Support\Metadata\Schema\Field\Formatter\MergeFormatter;
76
use Constructo\Support\Metadata\Schema\Field\Formatter\PatternFormatter;
87

0 commit comments

Comments
 (0)