PluginProbe
Code Engine – PHP Snippets, AI Functions & Automation for WordPress / 0.5.1
Code Engine – PHP Snippets, AI Functions & Automation for WordPress v0.5.1
0.5.7 0.5.6 0.5.5 0.5.4 0.5.3 0.5.2 0.5.1 0.5.0 0.4.9 0.4.8 0.4.7 0.4.6 trunk 0.0.1 0.0.2 0.2.8 0.2.9 0.3.0 0.3.1 0.3.2 0.3.3 0.3.4 0.3.5 0.3.6 0.3.7 All 33 releases
code-engine / vendor / nikic / php-parser / lib / PhpParser / Node / Param.php

Param.php in Code Engine – PHP Snippets, AI Functions & Automation for WordPress 0.5.1, at vendor/nikic/php-parser/lib/PhpParser/Node/Param.php

85 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php declare(strict_types=1);
2
3 namespace PhpParser\Node;
4
5 use PhpParser\Modifiers;
6 use PhpParser\Node;
7 use PhpParser\NodeAbstract;
8
9 class Param extends NodeAbstract {
10 /** @var null|Identifier|Name|ComplexType Type declaration */
11 public ?Node $type;
12 /** @var bool Whether parameter is passed by reference */
13 public bool $byRef;
14 /** @var bool Whether this is a variadic argument */
15 public bool $variadic;
16 /** @var Expr\Variable|Expr\Error Parameter variable */
17 public Expr $var;
18 /** @var null|Expr Default value */
19 public ?Expr $default;
20 /** @var int Optional visibility flags */
21 public int $flags;
22 /** @var AttributeGroup[] PHP attribute groups */
23 public array $attrGroups;
24
25 /**
26 * Constructs a parameter node.
27 *
28 * @param Expr\Variable|Expr\Error $var Parameter variable
29 * @param null|Expr $default Default value
30 * @param null|Identifier|Name|ComplexType $type Type declaration
31 * @param bool $byRef Whether is passed by reference
32 * @param bool $variadic Whether this is a variadic argument
33 * @param array<string, mixed> $attributes Additional attributes
34 * @param int $flags Optional visibility flags
35 * @param list<AttributeGroup> $attrGroups PHP attribute groups
36 */
37 public function __construct(
38 Expr $var, ?Expr $default = null, ?Node $type = null,
39 bool $byRef = false, bool $variadic = false,
40 array $attributes = [],
41 int $flags = 0,
42 array $attrGroups = []
43 ) {
44 $this->attributes = $attributes;
45 $this->type = $type;
46 $this->byRef = $byRef;
47 $this->variadic = $variadic;
48 $this->var = $var;
49 $this->default = $default;
50 $this->flags = $flags;
51 $this->attrGroups = $attrGroups;
52 }
53
54 public function getSubNodeNames(): array {
55 return ['attrGroups', 'flags', 'type', 'byRef', 'variadic', 'var', 'default'];
56 }
57
58 public function getType(): string {
59 return 'Param';
60 }
61
62 /**
63 * Whether this parameter uses constructor property promotion.
64 */
65 public function isPromoted(): bool {
66 return $this->flags !== 0;
67 }
68
69 public function isPublic(): bool {
70 return (bool) ($this->flags & Modifiers::PUBLIC);
71 }
72
73 public function isProtected(): bool {
74 return (bool) ($this->flags & Modifiers::PROTECTED);
75 }
76
77 public function isPrivate(): bool {
78 return (bool) ($this->flags & Modifiers::PRIVATE);
79 }
80
81 public function isReadonly(): bool {
82 return (bool) ($this->flags & Modifiers::READONLY);
83 }
84 }
85