-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
phpstan supports contant definitions and expressions to link to constants.
- Loading branch information
Showing
10 changed files
with
241 additions
and
61 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
/** | ||
* This file is part of phpDocumentor. | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
* | ||
* @link http://phpdoc.org | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Reflection\ConstExpression; | ||
|
||
interface Expression | ||
{ | ||
} |
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,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Reflection\ConstExpression; | ||
|
||
use phpDocumentor\Reflection\Fqsen; | ||
|
||
final class Lookup implements Expression | ||
{ | ||
private Fqsen $fqsen; | ||
private string $expression; | ||
|
||
public function __construct(Fqsen $fqsen, string $expression) | ||
{ | ||
$this->fqsen = $fqsen; | ||
$this->expression = $expression; | ||
} | ||
} |
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,44 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Reflection\PseudoTypes; | ||
|
||
use phpDocumentor\Reflection\Fqsen; | ||
use phpDocumentor\Reflection\PseudoType; | ||
use phpDocumentor\Reflection\Type; | ||
use phpDocumentor\Reflection\Types\Mixed_; | ||
|
||
use function sprintf; | ||
|
||
final class ConstExpression implements PseudoType | ||
{ | ||
private Fqsen $owner; | ||
private string $expression; | ||
|
||
public function __construct(Fqsen $owner, string $expression) | ||
{ | ||
$this->owner = $owner; | ||
$this->expression = $expression; | ||
} | ||
|
||
public function getOwner(): Fqsen | ||
{ | ||
return $this->owner; | ||
} | ||
|
||
public function getExpression(): string | ||
{ | ||
return $this->expression; | ||
} | ||
|
||
public function underlyingType(): Type | ||
{ | ||
return new Mixed_(); | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return sprintf('%s::%s', $this->owner, $this->expression); | ||
} | ||
} |
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,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Reflection\PseudoTypes; | ||
|
||
use phpDocumentor\Reflection\PseudoType; | ||
use phpDocumentor\Reflection\Type; | ||
use phpDocumentor\Reflection\Types\Float_; | ||
|
||
class FloatValue implements PseudoType | ||
{ | ||
private float $value; | ||
|
||
public function __construct(float $value) | ||
{ | ||
$this->value = $value; | ||
} | ||
|
||
public function getValue(): float | ||
{ | ||
return $this->value; | ||
} | ||
|
||
public function underlyingType(): Type | ||
{ | ||
return new Float_(); | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return (string) $this->value; | ||
} | ||
} |
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,34 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Reflection\PseudoTypes; | ||
|
||
use phpDocumentor\Reflection\PseudoType; | ||
use phpDocumentor\Reflection\Type; | ||
use phpDocumentor\Reflection\Types\Integer; | ||
|
||
final class IntegerValue implements PseudoType | ||
{ | ||
private int $value; | ||
|
||
public function __construct(int $value) | ||
{ | ||
$this->value = $value; | ||
} | ||
|
||
public function getValue(): int | ||
{ | ||
return $this->value; | ||
} | ||
|
||
public function underlyingType(): Type | ||
{ | ||
return new Integer(); | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return (string) $this->value; | ||
} | ||
} |
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,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace phpDocumentor\Reflection\PseudoTypes; | ||
|
||
use phpDocumentor\Reflection\PseudoType; | ||
use phpDocumentor\Reflection\Type; | ||
use phpDocumentor\Reflection\Types\Float_; | ||
|
||
use function sprintf; | ||
|
||
class StringValue implements PseudoType | ||
{ | ||
private string $value; | ||
|
||
public function __construct(string $value) | ||
{ | ||
$this->value = $value; | ||
} | ||
|
||
public function getValue(): string | ||
{ | ||
return $this->value; | ||
} | ||
|
||
public function underlyingType(): Type | ||
{ | ||
return new Float_(); | ||
} | ||
|
||
public function __toString(): string | ||
{ | ||
return sprintf('"%s"', $this->value); | ||
} | ||
} |
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
Oops, something went wrong.