-
-
Notifications
You must be signed in to change notification settings - Fork 147
Closed
Description
Version: 3.4.1
Bug Description
When printing class, there is this line:
($property->getValue() === null && !$property->isInitialized() ? '' : ' = ' . $this->dump($property->getValue(), strlen($def) + 3)) // 3 = ' = 'which basically means that if I set value of Property to null intentionally, this value is not printed.
Steps To Reproduce
E.g. $property->setPrivate()->setValue(null) generates private $property;
But $property->setPrivate()->setValue('test') generates private $property = 'test'; properly
Expected Behavior
It should generate private $property = null;
Possible Solution
Mark null state with some constant instead of null. So it would look something like this:
class Property
{
public const NO_DEFAULT_VALUE = '$73aad02e-7f5a-4ef2-8cdd-0fd09e6d9863§'; // hopefully no one is going to pass this string as default value
// ...
}
// in printer:
($property->getValue() === Property::NO_DEFAULT_VALUE && !$property->isInitialized() ? '' : ' = ' . $this->dump($property->getValue(), strlen($def) + 3)) // 3 = ' = 'Metadata
Metadata
Assignees
Labels
No labels