-
-
Notifications
You must be signed in to change notification settings - Fork 192
Open
FriendsOfPHP/proxy-manager-lts
#31Description
The PHP documentation says that __set and __unset should return void, that their return values are ignored, and suggests these signatures:
public __set(string $name, mixed $value): void
public __unset(string $name): voidBut if I actually declare the return types in my __set and __unset, the generated proxy methods still try to return the result of the proxied call. This results in a Compile Error: A void function must not return a value:
// my class
public function __set(string $name, mixed $value): void { ... }
public function __unset(string $name): void { ... }// generated proxy
public function __set($name, $value) : void
{
$this->initializerecc30 && ($this->initializerecc30->__invoke($valueHolder2e9e4, $this, '__set', array('name' => $name, 'value' => $value), $this->initializerecc30) || 1) && $this->valueHolder2e9e4 = $valueHolder2e9e4;
if (isset(self::$publicPropertiesda7b8[$name])) {
return ($this->valueHolder2e9e4->$name = $value); // ← uh oh
}
return $this->valueHolder2e9e4->__set($name, $value); // ← uh oh
}
public function __unset($name) : void
{
$this->initializerecc30 && ($this->initializerecc30->__invoke($valueHolder2e9e4, $this, '__unset', array('name' => $name), $this->initializerecc30) || 1) && $this->valueHolder2e9e4 = $valueHolder2e9e4;
if (isset(self::$publicPropertiesda7b8[$name])) {
unset($this->valueHolder2e9e4->$name);
return;
}
return $this->valueHolder2e9e4->__unset($name); // ← uh oh
}Metadata
Metadata
Assignees
Labels
No labels