-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement TypeSpecifierComparisonContext
- Loading branch information
Showing
6 changed files
with
220 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Analyser; | ||
|
||
use PhpParser\Node\Expr; | ||
use PhpParser\Node\Expr\BinaryOp; | ||
use PHPStan\Type\Type; | ||
|
||
/** @api */ | ||
final class TypeSpecifierComparisonContext | ||
{ | ||
|
||
public function __construct( | ||
private BinaryOp $binaryOp, | ||
private Expr $callExpr, | ||
private Type $comparisonType, | ||
private TypeSpecifierContext $context, | ||
private ?Expr $rootExpr, | ||
) | ||
{ | ||
} | ||
|
||
public function getBinaryOp(): BinaryOp | ||
{ | ||
return $this->binaryOp; | ||
} | ||
|
||
public function getCallExpr(): Expr | ||
{ | ||
return $this->callExpr; | ||
} | ||
|
||
public function getComparisonType(): Type | ||
{ | ||
return $this->comparisonType; | ||
} | ||
|
||
public function getTypeSpecifierContext(): TypeSpecifierContext | ||
{ | ||
return $this->context; | ||
} | ||
|
||
public function getRootExpr(): ?Expr | ||
{ | ||
return $this->rootExpr; | ||
} | ||
|
||
} |
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,18 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Type; | ||
|
||
/** | ||
* This is the marker interface *TypeSpecifyingExtension might implement to specify types for comparisons. | ||
* | ||
* Use it in your already registered type specifying extension. | ||
* | ||
* Learn more: https://phpstan.org/developing-extensions/type-specifying-extensions | ||
* | ||
* @api | ||
* | ||
*/ | ||
interface ComparisonAwareTypeSpecifyingExtension | ||
{ | ||
|
||
} |
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