Skip to content

Commit

Permalink
Merge pull request #761 from koekaverna/master
Browse files Browse the repository at this point in the history
Update src/Generator/TypeBuilder.php
  • Loading branch information
murtukov authored Oct 7, 2020
2 parents 393e8ff + 83a9da0 commit 6192522
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Generator/TypeBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ public function build(array $config, string $type): PhpFile

$class = $this->file->createClass($config['class_name'])
->setFinal()
->setExtends(self::EXTENDS[$type])
->setExtends(static::EXTENDS[$type])
->addImplements(GeneratedTypeInterface::class)
->addConst('NAME', $config['name'])
->setDocBlock(self::DOCBLOCK_TEXT);
->setDocBlock(static::DOCBLOCK_TEXT);

$class->emptyLine();

Expand Down Expand Up @@ -154,7 +154,7 @@ protected function wrapTypeRecursive($typeNode)
$this->file->addUse(Type::class);
break;
default:
if (in_array($typeNode->name->value, self::BUILT_IN_TYPES)) {
if (in_array($typeNode->name->value, static::BUILT_IN_TYPES)) {
$name = strtolower($typeNode->name->value);
$type = Literal::new("Type::$name()");
$this->file->addUse(Type::class);
Expand Down Expand Up @@ -431,8 +431,8 @@ protected function buildConstraints(array $constraints = []): Collection
$this->file->addUse($fqcn);
} else {
// Symfony constraint
$this->file->addUseGroup(self::CONSTRAINTS_NAMESPACE, $name);
$fqcn = self::CONSTRAINTS_NAMESPACE."\\$name";
$this->file->addUseGroup(static::CONSTRAINTS_NAMESPACE, $name);
$fqcn = static::CONSTRAINTS_NAMESPACE."\\$name";
}

if (!class_exists($fqcn)) {
Expand Down Expand Up @@ -482,7 +482,7 @@ protected function buildCascade(array $cascade): Collection
if (isset($referenceType)) {
$type = trim($referenceType, '[]!');

if (in_array($type, self::BUILT_IN_TYPES)) {
if (in_array($type, static::BUILT_IN_TYPES)) {
throw new GeneratorException('Cascade validation cannot be applied to built-in types.');
}

Expand Down

0 comments on commit 6192522

Please sign in to comment.