comparison vendor/nikic/php-parser/lib/PhpParser/Node/Stmt/ClassLike.php @ 13:5fb285c0d0e3

Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've been lucky to get away with this so far, as we don't support self-registration which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5 was vulnerable to.
author Chris Cannam
date Mon, 23 Apr 2018 09:33:26 +0100
parents 4c8ae668cc8c
children
comparison
equal deleted inserted replaced
12:7a779792577d 13:5fb285c0d0e3
1 <?php 1 <?php declare(strict_types=1);
2 2
3 namespace PhpParser\Node\Stmt; 3 namespace PhpParser\Node\Stmt;
4 4
5 use PhpParser\Node; 5 use PhpParser\Node;
6 6
7 abstract class ClassLike extends Node\Stmt { 7 /**
8 /** @var string|null Name */ 8 * @property Node\Name $namespacedName Namespaced name (if using NameResolver)
9 */
10 abstract class ClassLike extends Node\Stmt
11 {
12 /** @var Node\Identifier|null Name */
9 public $name; 13 public $name;
10 /** @var Node[] Statements */ 14 /** @var Node\Stmt[] Statements */
11 public $stmts; 15 public $stmts;
12 16
13 /** 17 /**
14 * Gets all methods defined directly in this class/interface/trait 18 * Gets all methods defined directly in this class/interface/trait
15 * 19 *
16 * @return ClassMethod[] 20 * @return ClassMethod[]
17 */ 21 */
18 public function getMethods() { 22 public function getMethods() : array {
19 $methods = array(); 23 $methods = [];
20 foreach ($this->stmts as $stmt) { 24 foreach ($this->stmts as $stmt) {
21 if ($stmt instanceof ClassMethod) { 25 if ($stmt instanceof ClassMethod) {
22 $methods[] = $stmt; 26 $methods[] = $stmt;
23 } 27 }
24 } 28 }
30 * 34 *
31 * @param string $name Name of the method (compared case-insensitively) 35 * @param string $name Name of the method (compared case-insensitively)
32 * 36 *
33 * @return ClassMethod|null Method node or null if the method does not exist 37 * @return ClassMethod|null Method node or null if the method does not exist
34 */ 38 */
35 public function getMethod($name) { 39 public function getMethod(string $name) {
36 $lowerName = strtolower($name); 40 $lowerName = strtolower($name);
37 foreach ($this->stmts as $stmt) { 41 foreach ($this->stmts as $stmt) {
38 if ($stmt instanceof ClassMethod && $lowerName === strtolower($stmt->name)) { 42 if ($stmt instanceof ClassMethod && $lowerName === $stmt->name->toLowerString()) {
39 return $stmt; 43 return $stmt;
40 } 44 }
41 } 45 }
42 return null; 46 return null;
43 } 47 }