Skip to content

Commit adca3da

Browse files
committed
Rewrite the package from scratch
1 parent 98f3b8e commit adca3da

23 files changed

+723
-948
lines changed

.editorconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ indent_size = 4
1111
trim_trailing_whitespace = true
1212

1313
[*.md]
14-
trim_trailing_whitespace = false
14+
trim_trailing_whitespace = false
15+
16+
[*.yml]
17+
indent_size = 2

.gitattributes

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Autodetect text files
2+
* text=auto
3+
4+
# ...Unless the name matches the following overriding patterns
5+
6+
# Definitively text files
7+
*.php text
8+
*.css text
9+
*.js text
10+
*.txt text
11+
*.md text
12+
*.xml text
13+
*.json text
14+
*.bat text
15+
*.sql text
16+
*.yml text
17+
18+
# Ensure those won't be messed up with
19+
*.png binary
20+
*.jpg binary
21+
*.gif binary
22+
*.ttf binary
23+
24+
# Ignore some meta files when creating an archive of this repository
25+
/.github export-ignore
26+
/.editorconfig export-ignore
27+
/.gitattributes export-ignore
28+
/.gitignore export-ignore
29+
/phpunit.xml.dist export-ignore
30+
/tests export-ignore
31+
32+
# Avoid merge conflicts in CHANGELOG
33+
# https://about.gitlab.com/2015/02/10/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/
34+
/CHANGELOG.md merge=union

.github/workflows/build.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
on:
2+
- pull_request
3+
- push
4+
5+
name: build
6+
7+
jobs:
8+
tests:
9+
name: PHP ${{ matrix.php }}-${{ matrix.os }}
10+
11+
env:
12+
key: cache-v1
13+
14+
runs-on: ${{ matrix.os }}
15+
16+
strategy:
17+
matrix:
18+
os:
19+
- ubuntu-latest
20+
- windows-latest
21+
22+
php:
23+
- "8.0"
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v2.3.4
28+
29+
- name: Install PHP
30+
uses: shivammathur/setup-php@v2
31+
with:
32+
php-version: ${{ matrix.php }}
33+
ini-values: date.timezone='UTC'
34+
coverage: pcov
35+
tools: composer:v2
36+
37+
- name: Determine composer cache directory on Linux
38+
if: matrix.os == 'ubuntu-latest'
39+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
40+
41+
- name: Determine composer cache directory on Windows
42+
if: matrix.os == 'windows-latest'
43+
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
44+
45+
- name: Cache dependencies installed with composer
46+
uses: actions/cache@v2
47+
with:
48+
path: ${{ env.COMPOSER_CACHE_DIR }}
49+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
50+
restore-keys: |
51+
php${{ matrix.php }}-composer-
52+
- name: Update composer
53+
run: composer self-update
54+
55+
- name: Install dependencies with composer php 8.0
56+
if: matrix.php == '8.0'
57+
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
58+
59+
- name: Run tests with phpunit
60+
run: vendor/bin/phpunit --colors=always

.github/workflows/mutation.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
on:
2+
pull_request:
3+
push:
4+
branches:
5+
- "master"
6+
7+
name: mutation test
8+
9+
jobs:
10+
mutation:
11+
name: PHP ${{ matrix.php }}-${{ matrix.os }}
12+
13+
runs-on: ${{ matrix.os }}
14+
15+
strategy:
16+
matrix:
17+
os:
18+
- ubuntu-latest
19+
20+
php:
21+
- "8.0"
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v2.3.4
26+
27+
- name: Install PHP
28+
uses: shivammathur/setup-php@v2
29+
with:
30+
php-version: "${{ matrix.php }}"
31+
ini-values: memory_limit=-1
32+
coverage: "pcov"
33+
tools: composer:v2
34+
35+
- name: Determine composer cache directory
36+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
37+
38+
- name: Cache dependencies installed with composer
39+
uses: actions/cache@v2
40+
with:
41+
path: ${{ env.COMPOSER_CACHE_DIR }}
42+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
43+
restore-keys: |
44+
php${{ matrix.php }}-composer-
45+
- name: Update composer
46+
run: composer self-update
47+
48+
- name: Install dependencies with composer
49+
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
50+
51+
- name: Run infection
52+
run: |
53+
git fetch --depth=1 origin $GITHUB_BASE_REF
54+
vendor/bin/roave-infection-static-analysis-plugin -j2 --git-diff-filter=A --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --ignore-msi-with-no-mutations --only-covered
55+
env:
56+
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

.github/workflows/static.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
on:
2+
- pull_request
3+
- push
4+
5+
name: static analysis
6+
7+
jobs:
8+
mutation:
9+
name: PHP ${{ matrix.php }}-${{ matrix.os }}
10+
11+
runs-on: ${{ matrix.os }}
12+
13+
strategy:
14+
matrix:
15+
os:
16+
- ubuntu-latest
17+
18+
php:
19+
- "8.0"
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2.3.4
24+
25+
- name: Install PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: "${{ matrix.php }}"
29+
tools: composer:v2, cs2pr
30+
coverage: none
31+
32+
- name: Determine composer cache directory
33+
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV
34+
35+
- name: Cache dependencies installed with composer
36+
uses: actions/cache@v2
37+
with:
38+
path: ${{ env.COMPOSER_CACHE_DIR }}
39+
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
40+
restore-keys: |
41+
php${{ matrix.php }}-composer-
42+
- name: Update composer
43+
run: composer self-update
44+
45+
- name: Install dependencies with composer
46+
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
47+
48+
- name: Static analysis
49+
run: vendor/bin/psalm --shepherd --stats --output-format=checkstyle | cs2pr --graceful-warnings --colorize

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# PHP Enum Implementation Change Log
2+
3+
## 3.0.0 May 26, 2021
4+
5+
- Chg: Rewrite the package from scratch.
6+
7+
## 2.2.0 January 15, 2020
8+
9+
- New: Add support static methods of current object in filters.
10+
11+
## 2.1.0 February 26, 2018
12+
13+
- New: Add static method `get()` that returns object by its identifier.
14+
15+
## 2.0.0 September 4, 2017
16+
17+
- Chg: Property `$value` renamed to `$id`.
18+
- Chg: Method `toValues()` renamed to `toIds()`.
19+
20+
## 1.2.0 August 29, 2017
21+
22+
- New: Add support operator `in` in filters.
23+
24+
## 1.1.1 August 29, 2017
25+
26+
- Bug: Fixed problem with values type casting to integer.
27+
28+
## 1.1.0 August 21, 2017
29+
30+
- New: Add method `toObjects()`.
31+
32+
## 1.0.0 July 15, 2017
33+
34+
- Initial release.

0 commit comments

Comments
 (0)