You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.
<?php<<<CONFIGpackages: - "zendframework/zend-code: ^3.0"CONFIG;
$classGenerator = new \Zend\Code\Generator\ClassGenerator();
$propertyGenerator = new \Zend\Code\Generator\PropertyGenerator();
$value = new \Zend\Code\Generator\ValueGenerator();
$value->setValue('DefaultString');
$value->setType(\Zend\Code\Generator\ValueGenerator::TYPE_STRING);
$propertyGenerator->setName("foo");
$propertyGenerator->setDefaultValue($value->generate());
$classGenerator->addPropertyFromGenerator($propertyGenerator);
print $classGenerator->generate();
Will print this:
class
{
public $foo = '\'DefaultString\'';
}
PropertyGenerator::setDefaultValue wraps everything that isn't a PropertyValueGenerator instance in a new instance of that class. IMO setDefaultValue should not accept ValueGenerator instances or at least convert to a PropertyValueGenerator, vs composing one into the other as is presently the case. This change does break BC, however.
The text was updated successfully, but these errors were encountered:
Related to #96, PropertyGenerator behaves incorrectly when the default value passed into it is a ValueGenerator instead of a PropertyValueGenerator.
Example (lifted from #96):
Will print this:
PropertyGenerator::setDefaultValue
wraps everything that isn't aPropertyValueGenerator
instance in a new instance of that class. IMOsetDefaultValue
should not accept ValueGenerator instances or at least convert to a PropertyValueGenerator, vs composing one into the other as is presently the case. This change does break BC, however.The text was updated successfully, but these errors were encountered: