Skip to content
Snippets Groups Projects
Commit 17d0f27e authored by ghost of drupal past's avatar ghost of drupal past Committed by Fran Garcia-Linares
Browse files

Issue #3534214 by ghost of drupal past, fjgarlin: Update php-parser library so...

Issue #3534214 by ghost of drupal past, fjgarlin: Update php-parser library so we can have D11 compatibility
parent 3c30039f
Branches
No related tags found
1 merge request!68temporarily force parser v5 to see what happens
Pipeline #546782 passed
......@@ -20,11 +20,11 @@
"source": "http://cgit.drupalcode.org/api"
},
"require": {
"nikic/php-parser": "^4.7",
"nikic/php-parser": "^5",
"league/commonmark": "~2.4",
"drupal/pathauto": "^1.8",
"czproject/git-php": "^4.0.1",
"chx/drupal-pretty-printer": "^0.4"
"chx/drupal-pretty-printer": "^0.6"
},
"require-dev": {
"drush/drush": "^12.5 || ^13"
......
......@@ -23,8 +23,8 @@ use GuzzleHttp\Exception\ClientException;
use League\CommonMark\CommonMarkConverter;
use PhpParser\Comment\Doc as CommentDoc;
use PhpParser\Error as ParserError;
use PhpParser\Modifiers;
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\Class_ as NodeClass;
use PhpParser\Node\Stmt\ClassLike as NodeClassLike;
use PhpParser\Node\Stmt\Function_ as NodeFunction;
use PhpParser\ParserFactory;
......@@ -238,7 +238,7 @@ class Parser {
$this->fileSystem = $file_system;
$this->loggerService = $logger_service;
$this->logger = $this->loggerService->get('api');
$this->phpParser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7);
$this->phpParser = (new ParserFactory())->createForNewestSupportedVersion();
$this->parseQueue = $this->queueFactory->get(self::QUEUE_PARSE);
$this->parseQueue->createQueue();
}
......@@ -1326,7 +1326,7 @@ class Parser {
// Function argument.
$sub_statements = $statement->value;
}
elseif ($type == 'Expr_ArrayItem') {
elseif ($type == 'ArrayItem') {
// Array item.
if ($statement->key && $statement->key->getType() == 'Scalar_String') {
$sub_state['array_key'] = $statement->key->value;
......@@ -1453,7 +1453,7 @@ class Parser {
/** @var \PhpParser\Node\Stmt $statement */
foreach ($statements as $statement) {
$docblock = $default_block;
$docblock['start_line'] = $statement->getLine();
$docblock['start_line'] = $statement->getStartLine();
$docblock['content'] = '';
if (!empty($statement->attrGroups)) {
foreach ($statement->attrGroups as $attrGroup) {
......@@ -1748,12 +1748,12 @@ class Parser {
$modifiers = '';
$modifier_list = [
// Note: Keep this list in the order that the modifiers should appear.
NodeClass::MODIFIER_ABSTRACT => 'abstract',
NodeClass::MODIFIER_FINAL => 'final',
NodeClass::MODIFIER_PUBLIC => 'public',
NodeClass::MODIFIER_PROTECTED => 'protected',
NodeClass::MODIFIER_PRIVATE => 'private',
NodeClass::MODIFIER_STATIC => 'static',
Modifiers::ABSTRACT => 'abstract',
Modifiers::FINAL => 'final',
Modifiers::PUBLIC => 'public',
Modifiers::PROTECTED => 'protected',
Modifiers::PRIVATE => 'private',
Modifiers::STATIC => 'static',
];
foreach ($modifier_list as $flag => $name) {
if ($flags & $flag) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment