Mercurial > hg > isophonics-drupal-site
diff vendor/nikic/php-parser/lib/PhpParser/NodeDumper.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 |
line wrap: on
line diff
--- a/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php Fri Feb 23 15:52:07 2018 +0000 +++ b/vendor/nikic/php-parser/lib/PhpParser/NodeDumper.php Mon Apr 23 09:33:26 2018 +0100 @@ -1,4 +1,4 @@ -<?php +<?php declare(strict_types=1); namespace PhpParser; @@ -39,7 +39,7 @@ * * @return string Dumped value */ - public function dump($node, $code = null) { + public function dump($node, string $code = null) : string { $this->code = $code; return $this->dumpRecursive($node); } @@ -65,9 +65,9 @@ } elseif (is_scalar($value)) { if ('flags' === $key || 'newModifier' === $key) { $r .= $this->dumpFlags($value); - } else if ('type' === $key && $node instanceof Include_) { + } elseif ('type' === $key && $node instanceof Include_) { $r .= $this->dumpIncludeType($value); - } else if ('type' === $key + } elseif ('type' === $key && ($node instanceof Use_ || $node instanceof UseUse || $node instanceof GroupUse)) { $r .= $this->dumpUseType($value); } else { @@ -78,7 +78,7 @@ } } - if ($this->dumpComments && $comments = $node->getAttribute('comments')) { + if ($this->dumpComments && $comments = $node->getComments()) { $r .= "\n comments: " . str_replace("\n", "\n ", $this->dumpRecursive($comments)); } } elseif (is_array($node)) { @@ -141,7 +141,7 @@ Include_::TYPE_INCLUDE => 'TYPE_INCLUDE', Include_::TYPE_INCLUDE_ONCE => 'TYPE_INCLUDE_ONCE', Include_::TYPE_REQUIRE => 'TYPE_REQUIRE', - Include_::TYPE_REQUIRE_ONCE => 'TYPE_REQURE_ONCE', + Include_::TYPE_REQUIRE_ONCE => 'TYPE_REQUIRE_ONCE', ]; if (!isset($map[$type])) { @@ -164,18 +164,25 @@ return $map[$type] . ' (' . $type . ')'; } + /** + * Dump node position, if possible. + * + * @param Node $node Node for which to dump position + * + * @return string|null Dump of position, or null if position information not available + */ protected function dumpPosition(Node $node) { if (!$node->hasAttribute('startLine') || !$node->hasAttribute('endLine')) { return null; } - $start = $node->getAttribute('startLine'); - $end = $node->getAttribute('endLine'); + $start = $node->getStartLine(); + $end = $node->getEndLine(); if ($node->hasAttribute('startFilePos') && $node->hasAttribute('endFilePos') && null !== $this->code ) { - $start .= ':' . $this->toColumn($this->code, $node->getAttribute('startFilePos')); - $end .= ':' . $this->toColumn($this->code, $node->getAttribute('endFilePos')); + $start .= ':' . $this->toColumn($this->code, $node->getStartFilePos()); + $end .= ':' . $this->toColumn($this->code, $node->getEndFilePos()); } return "[$start - $end]"; }