-
-
Notifications
You must be signed in to change notification settings - Fork 191
Open
Labels
bugdependenciesPull requests that update a dependency filePull requests that update a dependency file
Description
When generating a proxy where a default value is enum using PHP 8.1 (yes, I know...), the default value is missing leading slash, pointing to non-existent class.
namespace App\Domain\Transaction;
enum Status: string
{
case INITIATED = 'INITIATED';
}class Transaction
{
// ...
protected Status $state = \App\Domain\Transaction\Status::INITIATED;
}Generated proxy:
namespace MongoDBODMProxies\__PM__\App\Domain\Document\Transaction\Transaction;
class Generatedd19772223e8a9012106a186d3aa68e25 extends \App\Domain\Document\Transaction\Transaction implements \ProxyManager\Proxy\GhostObjectInterface
{
private function callInitializer7e974($methodName, array $parameters)
{
if ($this->initializationTracker75370 || ! $this->initializer83563) {
return;
}
$this->initializationTracker75370 = true;
$this->state = App\Domain\Transaction\Status::INITIATED; // note missing leading backslash producing invalid namespace name
// ...
}
}This is caused by var_export which implies root namespace, while generated proxy is its own namespace:
ProxyManager/src/ProxyManager/ProxyGenerator/LazyLoadingGhost/MethodGenerator/CallInitializer.php
Line 171 in 8846623
| return var_export($defaults[$name] ?? null, true); |
We could either explicitly check for enum_exists and prefix it with \ just to make things work but I'm not sure if it's right solution so just creating an issue to track this problem.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugdependenciesPull requests that update a dependency filePull requests that update a dependency file