No Description

Function_.php 1.2KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace PhpParser\Node\Stmt;
  3. use PhpParser\Node;
  4. /**
  5. * @property bool $byRef Whether returns by reference
  6. * @property string $name Name
  7. * @property Node\Param[] $params Parameters
  8. * @property Node[] $stmts Statements
  9. */
  10. class Function_ extends Node\Stmt
  11. {
  12. /**
  13. * Constructs a function node.
  14. *
  15. * @param string $name Name
  16. * @param array $subNodes Array of the following optional subnodes:
  17. * 'byRef' => false : Whether to return by reference
  18. * 'params' => array(): Parameters
  19. * 'stmts' => array(): Statements
  20. * @param array $attributes Additional attributes
  21. */
  22. public function __construct($name, array $subNodes = array(), array $attributes = array()) {
  23. parent::__construct(
  24. array(
  25. 'byRef' => isset($subNodes['byRef']) ? $subNodes['byRef'] : false,
  26. 'name' => $name,
  27. 'params' => isset($subNodes['params']) ? $subNodes['params'] : array(),
  28. 'stmts' => isset($subNodes['stmts']) ? $subNodes['stmts'] : array(),
  29. ),
  30. $attributes
  31. );
  32. $this->name = $name;
  33. }
  34. }