Skip to content

Commit c46521b

Browse files
committed
add phpstan
1 parent 58196b3 commit c46521b

File tree

6 files changed

+73
-16
lines changed

6 files changed

+73
-16
lines changed

.github/workflows/phpstan.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: PHPStan
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- 'phpstan.neon.dist'
8+
9+
jobs:
10+
phpstan:
11+
name: phpstan
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: '8.1'
20+
coverage: none
21+
22+
- name: Install composer dependencies
23+
uses: ramsey/composer-install@v1
24+
25+
- name: Run PHPStan
26+
run: ./vendor/bin/phpstan --error-format=github

.github/workflows/tests.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
php: ['8.1', '8.2']
14+
os: [ubuntu-latest]
1415
stability: [prefer-stable]
16+
laravel: [9.*]
17+
include:
18+
- laravel: 9.*
19+
testbench: 7.*
1520

1621
services:
1722
rabbitmq:
@@ -36,12 +41,13 @@ jobs:
3641
ports:
3742
- 8474:8474
3843
- 5673:5673
39-
40-
name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
4144
env:
4245
TOXIPROXY_HOST: localhost
4346
TOXIPROXY_AMQP_TARGET: rabbitmq
4447
TOXIPROXY_AMQP_PORT: 5673
48+
49+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
50+
4551
steps:
4652
- name: Checkout code
4753
uses: actions/checkout@v3
@@ -53,16 +59,13 @@ jobs:
5359
uses: shivammathur/setup-php@v2
5460
with:
5561
php-version: ${{ matrix.php }}
56-
extensions: bcmath, curl, dom, mbstring, pcntl, sockets, xml
62+
extensions: bcmath, curl, dom, mbstring, pcntl, sockets, xml, intl
5763
coverage: none
58-
tools: composer:v2
5964

6065
- name: Install dependencies
61-
uses: nick-fields/retry@v2
62-
with:
63-
timeout_minutes: 5
64-
max_attempts: 5
65-
command: composer update --${{ matrix.stability }} --prefer-dist --no-interaction --no-progress
66+
run: |
67+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
68+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
6669
6770
- name: Execute tests
6871
run: vendor/bin/phpunit --verbose

composer.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
"squizlabs/php_codesniffer": "^3.7",
1717
"mockery/mockery": "^1.5.1",
1818
"dg/bypass-finals": "dev-master",
19-
"rector/rector": "^0.15.3"
19+
"rector/rector": "^0.15.3",
20+
"nunomaduro/larastan": "^2.4.0",
21+
"phpstan/phpstan-deprecation-rules": "^1.1.1",
22+
"phpstan/phpstan-phpunit": "^1.3.3"
2023
},
2124
"autoload": {
2225
"psr-4": {

phpstan-baseline.neon

Whitespace-only changes.

phpstan.neon.dist

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
includes:
2+
- phpstan-baseline.neon
3+
4+
parameters:
5+
level: 4
6+
paths:
7+
- src
8+
- config
9+
tmpDir: build/phpstan
10+
checkOctaneCompatibility: true
11+
checkModelProperties: true
12+
checkMissingIterableValueType: false

phpunit.xml.dist

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,22 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false"
3-
beStrictAboutTestsThatDoNotTestAnything="false" bootstrap="vendor/autoload.php" colors="true"
4-
convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true"
5-
processIsolation="false" stopOnError="false" stopOnFailure="false" verbose="true"
6-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd">
2+
<phpunit
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5+
backupGlobals="false"
6+
backupStaticAttributes="false"
7+
bootstrap="vendor/autoload.php"
8+
colors="true"
9+
convertErrorsToExceptions="true"
10+
convertNoticesToExceptions="true"
11+
convertWarningsToExceptions="true"
12+
processIsolation="false"
13+
stopOnFailure="false"
14+
executionOrder="random"
15+
failOnWarning="true"
16+
failOnRisky="true"
17+
failOnEmptyTestSuite="true"
18+
beStrictAboutOutputDuringTests="true"
19+
verbose="true">
720
<coverage>
821
<include>
922
<directory suffix=".php">src/</directory>
@@ -18,7 +31,7 @@
1831
</testsuite>
1932
</testsuites>
2033
<php>
21-
<env name="RABBITMQ_HOST" value="localhost"/>
34+
<env name="RABBITMQ_HOST" value="eagle-rmq"/>
2235
<env name="QUEUE_CONNECTION" value="rabbitmq"/>
2336
<env name="RABBITMQ_PORT" value="5672"/>
2437
<env name="PORT_SSL" value="5671"/>

0 commit comments

Comments
 (0)