-
Notifications
You must be signed in to change notification settings - Fork 79
/
Copy pathParameter.php
64 lines (58 loc) · 1.77 KB
/
Parameter.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
namespace Microsoft\PhpParser\Node;
use Microsoft\PhpParser\MissingToken;
use Microsoft\PhpParser\Node;
use Microsoft\PhpParser\Token;
class Parameter extends Node {
/** @var AttributeGroup[]|null */
public $attributes;
/** @var Token|null */
public $visibilityToken;
/** @var Token[]|null */
public $modifiers;
/** @var Token|null */
public $questionToken;
/** @var DelimitedList\QualifiedNameList|MissingToken|null */
public $typeDeclarationList;
/** @var Token|null */
public $byRefToken;
/** @var Token|null */
public $dotDotDotToken;
/** @var Token */
public $variableName;
/** @var Token|null */
public $equalsToken;
/** @var null|Expression */
public $default;
/** @var PropertyHooks|null */
public $propertyHooks;
const CHILD_NAMES = [
'attributes',
'visibilityToken',
'modifiers',
'questionToken',
'typeDeclarationList',
'byRefToken',
'dotDotDotToken',
'variableName',
'equalsToken',
'default',
'propertyHooks',
];
public function isVariadic() {
return $this->byRefToken !== null;
}
public function getName() {
if (
$this->variableName instanceof Token &&
$name = substr($this->variableName->getText($this->getFileContents()), 1)
) {
return $name;
}
return null;
}
}