Chris@13: stmts as $stmt) { Chris@0: if ($stmt instanceof ClassMethod) { Chris@0: $methods[] = $stmt; Chris@0: } Chris@0: } Chris@0: return $methods; Chris@0: } Chris@0: Chris@0: /** Chris@0: * Gets method with the given name defined directly in this class/interface/trait. Chris@0: * Chris@0: * @param string $name Name of the method (compared case-insensitively) Chris@0: * Chris@0: * @return ClassMethod|null Method node or null if the method does not exist Chris@0: */ Chris@13: public function getMethod(string $name) { Chris@0: $lowerName = strtolower($name); Chris@0: foreach ($this->stmts as $stmt) { Chris@13: if ($stmt instanceof ClassMethod && $lowerName === $stmt->name->toLowerString()) { Chris@0: return $stmt; Chris@0: } Chris@0: } Chris@0: return null; Chris@0: } Chris@0: }