Skip to content

Commit 43d9591

Browse files
committed
Update dependency nikic/php-parser to ~1.3 (from my custom branch).
Magic getters/setters were removed and replaced by public properties so we have to test if they exist(isset). There was also a regression where Function_::getFullyQualifiedName would not return the name of the function when the function was within a namespace.
1 parent c301e95 commit 43d9591

File tree

8 files changed

+15
-21
lines changed

8 files changed

+15
-21
lines changed

composer.json

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,12 @@
1919
"support": {
2020
"issues": "https://github.com/tomzx/php-semver-checker/issues"
2121
},
22-
"repositories": [
23-
{
24-
"type": "vcs",
25-
"url": "https://github.com/tomzx/php-parser"
26-
}
27-
],
2822
"require": {
2923
"php": ">=5.4.0",
3024

3125
"hassankhan/config": "~0.8",
3226
"herrera-io/phar-update": "~2.0",
33-
"nikic/php-parser": "dev-features/php-semver-checker",
27+
"nikic/php-parser": "~1.3",
3428
"symfony/console": "~2.7",
3529
"tomzx/finder": "~0.1@dev"
3630
},

src/PHPSemVerChecker/Node/Statement/ClassMethod.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
class ClassMethod {
99
public static function getFullyQualifiedName(Stmt $context, BaseClassMethod $classMethod)
1010
{
11-
$fqcn = $context->name;
12-
if ($context->namespacedName) {
13-
$fqcn = $context->namespacedName->toString();
11+
$namespace = $context->name;
12+
if (isset($context->namespacedName)) {
13+
$namespace = $context->namespacedName->toString();
1414
}
15-
return $fqcn . '::' . $classMethod->name;
15+
return $namespace . '::' . $classMethod->name;
1616
}
1717
}

src/PHPSemVerChecker/Node/Statement/Class_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class Class_ {
88
public static function getFullyQualifiedName(BaseClass $class)
99
{
10-
if ($class->namespacedName) {
10+
if (isset($class->namespacedName)) {
1111
return $class->namespacedName->toString();
1212
}
1313
return $class->name;

src/PHPSemVerChecker/Node/Statement/Function_.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
class Function_ {
88
public static function getFullyQualifiedName(BaseFunction $function)
99
{
10-
if ($function->namespacedName) {
11-
return $function->namespacedName->toString();
10+
if (isset($function->namespacedName)) {
11+
return $function->namespacedName->toString() . '::' . $function->name;
1212
}
1313
return $function->name;
1414
}

src/PHPSemVerChecker/Node/Statement/Interface_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class Interface_ {
88
public static function getFullyQualifiedName(BaseInterface $interface)
99
{
10-
if ($interface->namespacedName) {
10+
if (isset($interface->namespacedName)) {
1111
return $interface->namespacedName->toString();
1212
}
1313
return $interface->name;

src/PHPSemVerChecker/Node/Statement/Property.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
class Property {
99
public static function getFullyQualifiedName(Stmt $context, BaseProperty $property)
1010
{
11-
$fqcn = $context->name;
12-
if ($context->namespacedName) {
13-
$fqcn = $context->namespacedName->toString();
11+
$namespace = $context->name;
12+
if (isset($context->namespacedName)) {
13+
$namespace = $context->namespacedName->toString();
1414
}
15-
return $fqcn . '::$' . $property->props[0]->name;
15+
return $namespace . '::$' . $property->props[0]->name;
1616
}
1717
}

src/PHPSemVerChecker/Node/Statement/Trait_.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
class Trait_ {
88
public static function getFullyQualifiedName(BaseTrait $trait)
99
{
10-
if ($trait->namespacedName) {
10+
if (isset($trait->namespacedName)) {
1111
return $trait->namespacedName->toString();
1212
}
1313
return $trait->name;

src/PHPSemVerChecker/Registry/Registry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ protected function addNode($context, Stmt $node)
9191
*/
9292
protected function fullyQualifiedName(Stmt $node)
9393
{
94-
return $node->namespacedName ? $node->namespacedName->toString() : $node->name;
94+
return isset($node->namespacedName) ? $node->namespacedName->toString() : $node->name;
9595
}
9696

9797
/**

0 commit comments

Comments
 (0)