Skip to content

Commit

Permalink
Fix #313
Browse files Browse the repository at this point in the history
  • Loading branch information
theseer committed Jan 7, 2018
1 parent 08e7dc3 commit 403ca2f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/collector/backend/parser/UnitCollectingVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,16 @@ private function resolveExpressionValue(Expr $expr) {
);
}

if ($expr instanceof BinaryOp) {
$code = (new \PhpParser\PrettyPrinter\Standard)->prettyPrint([$expr]);

return array(
'type' => 'expression',
'value' => substr($code,0,-1)
);

}

$type = get_class($expr);
$line = $expr->getLine();
$file = $this->result->getFileName();
Expand Down
7 changes: 7 additions & 0 deletions tests/data/issue313/src/bug.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php declare(strict_types=1);

class bug {
const FOO = 'a' . 'b' . 'c' . 'd';
const BAZ = ((5 - 1) / 2) . 'em';
const BAR = 1 + 2 + 3;
}
15 changes: 15 additions & 0 deletions tests/data/issue313/test.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" ?>
<phpdox xmlns="http://xml.phpdox.net/config" silent="false">

<project name="phpDox-issue300" source="${basedir}/src" workdir="${basedir}/xml">

<collector publiconly="false" backend="parser" />

<generator output="${basedir}/docs">
<build engine="html" enabled="true" output="html" />
<build engine="xml" enabled="true" output="xml" />
</generator>

</project>

</phpdox>

0 comments on commit 403ca2f

Please sign in to comment.