Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.2.2

Request #11316 'doc' will set null when an doc-comment placed before the declaretion
Submitted: 2007-06-14 15:44 UTC
From: hshimooka Assigned:
Status: Open Package: PHP_Parser (version 0.2.0)
PHP Version: 5.2.2 OS: CentOS4.5
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 6 + 46 = ?

 
 [2007-06-14 15:44 UTC] hshimooka (Hideyuki Shimooka)
Description: ------------ An element 'doc' will be set null when an doc-comment placed before the function/method declaretion, but set the doc-comment when placed after the declaretion. Test script: --------------- o test.php <?php require_once 'Parser.php'; $r = PHP_Parser::staticParseFile('mini.php'); $data = $r->data; var_dump($data); o mini.php <?php /** * hogehoge */ class testClass { /** * @var $_type * @string */ var $_type; /** * setType1 * @param int $type */ function setType1($type = null) { $this->_type = $type; } function setType2($type = null) { $this->_type = $type; } /** * setType2 * @param int $type */ } /** * setType3 * @param int $type */ function setType3($type = null) { $this->_type = $type; } function setType4($type = null) { $this->_type = $type; } /** * setType4 * @param int $type */ Expected result: ---------------- The doc-comment string will be set. Actual result: -------------- array 0 => array 'type' => string 'class' (length=5) 'startline' => int 5 'endline' => int 35 'modifiers' => array empty 'name' => string 'testClass' (length=9) 'extends' => array empty 'implements' => array empty 'info' => array 0 => array 'type' => string 'var' (length=3) 'name' => string '$_type' (length=6) 'line' => int 10 'default' => null 'modifiers' => array 0 => string 'public' (length=6) 'doc' => string '/** * @var $_type * @string */' (length=45) 'parseddoc' => null 'docline' => int 6 1 => array 'type' => string 'method' (length=6) 'name' => string 'setType1' (length=8) 'startline' => int 16 'endline' => int 21 'parameters' => array 0 => array 'typehint' => string '' (length=0) 'param' => string '$type' (length=5) 'isreference' => boolean false 'default' => string 'null' (length=4) 'modifiers' => array 0 => string 'public' (length=6) 'info' => array 0 => array 'uses' => string 'var' (length=3) 'name' => string '' (length=0) 'doc' => null 'parseddoc' => null 'docline' => null 2 => array 'type' => string 'method' (length=6) 'name' => string 'setType2' (length=8) 'startline' => int 21 'endline' => int 29 'parameters' => array 0 => array 'typehint' => string '' (length=0) 'param' => string '$type' (length=5) 'isreference' => boolean false 'default' => string 'null' (length=4) 'modifiers' => array 0 => string 'public' (length=6) 'info' => array 0 => array 'uses' => string 'var' (length=3) 'name' => string '' (length=0) 'doc' => null 'parseddoc' => null 'docline' => null 'doc' => string '/** * setType3 * @param int $type */' (length=39) 'parseddoc' => boolean false 'docline' => int 31 1 => array 'type' => string 'function' (length=8) 'startline' => int 35 'endline' => int 40 'returnsref' => boolean false 'name' => string 'setType3' (length=8) 'parameters' => array 0 => array 'typehint' => string '' (length=0) 'param' => string '$type' (length=5) 'isreference' => boolean false 'default' => string 'null' (length=4) 'info' => array 0 => array 'uses' => string 'var' (length=3) 'name' => string '' (length=0) 'doc' => string '' (length=0) 'parseddoc' => boolean false 'docline' => int -1 2 => array 'type' => string 'function' (length=8) 'startline' => int 40 'endline' => int 48 'returnsref' => boolean false 'name' => string 'setType4' (length=8) 'parameters' => array 0 => array 'typehint' => string '' (length=0) 'param' => string '$type' (length=5) 'isreference' => boolean false 'default' => string 'null' (length=4) 'info' => array 0 => array 'uses' => string 'var' (length=3) 'name' => string '' (length=0) 'doc' => string '/** * setType4 * @param int $type */' (length=39) 'parseddoc' => boolean false 'docline' => int 44

Comments