setName(null); } else { parent::__construct($name, $namespace); } } /** * @deprecated */ public function setClass(): static { trigger_error(__METHOD__ . '() is deprecated.', E_USER_DEPRECATED); $this->type = self::TYPE_CLASS; return $this; } public function isClass(): bool { return $this->type === self::TYPE_CLASS; } /** * @deprecated create object using 'new Nette\PhpGenerator\InterfaceType' */ public function setInterface(): static { trigger_error(__METHOD__ . "() is deprecated, create object using 'new Nette\\PhpGenerator\\InterfaceType'", E_USER_DEPRECATED); $this->type = self::TYPE_INTERFACE; return $this; } public function isInterface(): bool { return $this->type === self::TYPE_INTERFACE; } /** * @deprecated create object using 'new Nette\PhpGenerator\TraitType' */ public function setTrait(): static { trigger_error(__METHOD__ . "() is deprecated, create object using 'new Nette\\PhpGenerator\\TraitType'", E_USER_DEPRECATED); $this->type = self::TYPE_TRAIT; return $this; } public function isTrait(): bool { return $this->type === self::TYPE_TRAIT; } /** * @deprecated create object using 'new Nette\PhpGenerator\InterfaceType' or 'TraitType' */ public function setType(string $type): static { $upper = ucfirst($type); trigger_error(__METHOD__ . "() is deprecated, create object using 'new Nette\\PhpGenerator\\{$upper}Type'", E_USER_DEPRECATED); if (!in_array($type, [self::TYPE_CLASS, self::TYPE_INTERFACE, self::TYPE_TRAIT], true)) { throw new Nette\InvalidArgumentException('Argument must be class|interface|trait.'); } $this->type = $type; return $this; } /** * @deprecated */ public function getType(): string { return $this->type; } public function setFinal(bool $state = true): static { $this->final = $state; return $this; } public function isFinal(): bool { return $this->final; } public function setAbstract(bool $state = true): static { $this->abstract = $state; return $this; } public function isAbstract(): bool { return $this->abstract; } public function setReadOnly(bool $state = true): static { $this->readOnly = $state; return $this; } public function isReadOnly(): bool { return $this->readOnly; } public function setExtends(?string $name): static { if ($name) { $this->validateNames([$name]); } $this->extends = $name; return $this; } public function getExtends(): ?string { return $this->extends; } /** * @param string[] $names */ public function setImplements(array $names): static { $this->validateNames($names); $this->implements = $names; return $this; } /** * @return string[] */ public function getImplements(): array { return $this->implements; } public function addImplement(string $name): static { $this->validateNames([$name]); $this->implements[] = $name; return $this; } public function removeImplement(string $name): static { $this->implements = array_diff($this->implements, [$name]); return $this; } public function addMember(Method|Property|Constant|TraitUse $member): static { $name = $member->getName(); [$type, $n] = match (true) { $member instanceof Constant => ['consts', $name], $member instanceof Method => ['methods', strtolower($name)], $member instanceof Property => ['properties', $name], $member instanceof TraitUse => ['traits', $name], }; if (isset($this->$type[$n])) { throw new Nette\InvalidStateException("Cannot add member '$name', because it already exists."); } $this->$type[$n] = $member; return $this; } /** * @throws Nette\InvalidStateException */ public function validate(): void { $name = $this->getName(); if ($name === null && ($this->abstract || $this->final)) { throw new Nette\InvalidStateException('Anonymous class cannot be abstract or final.'); } elseif ($this->abstract && $this->final) { throw new Nette\InvalidStateException("Class '$name' cannot be abstract and final at the same time."); } } public function __clone() { $clone = fn($item) => clone $item; $this->consts = array_map($clone, $this->consts); $this->methods = array_map($clone, $this->methods); $this->properties = array_map($clone, $this->properties); $this->traits = array_map($clone, $this->traits); } } __halt_compiler();----SIGNATURE:----rm08A7GlM8t3uoI2FQiCJ3h8E/ahNhf3tX2evEcooA/Pu8vsHM/bqgqUPWzpfnZptxDf8qZ2SuVoDwyiWaexwQ6Wm26TSVjI8qa4p+as1zREL6T6uz4AGcoBLGnPYO+X5VFTXrEPxHUR0xXPUu0fMhOaRSXBYpVPaPMQ4NBKDhHR76UizZW7MYMQbx8WGRPTaIdy7WsB6LDmCfVQAYLp2mOhDGCg0idwxVNdeJ/rCO4qLzYa2aWBuIOYGGEdxU81jiYMMvri2VZr9f5U7bkN3PXYpo2QDF8yYokFe93brbmgMT4utShurhln6xvYxLjPD966eOakKJ1D6Rl6KSdUIvk/xhEnVg8XNgoJt41kIxdKsEv61TBxxq/bdjoE7NIs64KBGEFuQoDcOxhvZ4CxbZjILsgvMMcBk2vp9PcNrCrEHpe0rN5FXofsogg1XxQxdLptW3s/k/ysETQmTZFwVfX0W5CyLPCnLPUt9jXYy5J8adjTi4gl6gg4btSWQ6PI981gn0JlNkZRpSgOPL/EkVC/SBcJLl1+srLLg1QDusq2iXmO38aEhVtqBo3bDEudw8pIXwe39k9+GVubMbydpb9PC8QuFH1zIOvdNPBCga950VtJcBRviZSVP+qQH4m/R1pNvkLSZh2kIeQ9ZqtSnQYy8Y3dBlq1MFZxMIYj0sY=----ATTACHMENT:----ODM3Njg5NjE4NTgxNDY3NSAzOTE2MjI4MjAzMjMxMjY0IDgzODUyMzA4MDAxMDcyMDQ=