-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added purity markers for enumerables, improved type definitions #140
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,9 @@ | ||
/.github export-ignore | ||
/bench export-ignore | ||
/tests export-ignore | ||
.gitattributes export-ignore | ||
.gitignore export-ignore | ||
.travis.yml export-ignore | ||
phpbench.json export-ignore | ||
phpunit.xml.dist export-ignore | ||
psalm.xml 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,75 +1,76 @@ | ||
sudo: false | ||
language: php | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache | ||
- $HOME/.local | ||
- $HOME/ocular.phar | ||
- $HOME/phpDocumentor.phar | ||
|
||
env: | ||
global: | ||
- CODE_COVERAGE="0" | ||
- PHPDOC="0" | ||
|
||
matrix: | ||
fast_finish: true | ||
include: | ||
- php: 7.1 | ||
env: | ||
- CODE_COVERAGE="1" | ||
- php: 7.2 | ||
env: | ||
- CODE_COVERAGE="1" | ||
- PHPDOC="1" | ||
- php: 7.3 | ||
env: | ||
- CODE_COVERAGE="1" | ||
- php: 7.4 | ||
env: | ||
- CODE_COVERAGE="1" | ||
- php: nightly | ||
allow_failures: | ||
- php: nightly | ||
|
||
install: | ||
- if [ "${CODE_COVERAGE}" == "0" ]; then | ||
phpenv config-rm xdebug.ini || return 0; | ||
fi | ||
- if [ "${CODE_COVERAGE}" == "1" ]; then | ||
wget -q -N -t 3 --retry-connrefused 'https://scrutinizer-ci.com/ocular.phar' || return 0; | ||
fi | ||
- if [ "${PHPDOC}" == "1" ]; then | ||
wget -q -N -t 3 --retry-connrefused 'https://github.com/phpDocumentor/phpDocumentor2/releases/download/v2.9.0/phpDocumentor.phar' || return 0; | ||
composer require --no-update --dev "evert/phpdoc-md:~0.2.0" || return 0; | ||
fi | ||
- composer install -n | ||
|
||
script: | ||
- if [ "$CODE_COVERAGE" == "1" ]; then | ||
php -d 'zend.assertions=1' vendor/bin/phpunit --verbose --coverage-text --coverage-clover=coverage.clover; | ||
else | ||
php -d 'zend.assertions=1' vendor/bin/phpunit --verbose; | ||
fi | ||
|
||
# run benchmarks to make sure they are working fine | ||
- php vendor/bin/phpbench run --no-interaction --revs=1 --retry-threshold=100 | ||
|
||
after_script: | ||
- if [ "${CODE_COVERAGE}" == "1" ]; then | ||
php ocular.phar code-coverage:upload --format=php-clover coverage.clover; | ||
fi | ||
- if [ "${PHPDOC}" == "1" ]; then | ||
git clone "https://${CI_USER_TOKEN}@github.com/marc-mabe/php-enum.wiki.git" && | ||
php phpDocumentor.phar -d src -t docs/ --template="xml" && | ||
php vendor/bin/phpdocmd --lt '%c' --index 'Home.md' docs/structure.xml php-enum.wiki/ && | ||
cp php-enum.wiki/Home.md php-enum.wiki/_Sidebar.md && | ||
cd php-enum.wiki/ && | ||
git add . && | ||
git commit -m "auto generated PHP doc" && | ||
git push origin master:master; | ||
fi | ||
|
||
notifications: | ||
email: false | ||
sudo: false | ||
language: php | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache | ||
- $HOME/.local | ||
- $HOME/ocular.phar | ||
- $HOME/phpDocumentor.phar | ||
|
||
env: | ||
global: | ||
- CODE_COVERAGE="0" | ||
- PHPDOC="0" | ||
|
||
matrix: | ||
fast_finish: true | ||
include: | ||
- php: 7.1 | ||
env: | ||
- CODE_COVERAGE="1" | ||
- php: 7.2 | ||
env: | ||
- CODE_COVERAGE="1" | ||
- PHPDOC="1" | ||
- php: 7.3 | ||
env: | ||
- CODE_COVERAGE="1" | ||
- php: 7.4 | ||
env: | ||
- CODE_COVERAGE="1" | ||
- php: nightly | ||
allow_failures: | ||
- php: nightly | ||
|
||
install: | ||
- if [ "${CODE_COVERAGE}" == "0" ]; then | ||
phpenv config-rm xdebug.ini || return 0; | ||
fi | ||
- if [ "${CODE_COVERAGE}" == "1" ]; then | ||
wget -q -N -t 3 --retry-connrefused 'https://scrutinizer-ci.com/ocular.phar' || return 0; | ||
fi | ||
- if [ "${PHPDOC}" == "1" ]; then | ||
wget -q -N -t 3 --retry-connrefused 'https://github.com/phpDocumentor/phpDocumentor2/releases/download/v2.9.0/phpDocumentor.phar' || return 0; | ||
composer require --no-update --dev "evert/phpdoc-md:~0.2.0" || return 0; | ||
fi | ||
- composer install -n | ||
|
||
script: | ||
- if [ "$CODE_COVERAGE" == "1" ]; then | ||
php -d 'zend.assertions=1' vendor/bin/phpunit --verbose --coverage-text --coverage-clover=coverage.clover; | ||
else | ||
php -d 'zend.assertions=1' vendor/bin/phpunit --verbose; | ||
fi | ||
|
||
# run benchmarks to make sure they are working fine | ||
- php vendor/bin/phpbench run --no-interaction --revs=1 --retry-threshold=100 | ||
- vendor/bin/psalm | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the only addition here |
||
|
||
after_script: | ||
- if [ "${CODE_COVERAGE}" == "1" ]; then | ||
php ocular.phar code-coverage:upload --format=php-clover coverage.clover; | ||
fi | ||
- if [ "${PHPDOC}" == "1" ]; then | ||
git clone "https://${CI_USER_TOKEN}@github.com/marc-mabe/php-enum.wiki.git" && | ||
php phpDocumentor.phar -d src -t docs/ --template="xml" && | ||
php vendor/bin/phpdocmd --lt '%c' --index 'Home.md' docs/structure.xml php-enum.wiki/ && | ||
cp php-enum.wiki/Home.md php-enum.wiki/_Sidebar.md && | ||
cd php-enum.wiki/ && | ||
git add . && | ||
git commit -m "auto generated PHP doc" && | ||
git push origin master:master; | ||
fi | ||
|
||
notifications: | ||
email: false |
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,16 @@ | ||
<?xml version="1.0"?> | ||
<psalm | ||
totallyTyped="true" | ||
errorLevel="1" | ||
resolveFromConfigFile="true" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="https://getpsalm.org/schema/config" | ||
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" | ||
> | ||
<projectFiles> | ||
<directory name="tests/MabeEnumStaticAnalysis" /> | ||
<ignoreFiles> | ||
<directory name="vendor" /> | ||
</ignoreFiles> | ||
</projectFiles> | ||
</psalm> |
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,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MabeEnumStaticAnalysis; | ||
|
||
use MabeEnum\Enum; | ||
|
||
/** @psalm-immutable enums are immutable */ | ||
final class DummyEnum extends Enum | ||
{ | ||
public const A = 'A_VALUE'; | ||
public const B = 'B_VALUE'; | ||
|
||
/** @psalm-pure */ | ||
public static function a(): self | ||
{ | ||
return self::get(self::A); | ||
} | ||
|
||
/** @psalm-pure */ | ||
public static function b(): self | ||
{ | ||
return self::get(self::B); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure what happened here: was the file commited with
\r\n
before?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No idea how this happened