class Class_
Same name in this branch
- 11.1.x vendor/nikic/php-parser/lib/PhpParser/Node/Scalar/MagicConst/Class_.php \PhpParser\Node\Scalar\MagicConst\Class_
- 11.1.x vendor/nikic/php-parser/lib/PhpParser/Builder/Class_.php \PhpParser\Builder\Class_
- 11.1.x vendor/mck89/peast/lib/Peast/Syntax/Node/Class_.php \Peast\Syntax\Node\Class_
Hierarchy
- class \PhpParser\Node\Stmt\ClassLike extends \Node\Stmt
- class \PhpParser\Node\Stmt\Class_ extends \PhpParser\Node\Stmt\ClassLike
Expanded class hierarchy of Class_
9 files declare their use of Class_
- ClassExtendsInternalClassRule.php in vendor/
mglaman/ phpstan-drupal/ src/ Rules/ Classes/ ClassExtendsInternalClassRule.php - 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 - ImplementationOfDeprecatedInterfaceRule.php in vendor/
phpstan/ phpstan-deprecation-rules/ src/ Rules/ Deprecations/ ImplementationOfDeprecatedInterfaceRule.php
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ Node/ Stmt/ Class_.php, line 8
Namespace
PhpParser\Node\StmtView source
class Class_ extends ClassLike {
/** @deprecated Use Modifiers::PUBLIC instead */
public const MODIFIER_PUBLIC = 1;
/** @deprecated Use Modifiers::PROTECTED instead */
public const MODIFIER_PROTECTED = 2;
/** @deprecated Use Modifiers::PRIVATE instead */
public const MODIFIER_PRIVATE = 4;
/** @deprecated Use Modifiers::STATIC instead */
public const MODIFIER_STATIC = 8;
/** @deprecated Use Modifiers::ABSTRACT instead */
public const MODIFIER_ABSTRACT = 16;
/** @deprecated Use Modifiers::FINAL instead */
public const MODIFIER_FINAL = 32;
/** @deprecated Use Modifiers::READONLY instead */
public const MODIFIER_READONLY = 64;
/** @deprecated Use Modifiers::VISIBILITY_MASK instead */
public const VISIBILITY_MODIFIER_MASK = 7;
// 1 | 2 | 4
/** @var int Modifiers */
public int $flags;
/** @var null|Node\Name Name of extended class */
public ?Node\Name $extends;
/** @var Node\Name[] Names of implemented interfaces */
public array $implements;
/**
* Constructs a class node.
*
* @param string|Node\Identifier|null $name Name
* @param array{
* flags?: int,
* extends?: Node\Name|null,
* implements?: Node\Name[],
* stmts?: Node\Stmt[],
* attrGroups?: Node\AttributeGroup[],
* } $subNodes Array of the following optional subnodes:
* 'flags' => 0 : Flags
* 'extends' => null : Name of extended class
* 'implements' => array(): Names of implemented interfaces
* '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->flags = $subNodes['flags'] ?? $subNodes['type'] ?? 0;
$this->name = \is_string($name) ? new Node\Identifier($name) : $name;
$this->extends = $subNodes['extends'] ?? null;
$this->implements = $subNodes['implements'] ?? [];
$this->stmts = $subNodes['stmts'] ?? [];
$this->attrGroups = $subNodes['attrGroups'] ?? [];
}
public function getSubNodeNames() : array {
return [
'attrGroups',
'flags',
'name',
'extends',
'implements',
'stmts',
];
}
/**
* Whether the class is explicitly abstract.
*/
public function isAbstract() : bool {
return (bool) ($this->flags & Modifiers::ABSTRACT);
}
/**
* Whether the class is final.
*/
public function isFinal() : bool {
return (bool) ($this->flags & Modifiers::FINAL);
}
public function isReadonly() : bool {
return (bool) ($this->flags & Modifiers::READONLY);
}
/**
* Whether the class is anonymous.
*/
public function isAnonymous() : bool {
return null === $this->name;
}
public function getType() : string {
return 'Stmt_Class';
}
}
Members
Title Sort descending | Deprecated | 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 | ||
Class_::$extends | public | property | @var null|Node\Name Name of extended class | |
Class_::$flags | public | property | @var int Modifiers | |
Class_::$implements | public | property | @var Node\Name[] Names of implemented interfaces | |
Class_::getSubNodeNames | public | function | ||
Class_::getType | public | function | ||
Class_::isAbstract | public | function | Whether the class is explicitly abstract. | |
Class_::isAnonymous | public | function | Whether the class is anonymous. | |
Class_::isFinal | public | function | Whether the class is final. | |
Class_::isReadonly | public | function | ||
Class_::MODIFIER_ABSTRACT | Deprecated | public | constant | |
Class_::MODIFIER_FINAL | Deprecated | public | constant | |
Class_::MODIFIER_PRIVATE | Deprecated | public | constant | |
Class_::MODIFIER_PROTECTED | Deprecated | public | constant | |
Class_::MODIFIER_PUBLIC | Deprecated | public | constant | |
Class_::MODIFIER_READONLY | Deprecated | public | constant | |
Class_::MODIFIER_STATIC | Deprecated | public | constant | |
Class_::VISIBILITY_MODIFIER_MASK | Deprecated | public | constant | |
Class_::__construct | public | function | Constructs a class node. |