ZF-6444: CodeGenerator ignores static properties and methods
Description
Indicating that a method or property is static is ignored by CodeGenerator.
When setting properties on my class like so:
$gen->setName($className)
->setDocblock($docblock)
->setProperties(array(
array(
'name' => 'columns',
'visibility' => 'public',
'static' => true,
'defaltValue' => ''
)
))
The generated output does not indicate that the property is static. In fact, as shown below, the isStatic() method is never even checked except to setStatic during reflection. See below:
daves-macbookpro ~/dev/php/ZendFramework-1.8.0b1-minimal/library/Zend/CodeGenerator: ack Static Php/Member/Abstract.php 52: protected $_isStatic = false; 120: * setStatic() 122: * @param bool $isStatic 125: public function setStatic($isStatic) 127: $this->_isStatic = ($isStatic) ? true : false; 132: * isStatic() 136: public function isStatic() 138: return $this->_isStatic; Php/Method.php 93: $method->setStatic($reflectionMethod->isStatic());
Comments
Posted by John Kleijn (448191) on 2009-06-09T05:18:55.000+0000
Patched in ZF-6962
Posted by old of Satoru Yoshida (yoshida@zend.co.jp) on 2009-06-11T21:30:58.000+0000
This may be duplicated by description in ZF-6958. I think the description would be better to reflect on this issue.
Posted by Ralph Schindler (ralph) on 2009-06-28T13:15:49.000+0000
Fixed in r16344
Posted by Oliver Tischlinger (zoerznu) on 2009-07-06T09:40:23.000+0000
static methods still ignored.
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-07-06T09:57:53.000+0000
Are you on trunk? If you are using 1.8.4 you're right. On Jun 28th the latest released was packaged already, and therefore the solution to this issue could not be packaged with 1.8.4, but will probably be in 1.8.5.
Posted by Oliver Tischlinger (zoerznu) on 2009-07-07T02:07:41.000+0000
I use SVN URL:
http://framework.zend.com/svn/framework/…
where static and final in Zend_CodeGenerator_Php_Method is still ignored.
Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-07-07T02:28:12.000+0000
Reopened on request.
Posted by Ralph Schindler (ralph) on 2009-07-10T11:22:28.000+0000
Fixed in r16625