$parameters * @param array $attributes */ public function __construct( public string $name, public int $visibility, public string $returnType, public array $parameters, public bool $isStatic, public bool $isAbstract, public bool $isFinal, public array $attributes = [], ) { } public function isPublic(): bool { return ($this->visibility & \ReflectionMethod::IS_PUBLIC) !== 0; } public function isProtected(): bool { return ($this->visibility & \ReflectionMethod::IS_PROTECTED) !== 0; } public function isPrivate(): bool { return ($this->visibility & \ReflectionMethod::IS_PRIVATE) !== 0; } public function getVisibilityString(): string { if ($this->isPublic()) { return 'public'; } if ($this->isProtected()) { return 'protected'; } if ($this->isPrivate()) { return 'private'; } return 'unknown'; } public function getSignature(): string { $params = implode(', ', $this->parameters); $static = $this->isStatic ? 'static ' : ''; $visibility = $this->getVisibilityString(); $return = $this->returnType !== '' ? ': ' . $this->returnType : ''; return $static . $visibility . ' function ' . $this->name . '(' . $params . ')' . $return; } }