2022-06-12 21:55:56 +02:00
|
|
|
<?php declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace PhpParser\Node;
|
|
|
|
|
|
|
|
use PhpParser\NodeAbstract;
|
|
|
|
|
2022-08-28 22:57:06 +02:00
|
|
|
class ClosureUse extends NodeAbstract {
|
2022-06-12 21:55:56 +02:00
|
|
|
/** @var Expr\Variable Variable to use */
|
2023-08-16 21:18:30 +02:00
|
|
|
public Expr\Variable $var;
|
2022-06-12 21:55:56 +02:00
|
|
|
/** @var bool Whether to use by reference */
|
2023-08-16 21:18:30 +02:00
|
|
|
public bool $byRef;
|
2022-06-12 21:55:56 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Constructs a closure use node.
|
|
|
|
*
|
2023-09-17 15:59:04 +02:00
|
|
|
* @param Expr\Variable $var Variable to use
|
|
|
|
* @param bool $byRef Whether to use by reference
|
2022-09-11 20:51:31 +02:00
|
|
|
* @param array<string, mixed> $attributes Additional attributes
|
2022-06-12 21:55:56 +02:00
|
|
|
*/
|
|
|
|
public function __construct(Expr\Variable $var, bool $byRef = false, array $attributes = []) {
|
|
|
|
$this->attributes = $attributes;
|
|
|
|
$this->var = $var;
|
|
|
|
$this->byRef = $byRef;
|
|
|
|
}
|
|
|
|
|
2022-08-28 22:57:06 +02:00
|
|
|
public function getSubNodeNames(): array {
|
2022-06-12 21:55:56 +02:00
|
|
|
return ['var', 'byRef'];
|
|
|
|
}
|
2022-08-28 22:57:06 +02:00
|
|
|
|
|
|
|
public function getType(): string {
|
2022-06-12 21:55:56 +02:00
|
|
|
return 'ClosureUse';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// @deprecated compatibility alias
|
2022-07-04 17:17:01 +02:00
|
|
|
class_alias(ClosureUse::class, Expr\ClosureUse::class);
|