function ClassLike::getProperty
Gets property with the given name defined directly in this class/interface/trait.
Parameters
string $name Name of the property:
Return value
Property|null Property node or null if the property does not exist
File
-
vendor/
nikic/ php-parser/ lib/ PhpParser/ Node/ Stmt/ ClassLike.php, line 65
Class
Namespace
PhpParser\Node\StmtCode
public function getProperty(string $name) : ?Property {
foreach ($this->stmts as $stmt) {
if ($stmt instanceof Property) {
foreach ($stmt->props as $prop) {
if ($prop instanceof PropertyItem && $name === $prop->name
->toString()) {
return $stmt;
}
}
}
}
return null;
}