Skip to content

Commit

Permalink
fix: use cache variable before initializing it
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa committed May 15, 2020
1 parent 39a6fd7 commit 4527b2f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/SingleTableInheritanceTrait.php
Expand Up @@ -96,7 +96,6 @@ public static function instantiate($row): self

private static function getClassFromType(?string $type): string
{
self::initCache();
return self::$typeToClass[$type] ?? self::$defaultClass;
}

Expand All @@ -107,6 +106,7 @@ private static function initSingleTableInheritance(self $model): void

private static function instantiateSingleTableInheritance($row): self
{
self::initCache();
$class = self::getClassFromType($row[self::$typeColumn] ?? null);
return new $class;
}
Expand Down

0 comments on commit 4527b2f

Please sign in to comment.