Skip to content

Commit f15ffd2

Browse files
Fixes some static analysis issues
1 parent 05adefc commit f15ffd2

File tree

4 files changed

+16
-72
lines changed

4 files changed

+16
-72
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,34 @@ name: Build
22

33
on:
44
push:
5-
paths-ignore:
6-
- *.md
5+
paths-ignore: ["*.md"]
76
pull_request:
8-
paths-ignore:
9-
- *.md
10-
branches:
11-
- main
7+
paths-ignore: ["*.md"]
8+
branches: [main]
129

1310
jobs:
1411
analysis:
15-
16-
1712
runs-on: ubuntu-latest
1813

19-
20-
2114
strategy:
2215
matrix:
23-
php: ['8.2', 8.3, '8.3', '8.4']
24-
25-
16+
php: [8.3]
2617

2718
steps:
2819
- uses: actions/checkout@v4
2920

30-
31-
3221
- name: Setup PHP
3322
uses: shivammathur/setup-php@v2
3423
with:
3524
php-version: ${{ matrix.php }}
3625
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, gd, exif, iconv
3726
coverage: none
3827

39-
40-
4128
- name: Get Composer Cache Directory
4229
id: composer-cache
4330
run: |
4431
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
4532
46-
47-
4833
- name: Cache composer dependencies
4934
uses: actions/cache@v4
5035
env:
@@ -55,61 +40,42 @@ jobs:
5540
restore-keys: |
5641
php-${{ matrix.php }}-build-${{ env.cache-name }}-
5742
58-
59-
6043
- name: Install composer dependencies
6144
run: composer install --prefer-dist
6245

63-
64-
6546
- name: Run phpstan analysis
6647
run: composer phpstan-analysis
6748

68-
69-
7049
- name: Run phpmd analysis
7150
run: composer phpmd-analysis
7251

7352
test:
7453
name: Test (PHP ${{ matrix.php }})
7554

76-
77-
needs:
78-
- analysis
79-
55+
needs: [analysis]
8056

8157
runs-on: ubuntu-latest
8258

83-
84-
8559
strategy:
8660
matrix:
87-
php: [8.0, 8.1, 8.2]
88-
89-
61+
php: [8.0, 8.1, 8.2, 8.3, 8.4]
9062

9163
steps:
9264
- name: Checkout repository
9365
uses: actions/checkout@v4
9466

95-
96-
9767
- name: Set up PHP
9868
uses: shivammathur/setup-php@v2
9969
with:
10070
php-version: ${{ matrix.php }}
10171
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, gd, exif, iconv
10272
coverage: none
10373

104-
105-
10674
- name: Get Composer Cache Directory
10775
id: composer-cache
10876
run: |
10977
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
11078
111-
112-
11379
- name: Cache composer dependencies
11480
uses: actions/cache@v4
11581
env:
@@ -120,75 +86,53 @@ jobs:
12086
restore-keys: |
12187
php-${{ matrix.php }}-build-${{ env.cache-name }}-
12288
123-
124-
12589
- name: Install composer dependencies
12690
run: composer install --no-interaction --prefer-dist
12791

128-
129-
13092
- name: Run PHPUnit tests
13193
run: vendor/bin/phpunit
13294

13395
test-coverage:
13496
name: Test (PHP ${{ matrix.php }})
13597

136-
137-
needs:
138-
- analysis
139-
98+
needs: [analysis]
14099

141100
runs-on: ubuntu-latest
142101

143-
144-
145102
strategy:
146103
matrix:
147-
php: ['8.2', 8.3, '8.3', '8.4']
148-
149-
104+
php: [8.3]
150105

151106
steps:
152107
- name: Checkout repository
153108
uses: actions/checkout@v4
154109

155-
156-
157110
- name: Set up PHP
158111
uses: shivammathur/setup-php@v2
159112
with:
160113
php-version: ${{ matrix.php }}
161114
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, intl, gd, exif, iconv
162115

163-
164-
165116
- name: Get Composer Cache Directory
166117
id: composer-cache
167118
run: |
168119
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
169120
170-
171-
172121
- name: Cache composer dependencies
173122
uses: actions/cache@v4
174123
env:
175124
cache-name: laravel-i18n-test
176125
with:
177126
path: ${{ steps.composer-cache.outputs.dir }}
178127
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
179-
restore-keys: php-${{ matrix.php }}-build-${{ env.cache-name }}-
180-
181-
128+
restore-keys: |
129+
php-${{ matrix.php }}-build-${{ env.cache-name }}-
182130
183131
- name: Install composer dependencies
184132
run: composer install --no-interaction --prefer-dist
185133

186-
187-
188134
- name: Run PHPUnit tests and generate code coverage
189135
run: vendor/bin/phpunit --coverage-clover=clover.xml
190136

191-
192-
193137
- name: Upload code coverage results
194138
run: bash <(curl -s https://codecov.io/bash)

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
"php": "^8.0",
3131
"illuminate/database": "^8.0|^9.0|^10.0|^11.0|^12.0",
3232
"illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0",
33-
"nesbot/carbon": "^2.16|^3.0"
33+
"nesbot/carbon": "^2.16|^3.8.4"
3434
},
3535
"require-dev": {
3636
"ekino/phpstan-banned-code": "^1.0|^3.0",
3737
"fakerphp/faker": "^1.9",
3838
"mockery/mockery": "^1.4",
39-
"larastan/larastan": "^1.0|^2.0",
39+
"larastan/larastan": "^1.0|^2.0|^3.0",
4040
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0|^10.0",
4141
"phpmd/phpmd": "^2.11",
4242
"phpstan/phpstan-deprecation-rules": "^1.0|^2.0",

phpstan.neon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ includes:
66

77
parameters:
88
level: 8
9-
checkMissingIterableValueType: false
10-
checkGenericClassInNonGenericObjectType: false
119
paths:
1210
- src
1311
ignoreErrors:
14-
- '#Call to an undefined method RichanFongdasen\\I18n\\ServiceProvider::each\(\).#'
12+
- identifier: missingType.iterableValue
13+
- identifier: missingType.generics
14+
- identifier: trait.unused
1515
banned_code:
1616
nodes:
1717
- type: Expr_FuncCall

src/Eloquent/Models/Language.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Language extends Model
2121
/**
2222
* The attributes that are mass assignable.
2323
*
24-
* @var array<int, string>
24+
* @var list<string>
2525
*/
2626
protected $fillable = [
2727
'name',

0 commit comments

Comments
 (0)