1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-05 19:42:38 +02:00

Add PHPUnit

This commit is contained in:
Daniel Neto 2025-04-02 10:53:30 -03:00
parent 1467777757
commit 5959dd49d7
1366 changed files with 118633 additions and 13161 deletions

View file

@ -6,55 +6,60 @@ use PhpParser\Node;
use PhpParser\Node\Expr;
use PhpParser\Node\FunctionLike;
class ArrowFunction extends Expr implements FunctionLike
{
/** @var bool */
public $static;
class ArrowFunction extends Expr implements FunctionLike {
/** @var bool Whether the closure is static */
public bool $static;
/** @var bool */
public $byRef;
/** @var bool Whether to return by reference */
public bool $byRef;
/** @var Node\Param[] */
public $params = [];
public array $params = [];
/** @var null|Node\Identifier|Node\Name|Node\ComplexType */
public $returnType;
public ?Node $returnType;
/** @var Expr */
public $expr;
/** @var Expr Expression body */
public Expr $expr;
/** @var Node\AttributeGroup[] */
public $attrGroups;
public array $attrGroups;
/**
* @param array $subNodes Array of the following optional subnodes:
* 'static' => false : Whether the closure is static
* 'byRef' => false : Whether to return by reference
* 'params' => array() : Parameters
* 'returnType' => null : Return type
* 'expr' => Expr : Expression body
* 'attrGroups' => array() : PHP attribute groups
* @param array $attributes Additional attributes
* @param array{
* expr: Expr,
* static?: bool,
* byRef?: bool,
* params?: Node\Param[],
* returnType?: null|Node\Identifier|Node\Name|Node\ComplexType,
* attrGroups?: Node\AttributeGroup[]
* } $subNodes Array of the following subnodes:
* 'expr' : Expression body
* 'static' => false : Whether the closure is static
* 'byRef' => false : Whether to return by reference
* 'params' => array() : Parameters
* 'returnType' => null : Return type
* 'attrGroups' => array() : PHP attribute groups
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct(array $subNodes = [], array $attributes = []) {
public function __construct(array $subNodes, array $attributes = []) {
$this->attributes = $attributes;
$this->static = $subNodes['static'] ?? false;
$this->byRef = $subNodes['byRef'] ?? false;
$this->params = $subNodes['params'] ?? [];
$returnType = $subNodes['returnType'] ?? null;
$this->returnType = \is_string($returnType) ? new Node\Identifier($returnType) : $returnType;
$this->returnType = $subNodes['returnType'] ?? null;
$this->expr = $subNodes['expr'];
$this->attrGroups = $subNodes['attrGroups'] ?? [];
}
public function getSubNodeNames() : array {
public function getSubNodeNames(): array {
return ['attrGroups', 'static', 'byRef', 'params', 'returnType', 'expr'];
}
public function returnsByRef() : bool {
public function returnsByRef(): bool {
return $this->byRef;
}
public function getParams() : array {
public function getParams(): array {
return $this->params;
}
@ -62,18 +67,18 @@ class ArrowFunction extends Expr implements FunctionLike
return $this->returnType;
}
public function getAttrGroups() : array {
public function getAttrGroups(): array {
return $this->attrGroups;
}
/**
* @return Node\Stmt\Return_[]
*/
public function getStmts() : array {
public function getStmts(): array {
return [new Node\Stmt\Return_($this->expr)];
}
public function getType() : string {
public function getType(): string {
return 'Expr_ArrowFunction';
}
}