Skip to content

Commit

Permalink
phpstan OK
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyentranchung committed May 28, 2024
1 parent fce53f3 commit a837972
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 27 deletions.
51 changes: 27 additions & 24 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,37 @@ name: Laravel

on:
push:
branches: [ "main" ]
branches: ["main"]
pull_request:
branches: [ "main" ]
branches: ["main"]

jobs:
laravel-tests:

runs-on: ubuntu-latest

steps:
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: '8.2'
- uses: actions/checkout@v4
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite
- name: Execute tests (Unit and Feature tests) via PHPUnit/Pest
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: php artisan test
- uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
with:
php-version: "8.2"
- uses: actions/checkout@v4
- name: Copy .env
run: php -r "file_exists('.env') || copy('.env.example', '.env');"
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist
- name: Generate key
run: php artisan key:generate
- name: Directory Permissions
run: chmod -R 777 storage bootstrap/cache
- name: Create Database
run: |
mkdir -p database
touch database/database.sqlite
- name: phpstan analyse
run: ./vendor/bin/phpstan analyse
- name: pint format
run: ./vendor/bin/pint
- name: Execute tests (Unit and Feature tests) via PHPUnit/Pest
env:
DB_CONNECTION: sqlite
DB_DATABASE: database/database.sqlite
run: php artisan test
3 changes: 1 addition & 2 deletions app/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function authUser(): User
if (! function_exists('diskPublic')) {
function diskPublic(): FilesystemAdapter
{
// @phpstan-ignore-next-line
return Storage::disk('public');
}
}
Expand All @@ -51,7 +50,7 @@ function typeString(mixed $value, string $fallback = ''): string

if (! function_exists('typeArray')) {
/**
* @param array<mixed> $default
* @param array<mixed> $fallback
* @return array<mixed>
*
* @throws BindingResolutionException
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ parameters:
level: 9

ignoreErrors:
- '#Unsafe usage of new static#'
# - '#Unsafe usage of new static#'

excludePaths:
- ./*/*/FileToBeExcluded.php
Expand Down

0 comments on commit a837972

Please sign in to comment.