diff --git a/composer.json b/composer.json index b3f4097..604ba4b 100644 --- a/composer.json +++ b/composer.json @@ -44,7 +44,7 @@ "symfony/yaml": "^5.4 || ^6.4 || ^7.0 || ^8.0", "symfony/filesystem": "^5.4 || ^6.4 || ^7.0 || ^8.0", "twig/twig": "^3.0", - "nette/php-generator": "^3.6 || ^4.0", + "nette/php-generator": "^4.1.7", "nikic/php-parser": "^4.13 || ^5.0", "devizzent/cebe-php-openapi": "^1.0.3", "symfony/string": "^5.4 || ^6.4 || ^7.0 || ^8.0", diff --git a/src/Model/Constant.php b/src/Model/Constant.php index 41833e7..889abad 100644 --- a/src/Model/Constant.php +++ b/src/Model/Constant.php @@ -13,8 +13,8 @@ namespace ApiPlatform\SchemaGenerator\Model; -use Nette\PhpGenerator\ClassType; use Nette\PhpGenerator\Constant as NetteConstant; +use Nette\PhpGenerator\Visibility; abstract class Constant { @@ -49,7 +49,7 @@ public function toNetteConstant(): NetteConstant { $constant = (new NetteConstant($this->name)) ->setValue($this->value()) - ->setVisibility(ClassType::VISIBILITY_PUBLIC); + ->setVisibility(Visibility::Public); foreach ($this->annotations as $annotation) { $constant->addComment($annotation); diff --git a/src/Model/Property.php b/src/Model/Property.php index db84f5f..81bf538 100644 --- a/src/Model/Property.php +++ b/src/Model/Property.php @@ -15,7 +15,6 @@ use ApiPlatform\SchemaGenerator\Model\Type\ArrayType; use ApiPlatform\SchemaGenerator\Model\Type\Type; -use Nette\PhpGenerator\ClassType; use Nette\PhpGenerator\Method; use Nette\PhpGenerator\PhpNamespace; use Nette\PhpGenerator\Property as NetteProperty; @@ -214,7 +213,7 @@ private function generateGetter(PhpNamespace $namespace): Method throw new \LogicException(\sprintf("Property '%s' is not readable.", $this->name)); } - $getter = (new Method('get'.ucfirst($this->name)))->setVisibility(ClassType::VISIBILITY_PUBLIC); + $getter = (new Method('get'.ucfirst($this->name)))->setVisibility(Visibility::Public); foreach ($this->getterAnnotations as $annotation) { $getter->addComment($annotation); } @@ -247,7 +246,7 @@ private function generateMutators( if ($this->isArray() && (!$this->isSimpleArray() || !$useSimpleArraySetter)) { $singularProperty = $singularize($this->name()); - $adder = (new Method('add'.ucfirst($singularProperty)))->setVisibility(ClassType::VISIBILITY_PUBLIC); + $adder = (new Method('add'.ucfirst($singularProperty)))->setVisibility(Visibility::Public); $adder->setReturnType($useFluentMutators ? 'self' : 'void'); foreach ($this->adderAnnotations() as $annotation) { $adder->addComment($annotation); @@ -265,7 +264,7 @@ private function generateMutators( } $mutators[] = $adder; - $remover = (new Method('remove'.ucfirst($singularProperty)))->setVisibility(ClassType::VISIBILITY_PUBLIC); + $remover = (new Method('remove'.ucfirst($singularProperty)))->setVisibility(Visibility::Public); $remover->setReturnType($useFluentMutators ? 'self' : 'void'); foreach ($this->removerAnnotations as $annotation) { $adder->addComment($annotation); @@ -297,7 +296,7 @@ private function generateMutators( $mutators[] = $remover; } else { - $setter = (new Method('set'.ucfirst($this->name())))->setVisibility(ClassType::VISIBILITY_PUBLIC); + $setter = (new Method('set'.ucfirst($this->name())))->setVisibility(Visibility::Public); $setter->setReturnType($useFluentMutators ? 'self' : 'void'); foreach ($this->setterAnnotations as $annotation) { $setter->addComment($annotation);