Skip to content

Commit aa4338d

Browse files
committed
Add stricter type
1 parent 1444e0c commit aa4338d

25 files changed

Lines changed: 463 additions & 116 deletions

.gitattributes

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
/.codeclimate.yml export-ignore
77
/.styleci.yml export-ignore
88
/.editorconfig export-ignore
9-
/ruleset.xml export-ignore
9+
/.php_cs.dist.php export-ignore
10+
/.phan export-ignore
11+
/.github export-ignore
12+
/*.cache export-ignore
13+
/*.xml export-ignore
1014
/*.md export-ignore
1115

1216
# Auto detect text files and perform LF normalization

.github/workflows/coverage.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Coverage
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ '**' ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['8.2']
17+
setup: ['stable']
18+
19+
name: PHP
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
coverage: xdebug
30+
31+
- name: Cache Composer packages
32+
id: composer-cache
33+
uses: actions/cache@v2
34+
with:
35+
path: vendor
36+
key: coverage-${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
37+
restore-keys: |
38+
coverage-${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-
39+
40+
- name: Code Climate Test Reporter Preparation
41+
run: |
42+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
43+
chmod +x ./cc-test-reporter
44+
./cc-test-reporter before-build
45+
env:
46+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
47+
48+
- name: Install dependencies
49+
if: steps.composer-cache.outputs.cache-hit != 'true'
50+
run: |
51+
composer config version 1.9.0
52+
composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress ${{ matrix.php >= 8.1 && '--ignore-platform-req=php' || '' }}
53+
54+
- name: Prepare git config
55+
run: |
56+
git config --global init.defaultBranch main
57+
git config --global user.name tester
58+
git config --global user.email tester@phug-lang.com
59+
60+
- name: Run test suite
61+
run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml
62+
63+
- name: Code Climate Test Reporter
64+
if: ${{ env.CC_TEST_REPORTER_ID != '' }}
65+
run: |
66+
cp coverage.xml clover.xml
67+
bash <(curl -s https://codecov.io/bash)
68+
./cc-test-reporter after-build --coverage-input-type clover --exit-code 0
69+
composer config version 1.9.0
70+
env:
71+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}

.github/workflows/phan.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Phan
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ '**' ]
8+
9+
jobs:
10+
style:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['8.2']
17+
setup: ['stable']
18+
19+
name: PHP ${{ matrix.php }} - ${{ matrix.setup }}
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
30+
- name: Cache Composer packages
31+
id: composer-cache
32+
uses: actions/cache@v2
33+
with:
34+
path: vendor
35+
key: style-${{ runner.os }}-${{ matrix.setup }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
36+
restore-keys: |
37+
style-${{ runner.os }}-${{ matrix.setup }}-${{ matrix.php }}-
38+
39+
- name: Install dependencies
40+
if: steps.composer-cache.outputs.cache-hit != 'true'
41+
run: composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress
42+
43+
- name: Check style with Phan
44+
run: composer run-script phan

.github/workflows/phpcs.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: PHPCS
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ '**' ]
8+
9+
jobs:
10+
style:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['8.2']
17+
setup: ['stable']
18+
19+
name: PHP ${{ matrix.php }} - ${{ matrix.setup }}
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
30+
- name: Cache Composer packages
31+
id: composer-cache
32+
uses: actions/cache@v2
33+
with:
34+
path: vendor
35+
key: style-${{ runner.os }}-${{ matrix.setup }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
36+
restore-keys: |
37+
style-${{ runner.os }}-${{ matrix.setup }}-${{ matrix.php }}-
38+
39+
- name: Install dependencies
40+
if: steps.composer-cache.outputs.cache-hit != 'true'
41+
run: composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress
42+
43+
- name: Check style with PHPCS
44+
run: composer run-script phpcs

.github/workflows/phpcsf.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: PHPCSF
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ '**' ]
8+
9+
jobs:
10+
style:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['8.2']
17+
setup: ['stable']
18+
19+
name: PHP ${{ matrix.php }} - ${{ matrix.setup }}
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
30+
- name: Cache Composer packages
31+
id: composer-cache
32+
uses: actions/cache@v2
33+
with:
34+
path: vendor
35+
key: style-${{ runner.os }}-${{ matrix.setup }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
36+
restore-keys: |
37+
style-${{ runner.os }}-${{ matrix.setup }}-${{ matrix.php }}-
38+
39+
- name: Install dependencies
40+
if: steps.composer-cache.outputs.cache-hit != 'true'
41+
run: composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress
42+
43+
- name: Check style with phpcsf
44+
run: composer run-script phpcsf

.github/workflows/phpmd.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: PHPMD
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ '**' ]
8+
9+
jobs:
10+
style:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['8.2']
17+
setup: ['stable']
18+
19+
name: PHP ${{ matrix.php }} - ${{ matrix.setup }}
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
30+
- name: Cache Composer packages
31+
id: composer-cache
32+
uses: actions/cache@v2
33+
with:
34+
path: vendor
35+
key: style-${{ runner.os }}-${{ matrix.setup }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
36+
restore-keys: |
37+
style-${{ runner.os }}-${{ matrix.setup }}-${{ matrix.php }}-
38+
39+
- name: Install dependencies
40+
if: steps.composer-cache.outputs.cache-hit != 'true'
41+
run: composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress
42+
43+
- name: Check style with phpmd
44+
run: composer run-script phpmd

.github/workflows/psalm.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Psalm
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ '**' ]
8+
9+
jobs:
10+
style:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['8.2']
17+
setup: ['stable']
18+
19+
name: PHP ${{ matrix.php }} - ${{ matrix.setup }}
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
30+
- name: Cache Composer packages
31+
id: composer-cache
32+
uses: actions/cache@v2
33+
with:
34+
path: vendor
35+
key: psalm-${{ runner.os }}-${{ matrix.setup }}-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
36+
restore-keys: |
37+
psalm-${{ runner.os }}-${{ matrix.setup }}-${{ matrix.php }}-
38+
39+
- name: Install dependencies
40+
if: steps.composer-cache.outputs.cache-hit != 'true'
41+
# tests/use-fork.php because of https://github.com/vimeo/psalm/issues/8957
42+
run: |
43+
php tests/use-fork.php vimeo/psalm 5.14.2 https://github.com/kylekatarnls/psalm.git fix/datetime-inheritance-5.x
44+
composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress
45+
46+
- name: Check style with psalm
47+
run: composer run-script psalm

.github/workflows/tests.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [ '**' ]
6+
pull_request:
7+
branches: [ '**' ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
php: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
17+
setup: ['lowest', 'stable', 'next']
18+
19+
name: PHP ${{ matrix.php }} - ${{ matrix.setup }}
20+
21+
steps:
22+
- uses: actions/checkout@v2
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
tools: composer:v2
29+
coverage: none
30+
31+
- name: Cache Composer packages
32+
id: composer-cache
33+
uses: actions/cache@v2
34+
with:
35+
path: vendor
36+
key: ${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
37+
restore-keys: |
38+
${{ runner.os }}-${{ matrix.setup }}-php-${{ matrix.php }}-
39+
40+
- name: Configure plugins
41+
if: matrix.setup == 'lowest'
42+
run: composer config --no-plugins allow-plugins.ocramius/package-versions true
43+
44+
- name: Install dependencies
45+
if: steps.composer-cache.outputs.cache-hit != 'true'
46+
run: |
47+
composer config version 1.9.0
48+
${{ matrix.php >= 7.2 && matrix.php < 8 && matrix.setup == 'lowest' && 'composer require --no-update "phpunit/phpunit:^5.7.27||^6.5.14||^7.5.20" --no-interaction;' || '' }}
49+
composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress ${{ matrix.php >= 8.1 && '--ignore-platform-req=php' || '' }} --no-interaction
50+
51+
- name: Prepare git config
52+
run: |
53+
git config --global init.defaultBranch main
54+
git config --global user.name tester
55+
git config --global user.email tester@phug-lang.com
56+
57+
- name: Run test suite
58+
run: vendor/bin/phpunit --no-coverage --verbose

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ composer.lock
44
/docs
55
/coverage
66
coverage.xml
7+
*.cache

0 commit comments

Comments
 (0)