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: 2 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
- "8.0"
- "8.1"
- "8.2"
- "8.3"
- "8.4"
steps:
- name: "Checkout"
uses: "actions/checkout@v2"
Expand Down
6 changes: 3 additions & 3 deletions lib/PHPCfg/AbstractVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ public function leaveFunc(Func $func)
{
}

public function enterBlock(Block $block, Block $prior = null)
public function enterBlock(Block $block, ?Block $prior = null)
{
}

public function leaveBlock(Block $block, Block $prior = null)
public function leaveBlock(Block $block, ?Block $prior = null)
{
}

public function skipBlock(Block $block, Block $prior = null)
public function skipBlock(Block $block, ?Block $prior = null)
{
}

Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Block.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Block

public $dead = false;

public function __construct(self $parent = null)
public function __construct(?self $parent = null)
{
if ($parent) {
$this->parents[] = $parent;
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Op.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function getFile(): string
return $this->getAttribute('filename', 'unknown');
}

public function &getAttribute(string $key, $default = null)
public function &getAttribute(string $key, mixed $default = null)
{
if (! $this->hasAttribute($key)) {
return $default;
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Op/Expr/ClassConstFetch.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class ClassConstFetch extends Expr

public Operand $name;

public function __construct(Operand $class, Operand $name = null, array $attributes = [])
public function __construct(Operand $class, ?Operand $name = null, array $attributes = [])
{
parent::__construct($attributes);
$this->class = $this->addReadRef($class);
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Op/Expr/Yield_.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Yield_ extends Expr

protected array $writeVariables = ['result'];

public function __construct(Operand $value = null, Operand $key = null, array $attributes = [])
public function __construct(?Operand $value = null, ?Operand $key = null, array $attributes = [])
{
parent::__construct($attributes);
if (is_null($value)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Op/Stmt/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Property extends Stmt

public Op\Type $declaredType ;

public function __construct(Operand $name, int $visiblity, bool $static, bool $readonly, array $attrGroups, Op\Type $declaredType = null, Operand $defaultVar = null, Block $defaultBlock = null, array $attributes = [])
public function __construct(Operand $name, int $visiblity, bool $static, bool $readonly, array $attrGroups, ?Op\Type $declaredType = null, ?Operand $defaultVar = null, ?Block $defaultBlock = null, array $attributes = [])
{
parent::__construct($attributes);
$this->name = $this->addReadRef($name);
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Op/Terminal/Exit_.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Exit_ extends Terminal
{
public ?Operand $expr = null;

public function __construct(Operand $expr = null, array $attributes = [])
public function __construct(?Operand $expr = null, array $attributes = [])
{
parent::__construct($attributes);
if (!is_null($expr)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Op/Terminal/Return_.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Return_ extends Terminal
{
public ?Operand $expr = null;

public function __construct(Operand $expr = null, array $attributes = [])
public function __construct(?Operand $expr = null, array $attributes = [])
{
parent::__construct($attributes);
if (!is_null($expr)) {
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Op/Terminal/StaticVar.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class StaticVar extends Terminal

public ?Operand $defaultVar;

public function __construct(Operand $var, Block $defaultBlock = null, Operand $defaultVar = null, array $attributes = [])
public function __construct(Operand $var, ?Block $defaultBlock = null, ?Operand $defaultVar = null, array $attributes = [])
{
parent::__construct($attributes);
$this->var = $this->addWriteRef($var);
Expand Down
4 changes: 2 additions & 2 deletions lib/PHPCfg/Operand/BoundVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class BoundVariable extends Variable

public $scope;

public $extra;
public ?Operand $extra;

public function __construct($name, bool $byRef, int $scope = self::SCOPE_GLOBAL, $extra = null)
public function __construct($name, bool $byRef, int $scope = self::SCOPE_GLOBAL, ?Operand $extra = null)
{
parent::__construct($name);
$this->byRef = $byRef;
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Operand/Temporary.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Temporary extends Operand
*
* @param Operand|null $original The previous variable this was constructed from
*/
public function __construct(Operand $original = null)
public function __construct(?Operand $original = null)
{
$this->original = $original;
}
Expand Down
7 changes: 3 additions & 4 deletions lib/PHPCfg/Parser.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,16 @@ class Parser
/** @var FuncContext */
protected $ctx;

/** @var Literal|null */
protected $currentClass = null;
protected ?Literal $currentClass = null;

protected $currentNamespace = null;
protected ?Node\Name $currentNamespace = null;

/** @var Script */
protected $script;

protected $anonId = 0;

public function __construct(AstParser $astParser, AstTraverser $astTraverser = null)
public function __construct(AstParser $astParser, ?AstTraverser $astTraverser = null)
{
$this->astParser = $astParser;
if (! $astTraverser) {
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Traverser.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function traverseFunc(Func $func)
$this->seen = null;
}

private function traverseBlock(Block $block, Block $prior = null)
private function traverseBlock(Block $block, ?Block $prior = null)
{
if ($this->seen->contains($block)) {
$this->event('skipBlock', [$block, $prior]);
Expand Down
6 changes: 3 additions & 3 deletions lib/PHPCfg/Visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ public function enterFunc(Func $func);

public function leaveFunc(Func $func);

public function enterBlock(Block $block, Block $prior = null);
public function enterBlock(Block $block, ?Block $prior = null);

public function enterOp(Op $op, Block $block);

public function leaveOp(Op $op, Block $block);

public function leaveBlock(Block $block, Block $prior = null);
public function leaveBlock(Block $block, ?Block $prior = null);

public function skipBlock(Block $block, Block $prior = null);
public function skipBlock(Block $block, ?Block $prior = null);
}
6 changes: 3 additions & 3 deletions lib/PHPCfg/Visitor/DebugVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function leaveScript(Script $script)
echo "Leave Script\n";
}

public function enterBlock(Block $block, Block $prior = null)
public function enterBlock(Block $block, ?Block $prior = null)
{
echo 'Enter Block #'.$this->getBlockId($block)."\n";
}
Expand All @@ -47,12 +47,12 @@ public function leaveOp(Op $op, Block $block)
echo 'Leave Op '.$op->getType()."\n";
}

public function leaveBlock(Block $block, Block $prior = null)
public function leaveBlock(Block $block, ?Block $prior = null)
{
echo 'Leave Block #'.$this->getBlockId($block)."\n";
}

public function skipBlock(Block $block, Block $prior = null)
public function skipBlock(Block $block, ?Block $prior = null)
{
echo 'Skip Block #'.$this->getBlockId($block)."\n";
}
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPCfg/Visitor/VariableFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function getVariables()
return $this->variables;
}

public function enterBlock(Block $block, Block $prior = null)
public function enterBlock(Block $block, ?Block $prior = null)
{
foreach ($block->phi as $phi) {
$this->enterOp($phi, $block);
Expand Down
Loading