Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"require": {
"php": ">=7.1",
"psr/log": "~1.0",
"nikic/php-parser": "^3.0",
"nikic/php-parser": "^4.0",
"phpdocumentor/reflection-docblock": "^5"
},
"require-dev": {
Expand Down
20 changes: 10 additions & 10 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion phive.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="^0.9.1" installed="0.9.1" location="./tools/phpstan"/>
<phar name="phpstan" version="^0.9.1" installed="0.10.2" location="./tools/phpstan" copy="true"/>
<phar name="phpunit" version="^6.0" installed="6.5.5" location="./tools/phpunit" copy="true"/>
</phive>
5 changes: 4 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ parameters:
- '#Access to an undefined property PhpParser\\Node\\Const_::\$fqsen\.#'
- '#Access to an undefined property PhpParser\\Node\\Stmt\\PropertyProperty::\$fqsen\.#'
#
# src/phpDocumentor/Reflection/Php/Factory/Argument.php
- '#Access to an undefined property PhpParser\\Node\\Expr\\Error\|PhpParser\\Node\\Expr\\Variable::\$name\.#'
#
# src/phpDocumentor/Reflection/Php/Factory/Class_.php
- '#Access to an undefined property PhpParser\\Node\\Stmt\\Class_::\$fqsen\.#'
#
Expand All @@ -19,7 +22,7 @@ parameters:
#
#
# this is a mismatch inside php-parser, not reflection
- '#Parameter \#1 \$nodes of method PhpParser\\NodeTraverser::traverse\(\) expects array\<PhpParser\\Node>, array\<PhpParser\\Node>\|null given\.#'
- '#Parameter \#1 \$nodes of method PhpParser\\NodeTraverser::traverse\(\) expects array\<PhpParser\\Node>, array\<PhpParser\\Node\\Stmt\>|null given\.#'
#
#
# there is one test case that prevents changing PropertyIterator::getDefault() to just return Expr (this is set in PhpParser)
Expand Down
2 changes: 1 addition & 1 deletion src/phpDocumentor/Reflection/File/LocalFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function __construct(string $path)
*/
public function getContents(): string
{
return file_get_contents($this->path);
return (string) file_get_contents($this->path);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,6 @@ private function buildName(): string
$name .= $part;
}

return rtrim($name, '\\');
return rtrim((string) $name, '\\');
}
}
6 changes: 5 additions & 1 deletion src/phpDocumentor/Reflection/Php/Factory/Argument.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
use phpDocumentor\Reflection\Php\StrategyContainer;
use phpDocumentor\Reflection\PrettyPrinter;
use phpDocumentor\Reflection\Types\Context;
use PhpParser\Node\Expr\Variable;
use PhpParser\Node\Param;
use Webmozart\Assert\Assert;

/**
* Strategy to convert Param to Argument
Expand Down Expand Up @@ -59,11 +61,13 @@ public function matches($object): bool
*/
protected function doCreate($object, StrategyContainer $strategies, ?Context $context = null)
{
Assert::isInstanceOf($object, Param::class);
Assert::isInstanceOf($object->var, Variable::class);
$default = null;
if ($object->default !== null) {
$default = $this->valueConverter->prettyPrintExpr($object->default);
}

return new ArgumentDescriptor($object->name, $default, $object->byRef, $object->variadic);
return new ArgumentDescriptor((string) $object->var->name, $default, $object->byRef, $object->variadic);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function getLine(): int
*/
public function getName(): string
{
return $this->classConstants->consts[$this->index]->name;
return (string) $this->classConstants->consts[$this->index]->name;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function getDocComment(): ?Doc
*/
public function getName(): string
{
return $this->property->props[$this->index]->name;
return (string) $this->property->props[$this->index]->name;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/phpDocumentor/Reflection/PrettyPrinter.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@ public function pScalar_String(String_ $node): string
return $node->value;
}

return $this->pNoIndent($node->getAttribute('originalValue'));
return (string) $node->getAttribute('originalValue');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function testCreate()
$factory = new ProjectFactoryStrategies([]);

$argMock = m::mock(Param::class);
$argMock->name = 'myArgument';
$argMock->var = new \PhpParser\Node\Expr\Variable('myArgument');
$argMock->default = new String_('MyDefault');
$argMock->byRef = true;
$argMock->variadic = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ protected function tearDown()
public function testIterateProps()
{
$const1 = new Const_('\Space\MyClass::MY_CONST1', new Variable('a'));
$const1->fqsen = new Fqsen($const1->name);
$const1->fqsen = new Fqsen((string) $const1->name);
$const2 = new Const_('\Space\MyClass::MY_CONST2', new Variable('b'));
$const2->fqsen = new Fqsen($const2->name);
$const2->fqsen = new Fqsen((string) $const2->name);

$classConstantNode = new ClassConst([$const1, $const2]);

Expand Down