Issues

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

Patched in ZF-6962

This may be duplicated by description in ZF-6958. I think the description would be better to reflect on this issue.

Fixed in r16344

static methods still ignored.

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.

I use SVN URL:

http://framework.zend.com/svn/framework/…

where static and final in Zend_CodeGenerator_Php_Method is still ignored.

Reopened on request.

Fixed in r16625