Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Commit

Permalink
Merge #43
Browse files Browse the repository at this point in the history
43: fix(php-parser) Update to `nikic/php-parser` 4.*. r=Hywan a=Hywan
  • Loading branch information
bors[bot] committed Apr 5, 2018
2 parents 80d0b2d + aee69dd commit 78a5e02
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"hoa/router" : "~3.0",
"hoa/view" : "~3.0",
"league/commonmark": "~0.16",
"nikic/php-parser" : "~3.1"
"nikic/php-parser" : "~4.0"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 5 additions & 5 deletions src/Compiler/IntermediateRepresentation/Into.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function __construct(string $filename)
*/
public function leaveNode(Node $node)
{
if ($node instanceof Node\Stmt\Class_) {
if ($node instanceof Node\Stmt\Class_ && false === $node->isAnonymous()) {
$classNode = $node;
$class = new Class_($classNode->namespacedName->toString());
$class->lineStart = $classNode->getAttribute('startLine');
Expand Down Expand Up @@ -195,7 +195,7 @@ protected function intoConstants(Node\Stmt\ClassLike $node): array
}

foreach ($statement->consts as $constantNode) {
$constant = new Constant($constantNode->name);
$constant = new Constant($constantNode->name->name);
$constant->visibility = $visibility;
$constant->value = $this->_prettyPrinter->prettyPrint([$constantNode->value]);

Expand Down Expand Up @@ -247,7 +247,7 @@ protected function intoAttributes(Node\Stmt\ClassLike $node): array
$static = $statement->isStatic();

foreach ($statement->props as $attributeNode) {
$attribute = new Attribute($attributeNode->name);
$attribute = new Attribute($attributeNode->name->name);
$attribute->visibility = $visibility;
$attribute->static = $static;

Expand Down Expand Up @@ -279,7 +279,7 @@ protected function intoMethods(Node\Stmt\ClassLike $node): array
$methods = [];

foreach ($node->getMethods() as $methodNode) {
$method = new Method($methodNode->name);
$method = new Method($methodNode->name->name);
$method->lineStart = $methodNode->getAttribute('startLine');
$method->lineEnd = $methodNode->getAttribute('endLine');

Expand Down Expand Up @@ -319,7 +319,7 @@ protected function intoInputs($node): array
$parametersNode = $node->params;

foreach ($parametersNode as $parameterNode) {
$parameter = new Parameter($parameterNode->name);
$parameter = new Parameter($parameterNode->var->name);
$parameter->type = $this->intoType($parameterNode->type);
$parameter->type->reference = $parameterNode->byRef;
$parameter->variadic = $parameterNode->variadic;
Expand Down

0 comments on commit 78a5e02

Please sign in to comment.