|
11 | 11 |
|
12 | 12 | use Nette;
|
13 | 13 | use PhpParser;
|
| 14 | +use PhpParser\Modifiers; |
14 | 15 | use PhpParser\Node;
|
15 | 16 | use PhpParser\NodeFinder;
|
16 | 17 | use PhpParser\ParserFactory;
|
@@ -414,9 +415,8 @@ private function setupFunction(GlobalFunction|Method $function, Node\FunctionLik
|
414 | 415 | $function->setReturnType($node->getReturnType() ? $this->toPhp($node->getReturnType()) : null);
|
415 | 416 | foreach ($node->getParams() as $item) {
|
416 | 417 | $visibility = $this->toVisibility($item->flags);
|
417 |
| - $isReadonly = (bool) ($item->flags & Node\Stmt\Class_::MODIFIER_READONLY); |
418 | 418 | $param = $visibility
|
419 |
| - ? ($function->addPromotedParameter($item->var->name))->setVisibility($visibility)->setReadonly($isReadonly) |
| 419 | + ? $function->addPromotedParameter($item->var->name)->setVisibility($visibility)->setReadonly($item->isReadonly()) |
420 | 420 | : $function->addParameter($item->var->name);
|
421 | 421 | $param->setType($item->type ? $this->toPhp($item->type) : null);
|
422 | 422 | $param->setReference($item->byRef);
|
@@ -483,9 +483,9 @@ private function toValue(Node\Expr $node): mixed
|
483 | 483 | private function toVisibility(int $flags): ?string
|
484 | 484 | {
|
485 | 485 | return match (true) {
|
486 |
| - (bool) ($flags & Node\Stmt\Class_::MODIFIER_PUBLIC) => ClassType::VisibilityPublic, |
487 |
| - (bool) ($flags & Node\Stmt\Class_::MODIFIER_PROTECTED) => ClassType::VisibilityProtected, |
488 |
| - (bool) ($flags & Node\Stmt\Class_::MODIFIER_PRIVATE) => ClassType::VisibilityPrivate, |
| 486 | + (bool) ($flags & Modifiers::PUBLIC) => ClassType::VisibilityPublic, |
| 487 | + (bool) ($flags & Modifiers::PROTECTED) => ClassType::VisibilityProtected, |
| 488 | + (bool) ($flags & Modifiers::PRIVATE) => ClassType::VisibilityPrivate, |
489 | 489 | default => null,
|
490 | 490 | };
|
491 | 491 | }
|
|
0 commit comments