class Trait_
Same name in this branch
- 11.1.x vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Trait_.php \PhpParser\Node\Scalar\MagicConst\Trait_
- 11.1.x vendor/nikic/php-parser/lib/PhpParser/Builder/Trait_.php \PhpParser\Builder\Trait_
Hierarchy
- class \PhpParser\Node\Stmt\ClassLike extends \Node\Stmt
- class \PhpParser\Node\Stmt\Trait_ extends \PhpParser\Node\Stmt\ClassLike
Expanded class hierarchy of Trait_
3 files declare their use of Trait_
- CodeUnitFindingVisitor.php in vendor/
phpunit/ php-code-coverage/ src/ StaticAnalysis/ CodeUnitFindingVisitor.php - ComplexityCalculatingVisitor.php in vendor/
sebastian/ complexity/ src/ Visitor/ ComplexityCalculatingVisitor.php - IgnoredLinesFindingVisitor.php in vendor/
phpunit/ php-code-coverage/ src/ StaticAnalysis/ IgnoredLinesFindingVisitor.php
2 string references to 'Trait_'
- Generator::mockObjectForTrait in vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ Generator.php - Returns a mock object for the specified trait with all abstract methods of the trait mocked. Concrete methods to mock can be specified with the `$mockedMethods` parameter.
- Generator::objectForTrait in vendor/
phpunit/ phpunit/ src/ Framework/ MockObject/ Generator/ Generator.php - Returns an object for the specified trait.
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ Node/ Stmt/ Trait_.php, line 7
Namespace
PhpParser\Node\StmtView source
class Trait_ extends ClassLike {
/**
* Constructs a trait node.
*
* @param string|Node\Identifier $name Name
* @param array{
* stmts?: Node\Stmt[],
* attrGroups?: Node\AttributeGroup[],
* } $subNodes Array of the following optional subnodes:
* 'stmts' => array(): Statements
* 'attrGroups' => array(): PHP attribute groups
* @param array<string, mixed> $attributes Additional attributes
*/
public function __construct($name, array $subNodes = [], array $attributes = []) {
$this->attributes = $attributes;
$this->name = \is_string($name) ? new Node\Identifier($name) : $name;
$this->stmts = $subNodes['stmts'] ?? [];
$this->attrGroups = $subNodes['attrGroups'] ?? [];
}
public function getSubNodeNames() : array {
return [
'attrGroups',
'name',
'stmts',
];
}
public function getType() : string {
return 'Stmt_Trait';
}
}
Members
Title Sort descending | Modifiers | Object type | Summary |
---|---|---|---|
ClassLike::$attrGroups | public | property | @var Node\AttributeGroup[] PHP attribute groups |
ClassLike::$name | public | property | @var Node\Identifier|null Name |
ClassLike::$namespacedName | public | property | @var Node\Name|null Namespaced name (if using NameResolver) |
ClassLike::$stmts | public | property | @var Node\Stmt[] Statements |
ClassLike::getConstants | public | function | |
ClassLike::getMethod | public | function | Gets method with the given name defined directly in this class/interface/trait. |
ClassLike::getMethods | public | function | Gets all methods defined directly in this class/interface/trait |
ClassLike::getProperties | public | function | |
ClassLike::getProperty | public | function | Gets property with the given name defined directly in this class/interface/trait. |
ClassLike::getTraitUses | public | function | |
Trait_::getSubNodeNames | public | function | |
Trait_::getType | public | function | |
Trait_::__construct | public | function | Constructs a trait node. |