Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
Expand Down
2 changes: 2 additions & 0 deletions lib/PHPCfg/Op/Expr/Assertion.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

class Assertion extends Expr
{
public Operand $expr;

public Operand $read;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop this one? Looks like only expr is actually in use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


public Assert $assertion;
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -1403,7 +1403,7 @@ protected function readAssertion(Assertion $assert)
protected function throwUndefinedLabelError()
{
foreach ($this->ctx->unresolvedGotos as $name => $_) {
throw new \RuntimeException("'goto' to undefined label '${name}'");
throw new \RuntimeException("'goto' to undefined label '{$name}'");
}
}

Expand Down
8 changes: 4 additions & 4 deletions lib/PHPCfg/Printer.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function renderOperand(Operand $var)
if ($var instanceof Temporary) {
$id = $this->getVarId($var);
if ($var->original) {
return "Var{$type}#${id}".'<'.$this->renderOperand($var->original).'>';
return "Var{$type}#{$id}".'<'.$this->renderOperand($var->original).'>';
}

return "Var{$type}#".$this->getVarId($var);
Expand All @@ -96,7 +96,7 @@ protected function renderOperand(Operand $var)
if (is_array($var)) {
$result = 'array'.$type;
foreach ($var as $k => $v) {
$result .= "\n ${k}: ".$this->indent($this->renderOperand($v));
$result .= "\n {$k}: ".$this->indent($this->renderOperand($v));
}

return $result;
Expand Down Expand Up @@ -137,11 +137,11 @@ protected function renderOp(Op $op)
if (! $var) {
continue;
}
$result .= "\n {$varName}[${key}]: ";
$result .= "\n {$varName}[{$key}]: ";
$result .= $this->indent($this->renderOperand($var));
}
} elseif ($vars) {
$result .= "\n ${varName}: ";
$result .= "\n {$varName}: ";
$result .= $this->indent($this->renderOperand($vars));
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Printer/GraphViz.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ protected function printFuncWithHeader(Func $func, Graph $graph, $prefix)
{
$name = $func->getScopedName();
$header = $this->createNode(
$prefix.'header', "Function ${name}():"
$prefix.'header', "Function {$name}():"
);
$graph->setNode($header);

Expand Down
4 changes: 2 additions & 2 deletions lib/PHPCfg/Printer/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function printScript(Script $script)
$output .= $this->printFunc($script->main);
foreach ($script->functions as $func) {
$name = var_export($func->getScopedName(), true);
$output .= "\nFunction ${name}:";
$output .= "\nFunction {$name}:";
$output .= ' ' . $this->renderType($func->returnType);
$output .= $this->printFunc($func);
}
Expand Down Expand Up @@ -61,7 +61,7 @@ public function printVars(Func $func)
$output = '';
foreach ($rendered['varIds'] as $var) {
$id = $rendered['varIds'][$var];
$output .= "\nVar#${id}";
$output .= "\nVar#{$id}";
$output .= $this->indent("\n".'WriteOps:');
foreach ($var->ops as $writeOp) {
if ($rendered['ops']->contains($writeOp)) {
Expand Down
8 changes: 4 additions & 4 deletions test/PHPCfg/NameResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ public function testIgnoresInvalidParamTypeInDocComment($type)
{
$doccomment = <<< EOF
/**
* @param ${type} \$a
* @param {$type} \$a
*/
EOF;
$code = <<< EOF
<?php
${doccomment}
{$doccomment}
function foo(\$a) {}
EOF;
$ast = $this->astParser->parse($code);
Expand Down Expand Up @@ -76,7 +76,7 @@ class Bar {}
namespace {
use Foo\\Bar;

${original}
{$original}
function baz(Bar \$bar) {}
}
EOF;
Expand Down Expand Up @@ -107,7 +107,7 @@ class Bar {}
namespace {
use Foo\\Bar as Quux;

${original}
{$original}
function baz(Quux \$bar) {}
}
EOF;
Expand Down