-
Notifications
You must be signed in to change notification settings - Fork 428
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a561f7b
commit defc51e
Showing
9 changed files
with
106 additions
and
65 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,19 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace PHPStan\Analyser; | ||
|
||
use PHPStan\DependencyInjection\Container; | ||
|
||
class ConstantResolverProvider | ||
{ | ||
|
||
public function __construct(private Container $container) | ||
{ | ||
} | ||
|
||
public function getConstantResolver(): ConstantResolver | ||
{ | ||
return $this->container->getByType(ConstantResolver::class); | ||
} | ||
|
||
} |
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
18 changes: 0 additions & 18 deletions
18
tests/PHPStan/Analyser/data/conditional-types-constant-php7.php
This file was deleted.
Oops, something went wrong.
18 changes: 0 additions & 18 deletions
18
tests/PHPStan/Analyser/data/conditional-types-constant-php8.php
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
tests/PHPStan/Analyser/data/conditional-types-constant.php
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,24 @@ | ||
<?php | ||
|
||
namespace ConditionalTypesConstant; | ||
|
||
use function PHPStan\Testing\assertType; | ||
use const PREG_SPLIT_NO_EMPTY; | ||
use const PREG_SPLIT_OFFSET_CAPTURE; | ||
|
||
abstract class Test | ||
{ | ||
/** | ||
* @return ($flag is PREG_SPLIT_NO_EMPTY ? true : false) | ||
*/ | ||
abstract public function returnsTrueForPREG_SPLIT_NO_EMPTY(int $flag): bool; | ||
|
||
public function test(): void | ||
{ | ||
assertType('true', $this->returnsTrueForPREG_SPLIT_NO_EMPTY(PREG_SPLIT_NO_EMPTY)); | ||
assertType('true', $this->returnsTrueForPREG_SPLIT_NO_EMPTY(1)); | ||
assertType('false', $this->returnsTrueForPREG_SPLIT_NO_EMPTY(PREG_SPLIT_OFFSET_CAPTURE)); | ||
assertType('false', $this->returnsTrueForPREG_SPLIT_NO_EMPTY(4)); | ||
assertType('bool', $this->returnsTrueForPREG_SPLIT_NO_EMPTY($_GET['flag'])); | ||
} | ||
} |
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