Skip to content

Commit

Permalink
Added stan and fix issues
Browse files Browse the repository at this point in the history
  • Loading branch information
cjonstrup committed Mar 14, 2024
1 parent 571c17c commit 9cde318
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 8 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: PHPStan

on:
push:
paths:
- '**.php'
- 'phpstan.neon.dist'

jobs:
phpstan:
name: phpstan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
extensions: dom, curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv
coverage: none

- name: Install dependencies
run: |
composer update --no-interaction --prefer-dist
- name: Run PHPStan
run: ./vendor/bin/phpstan
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Laravel
name: run-tests

on:
push:
Expand All @@ -20,11 +20,11 @@ jobs:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
testbench: 9.*
exclude:
- laravel: 11.*
php: 8.1

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
Expand All @@ -42,6 +42,6 @@ jobs:
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "symfony/console:>=4.3.4" "mockery/mockery:^1.3.2" "nesbot/carbon:>=2.62.1" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
},
"require-dev": {
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0",
"phpunit/phpunit": "^9.4|^10.1"
"phpunit/phpunit": "^9.4|^10.1",
"larastan/larastan": "^2.7"
},
"autoload": {
"files": [
Expand All @@ -38,6 +39,7 @@
}
},
"scripts": {
"analyse": "vendor/bin/phpstan analyse",
"test": "vendor/bin/phpunit"
},
"config": {
Expand Down
17 changes: 17 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
parameters:
ignoreErrors:

-
message: "#^Call to an undefined static method Appstract\\\\Options\\\\Option\\:\\:where\\(\\)\\.$#"
count: 3
path: src/Option.php

-
message: "#^Call to an undefined static method Appstract\\\\Options\\\\Option\\:\\:updateOrCreate\\(\\)\\.$#"
count: 1
path: src/Option.php

-
message: "#^Call to an undefined static method Appstract\\\\Options\\\\OptionFacade\\:\\:set\\(\\)\\.$#"
count: 1
path: src/Console/OptionSetCommand.php
14 changes: 14 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
includes:
- phpstan-baseline.neon

parameters:
level: 5
paths:
- src
- database
tmpDir: build/phpstan
checkMissingIterableValueType: true
reportUnmatchedIgnoredErrors: false

ignoreErrors:
- '#Unsafe usage of new static#'
4 changes: 2 additions & 2 deletions phpunit.xml → phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
<directory>tests</directory>
</testsuite>
</testsuites>
<source ignoreSuppressionOfPhpWarnings="true">
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</source>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
</php>
</php>
</phpunit>
2 changes: 1 addition & 1 deletion src/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Option extends Model
/**
* The attributes that are mass assignable.
*
* @var [type]
* @var array<int, string>
*/
protected $fillable = [
'key',
Expand Down

0 comments on commit 9cde318

Please sign in to comment.