-
Notifications
You must be signed in to change notification settings - Fork 471
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BooleanOrConstantConditionRule - check LogicalOr (bleeding edge), use…
… virtual node for more correct result
- Loading branch information
1 parent
40a76e8
commit ae9a558
Showing
7 changed files
with
93 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Node; | ||
|
||
use PhpParser\Node\Expr\BinaryOp\BooleanOr; | ||
use PhpParser\Node\Expr\BinaryOp\LogicalOr; | ||
use PhpParser\NodeAbstract; | ||
use PHPStan\Analyser\Scope; | ||
|
||
class BooleanOrNode extends NodeAbstract implements VirtualNode | ||
{ | ||
|
||
/** @var BooleanOr|LogicalOr */ | ||
private $originalNode; | ||
|
||
private Scope $rightScope; | ||
|
||
/** | ||
* @param BooleanOr|LogicalOr $originalNode | ||
* @param Scope $rightScope | ||
*/ | ||
public function __construct($originalNode, Scope $rightScope) | ||
{ | ||
parent::__construct($originalNode->getAttributes()); | ||
$this->originalNode = $originalNode; | ||
$this->rightScope = $rightScope; | ||
} | ||
|
||
/** | ||
* @return BooleanOr|LogicalOr | ||
*/ | ||
public function getOriginalNode() | ||
{ | ||
return $this->originalNode; | ||
} | ||
|
||
public function getRightScope(): Scope | ||
{ | ||
return $this->rightScope; | ||
} | ||
|
||
public function getType(): string | ||
{ | ||
return 'PHPStan_Node_BooleanOrNode'; | ||
} | ||
|
||
/** | ||
* @return string[] | ||
*/ | ||
public function getSubNodeNames(): array | ||
{ | ||
return []; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters