mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-27 04:24:43 +01:00
Make some doc comments more precise
Additionally add two further constructors
This commit is contained in:
parent
ee4e55dc75
commit
ea65ea7a32
@ -206,7 +206,7 @@ catches:
|
||||
|
||||
catch:
|
||||
T_CATCH '(' name T_VARIABLE ')' '{' inner_statement_list '}'
|
||||
{ $$ = Stmt_Catch[type: $3, var: parseVar($4), stmts: $7]; }
|
||||
{ $$ = Stmt_Catch[$3, parseVar($4), $7]; }
|
||||
;
|
||||
|
||||
variables_list:
|
||||
@ -287,9 +287,9 @@ switch_case_list:
|
||||
case_list:
|
||||
/* empty */ { init(); }
|
||||
| case_list T_CASE expr case_separator inner_statement_list
|
||||
{ push($1, Stmt_Case[cond: $3, stmts: $5]); }
|
||||
{ push($1, Stmt_Case[$5, $3]); }
|
||||
| case_list T_DEFAULT case_separator inner_statement_list
|
||||
{ push($1, Stmt_Case[cond: null, stmts: $4]); }
|
||||
{ push($1, Stmt_Case[$4, null]); }
|
||||
;
|
||||
|
||||
case_separator:
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property array $stmts Statements
|
||||
* @property PHPParser_Node[] $stmts Statements
|
||||
* @property PHPParser_Node_Stmt_FuncParam[] $params Parameters
|
||||
* @property PHPParser_Node_Expr_LambdaFuncUse[] $uses use()s
|
||||
* @property bool $byRef Whether to return by reference
|
||||
@ -11,7 +11,7 @@ class PHPParser_Node_Expr_LambdaFunc extends PHPParser_Node_Expr
|
||||
/**
|
||||
* Constructs a lambda function node.
|
||||
*
|
||||
* @param array $stmts Statements
|
||||
* @param PHPParser_Node[] $stmts Statements
|
||||
* @param PHPParser_Node_Stmt_FuncParam[] $params Parameters
|
||||
* @param PHPParser_Node_Expr_LambdaFuncUse[] $uses use()s
|
||||
* @param bool $byRef Whether to return by reference
|
||||
|
@ -1,9 +1,26 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* @property null|PHPParser_Node_Expr $cond Condition (null for default)
|
||||
* @property array $stmts Statements
|
||||
* @property PHPParser_Node[] $stmts Statements
|
||||
* @property null|PHPParser_Node_Expr $cond Condition (null for default)
|
||||
*/
|
||||
class PHPParser_Node_Stmt_Case extends PHPParser_Node_Stmt
|
||||
{
|
||||
/**
|
||||
* Constructs a case node.
|
||||
*
|
||||
* @param PHPParser_Node[] $stmts Statements
|
||||
* @param null|PHPParser_Node_Expr $cond Condition (null for default)
|
||||
* @param int $line Line
|
||||
* @param null|string $docComment Nearest doc comment
|
||||
*/
|
||||
public function __construct(array $stmts, PHPParser_Node_Expr $cond = null, $line = -1, $docComment = null) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'stmts' => $stmts,
|
||||
'cond' => $cond,
|
||||
),
|
||||
$line, $docComment
|
||||
);
|
||||
}
|
||||
}
|
@ -2,9 +2,28 @@
|
||||
|
||||
/**
|
||||
* @property PHPParser_Node_Name $type Class of exception
|
||||
* @property string $var Variable for exception
|
||||
* @property array $stmts Statements
|
||||
* @property string $var Variable for exception
|
||||
* @property PHPParser_Node[] $stmts Statements
|
||||
*/
|
||||
class PHPParser_Node_Stmt_Catch extends PHPParser_Node_Stmt
|
||||
{
|
||||
/**
|
||||
* Constructs a catch node.
|
||||
*
|
||||
* @param PHPParser_Node_Name $type Class of exception
|
||||
* @param string $var Variable for exception
|
||||
* @param PHPParser_Node[] $stmts Statements
|
||||
* @param int $line Line
|
||||
* @param null|string $docComment Nearest doc comment
|
||||
*/
|
||||
public function __construct(PHPParser_Node_Name $type, $var, array $stmts, $line = -1, $docComment = null) {
|
||||
parent::__construct(
|
||||
array(
|
||||
'type' => $type,
|
||||
'var' => $var,
|
||||
'stmts' => $stmts,
|
||||
),
|
||||
$line, $docComment
|
||||
);
|
||||
}
|
||||
}
|
@ -1220,7 +1220,7 @@ class PHPParser_Parser
|
||||
}
|
||||
|
||||
protected function yyn60($line, $docComment) {
|
||||
$this->yyval = new PHPParser_Node_Stmt_Catch(array('type' => $this->yyastk[$this->yysp-(8-3)], 'var' => substr($this->yyastk[$this->yysp-(8-4)], 1), 'stmts' => $this->yyastk[$this->yysp-(8-7)]), $line, $docComment);
|
||||
$this->yyval = new PHPParser_Node_Stmt_Catch($this->yyastk[$this->yysp-(8-3)], substr($this->yyastk[$this->yysp-(8-4)], 1), $this->yyastk[$this->yysp-(8-7)], $line, $docComment);
|
||||
}
|
||||
|
||||
protected function yyn61($line, $docComment) {
|
||||
@ -1348,11 +1348,11 @@ class PHPParser_Parser
|
||||
}
|
||||
|
||||
protected function yyn92($line, $docComment) {
|
||||
$this->yyastk[$this->yysp-(5-1)][] = new PHPParser_Node_Stmt_Case(array('cond' => $this->yyastk[$this->yysp-(5-3)], 'stmts' => $this->yyastk[$this->yysp-(5-5)]), $line, $docComment); $this->yyval = $this->yyastk[$this->yysp-(5-1)];
|
||||
$this->yyastk[$this->yysp-(5-1)][] = new PHPParser_Node_Stmt_Case($this->yyastk[$this->yysp-(5-5)], $this->yyastk[$this->yysp-(5-3)], $line, $docComment); $this->yyval = $this->yyastk[$this->yysp-(5-1)];
|
||||
}
|
||||
|
||||
protected function yyn93($line, $docComment) {
|
||||
$this->yyastk[$this->yysp-(4-1)][] = new PHPParser_Node_Stmt_Case(array('cond' => null, 'stmts' => $this->yyastk[$this->yysp-(4-4)]), $line, $docComment); $this->yyval = $this->yyastk[$this->yysp-(4-1)];
|
||||
$this->yyastk[$this->yysp-(4-1)][] = new PHPParser_Node_Stmt_Case($this->yyastk[$this->yysp-(4-4)], null, $line, $docComment); $this->yyval = $this->yyastk[$this->yysp-(4-1)];
|
||||
}
|
||||
|
||||
protected function yyn94() {
|
||||
|
@ -71,7 +71,7 @@ abstract class PHPParser_PrettyPrinterAbstract
|
||||
/**
|
||||
* Pretty prints an array of nodes (statements).
|
||||
*
|
||||
* @param array $nodes Array of nodes
|
||||
* @param PHPParser_Node[] $nodes Array of nodes
|
||||
*
|
||||
* @return string Pretty printed nodes
|
||||
*/
|
||||
@ -93,8 +93,8 @@ abstract class PHPParser_PrettyPrinterAbstract
|
||||
/**
|
||||
* Pretty prints an array of nodes (statements) and indents them optionally.
|
||||
*
|
||||
* @param array $nodes Array of nodes
|
||||
* @param bool $indent Whether to indent the printed nodes
|
||||
* @param PHPParser_Node[] $nodes Array of nodes
|
||||
* @param bool $indent Whether to indent the printed nodes
|
||||
*
|
||||
* @return string Pretty printed statements
|
||||
*/
|
||||
@ -151,8 +151,8 @@ abstract class PHPParser_PrettyPrinterAbstract
|
||||
/**
|
||||
* Pretty prints an array of nodes and implodes the printed values.
|
||||
*
|
||||
* @param array $nodes Array of Nodes to be printed
|
||||
* @param string $glue Character to implode with
|
||||
* @param PHPParser_Node[] $nodes Array of Nodes to be printed
|
||||
* @param string $glue Character to implode with
|
||||
*
|
||||
* @return string Imploded pretty printed nodes
|
||||
*/
|
||||
@ -168,7 +168,7 @@ abstract class PHPParser_PrettyPrinterAbstract
|
||||
/**
|
||||
* Pretty prints an array of nodes and implodes the printed values with commas.
|
||||
*
|
||||
* @param array $nodes Array of Nodes to be printed
|
||||
* @param PHPParser_Node[] $nodes Array of Nodes to be printed
|
||||
*
|
||||
* @return string Comma separated pretty printed nodes
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user