Skip to content

Commit 40cad6c

Browse files
qwerty287ildyria
andauthored
Add phpstan and require PHP 8 / Laravel 9 (#9)
* Add phpstan and require PHP 8 / Laravel 9 * Use latest ubuntu * Try to fix phpstan 2 (make class final) * fix deps * Fix ext installation * properly scan src Co-authored-by: Benoît Viguier <[email protected]> Co-authored-by: ildyria <[email protected]>
1 parent f48c1ad commit 40cad6c

File tree

6 files changed

+9120
-34
lines changed

6 files changed

+9120
-34
lines changed

.github/workflows/CI.yaml

Lines changed: 13 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,27 @@ on:
55
push:
66
paths-ignore:
77
- '**/*.md'
8+
- '**/*.markdown'
89
pull_request:
910
paths-ignore:
1011
- '**/*.md'
12+
- '**/*.markdown'
1113

1214
jobs:
1315
tests:
14-
runs-on: ${{ matrix.operating-system }}
16+
runs-on: ubuntu-latest
1517
if: (github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository)
1618

1719
strategy:
1820
fail-fast: false
1921
matrix:
20-
operating-system: [ubuntu-20.04]
21-
php-versions: ['7.4', '8.0', '8.1']
22-
dependencies: ['no', 'low', 'beta']
23-
exclude:
24-
- operating-system: ubuntu-20.04
25-
php-versions: '8.1'
26-
dependencies: 'low'
27-
28-
name: PHP ${{ matrix.php-versions }} - ${{ matrix.dependencies }}
22+
php-versions: ['8.0', '8.1', '8.2']
2923

24+
name: PHP ${{ matrix.php-versions }}
25+
3026
env:
3127
COMPOSER_NO_INTERACTION: 1
32-
extensions: curl json libxml dom
28+
extensions: curl, json, libxml, dom
3329
key: cache-v1 # can be any string, change to clear the extension cache.
3430

3531
steps:
@@ -59,20 +55,13 @@ jobs:
5955
path: ~/.composer/cache/files
6056
key: dependencies-composer-${{ hashFiles('composer.json') }}
6157

62-
- name: Fix beta
63-
if: ${{ matrix.dependencies == 'beta' }}
64-
run: perl -pi -e 's/^}$/,"minimum-stability":"beta"}/' composer.json
65-
6658
- name: Setup PHP Action
67-
uses: shivammathur/setup-php@2.8.0
59+
uses: shivammathur/setup-php@v2
6860
with:
6961
php-version: ${{ matrix.php-versions }}
7062
extensions: ${{ env.extensions }}
7163
coverage: xdebug
7264
tools: pecl, composer
73-
74-
- name: PHP Show modules
75-
run: php -m
7665

7766
- name: Get composer cache directory
7867
id: composer-cache
@@ -86,15 +75,13 @@ jobs:
8675
restore-keys: ${{ runner.os }}-composer-
8776

8877
- name: Install Composer dependencies
89-
if: ${{ matrix.dependencies != 'low' }}
90-
run: composer update --no-interaction
91-
92-
- name: Install Composer dependencies
93-
if: ${{ matrix.dependencies == 'low' }}
94-
run: composer update -vvv --prefer-lowest --prefer-stable --no-interaction
78+
run: composer install --no-interaction
9579

9680
- name: Validate files
9781
run: composer validate-files
82+
83+
- name: Run PHPStan
84+
run: composer phpstan
9885

9986
- name: Run tests
100-
run: composer run-tests
87+
run: composer run-tests

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/vendor
22
/.idea
33
composer.phar
4-
composer.lock
54
.DS_Store
65
.php-cs-fixer.cache
76
.phpunit.result.cache

composer.json

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,18 @@
1111
}
1212
],
1313

14+
"repositories": [
15+
{
16+
"type": "vcs",
17+
"url": "https://github.com/LycheeOrg/phpstan-lychee"
18+
}
19+
],
20+
1421
"require": {
15-
"php": "^7.2.5|^8.0",
16-
"illuminate/support": "^7.0|^8.0|^9.0",
17-
"illuminate/database": "^7.0|^8.0|^9.0",
18-
"illuminate/events": "^7.0|^8.0|^9.0"
22+
"php": "^8.0",
23+
"illuminate/support": "^9.0",
24+
"illuminate/database": "^9.0",
25+
"illuminate/events": "^9.0"
1926
},
2027

2128
"autoload": {
@@ -26,7 +33,10 @@
2633

2734
"require-dev": {
2835
"php-parallel-lint/php-parallel-lint": "^1.2",
29-
"phpunit/phpunit": "^9.5.20"
36+
"phpunit/phpunit": "^9.5.20",
37+
"lychee-org/phpstan-lychee": "dev-master",
38+
"nunomaduro/larastan": "^2.0",
39+
"orchestra/testbench": "^7.15"
3040
},
3141

3242
"scripts": {
@@ -36,11 +46,23 @@
3646
],
3747
"validate-files": [
3848
"vendor/bin/parallel-lint --exclude vendor ."
49+
],
50+
"phpstan": [
51+
"vendor/bin/phpstan analyze"
3952
]
4053
},
4154
"minimum-stability": "dev",
4255
"prefer-stable": true,
4356

57+
"config": {
58+
"platform": {
59+
"php": "8.0.2"
60+
},
61+
"preferred-install": "dist",
62+
"sort-packages": true,
63+
"optimize-autoloader": true
64+
},
65+
4466
"extra": {
4567
"branch-alias": {
4668
"dev-master": "v5.0.x-dev"

0 commit comments

Comments
 (0)