comparison vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.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\Parser; 3 namespace PhpParser\Parser;
4 4
5 use PhpParser\Error; 5 use PhpParser\Error;
6 use PhpParser\ErrorHandler; 6 use PhpParser\ErrorHandler;
7 use PhpParser\Parser; 7 use PhpParser\Parser;
8 8
9 class Multiple implements Parser { 9 class Multiple implements Parser
10 {
10 /** @var Parser[] List of parsers to try, in order of preference */ 11 /** @var Parser[] List of parsers to try, in order of preference */
11 private $parsers; 12 private $parsers;
12 13
13 /** 14 /**
14 * Create a parser which will try multiple parsers in an order of preference. 15 * Create a parser which will try multiple parsers in an order of preference.
21 */ 22 */
22 public function __construct(array $parsers) { 23 public function __construct(array $parsers) {
23 $this->parsers = $parsers; 24 $this->parsers = $parsers;
24 } 25 }
25 26
26 public function parse($code, ErrorHandler $errorHandler = null) { 27 public function parse(string $code, ErrorHandler $errorHandler = null) {
27 if (null === $errorHandler) { 28 if (null === $errorHandler) {
28 $errorHandler = new ErrorHandler\Throwing; 29 $errorHandler = new ErrorHandler\Throwing;
29 } 30 }
30 31
31 list($firstStmts, $firstError) = $this->tryParse($this->parsers[0], $errorHandler, $code); 32 list($firstStmts, $firstError) = $this->tryParse($this->parsers[0], $errorHandler, $code);