-
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…as-pure Fix #134 by marking `Enum::__callStatic` as `@psalm-pure`
- Loading branch information
Showing
8 changed files
with
72 additions
and
29 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 |
---|---|---|
|
@@ -7,3 +7,4 @@ | |
.travis.yml export-ignore | ||
tests/ export-ignore | ||
phpunit.xml export-ignore | ||
static-analysis/ export-ignore |
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 |
---|---|---|
@@ -1,10 +1,9 @@ | ||
language: php | ||
|
||
php: | ||
- '7.1' | ||
- '7.2' | ||
- '7.3' | ||
- '7.4' | ||
- '8.0' | ||
|
||
matrix: | ||
fast_finish: true | ||
|
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,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MyCLabs\Tests\Enum\StaticAnalysis; | ||
|
||
use MyCLabs\Enum\Enum; | ||
|
||
/** | ||
* @method static PureEnum A() | ||
* @method static PureEnum C() | ||
* | ||
* @psalm-immutable | ||
* @psalm-template T of 'A'|'B' | ||
* @template-extends Enum<T> | ||
*/ | ||
final class PureEnum extends Enum | ||
{ | ||
const A = 'A'; | ||
const C = 'C'; | ||
} | ||
|
||
/** @psalm-pure */ | ||
function enumFetchViaMagicMethodIsPure(): PureEnum | ||
{ | ||
return PureEnum::A(); | ||
} | ||
|
||
/** @psalm-pure */ | ||
function enumFetchViaExplicitMagicCallIsPure(): PureEnum | ||
{ | ||
return PureEnum::__callStatic('A', []); | ||
} |
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