Skip to content

Commit 7524304

Browse files
authored
Merge pull request #213 from Nielsvanpach/laravel-9
Add support for Laravel 9
2 parents 72380c2 + 76a53f5 commit 7524304

17 files changed

+635
-153
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,11 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
php: [7.3, 7.4, 8.0, 8.1]
12-
illuminate_version: [6.*, 8.*]
11+
php: [8.0, 8.1]
12+
illuminate_version: [8.67.*, 9.7.*]
1313
stability: [prefer-lowest, prefer-stable]
14-
exclude:
15-
- illuminate_version: 6.*
16-
php: 7.3
17-
stability: prefer-stable
1814

19-
- illuminate_version: 6.*
20-
php: 7.4
21-
stability: prefer-stable
22-
23-
- illuminate_version: 6.*
24-
php: 8.0
25-
stability: prefer-stable
26-
27-
# Exclude unsupported combination
28-
# https://laravel.com/docs/8.x/releases#support-policy
29-
- illuminate_version: 6.*
30-
php: 8.1
31-
32-
# "Added PHP 8.1 Support from v8.67.0"
33-
# https://github.com/laravel/framework/blob/8.x/CHANGELOG-8.x.md#v8670-2021-10-22
34-
# see also `matrix.include` section
35-
- illuminate_version: 8.*
36-
php: 8.1
37-
38-
include:
39-
# "Added PHP 8.1 Support from v8.67.0"
40-
- illuminate_version: ^8.67.0
41-
php: 8.1
42-
stability: 'prefer-stable'
43-
44-
name: ${{ matrix.php }} | Illuminate ${{ matrix.illuminate_version }} | ${{ matrix.stability }}
15+
name: P${{ matrix.php }} | I ${{ matrix.illuminate_version }} | ${{ matrix.stability }}
4516

4617
steps:
4718
- name: Checkout code
@@ -56,7 +27,7 @@ jobs:
5627

5728
- name: Install dependencies
5829
run: |
59-
composer require "illuminate/container:${{ matrix.illuminate_version }}" "illuminate/contracts:${{ matrix.illuminate_version }}" "illuminate/database:${{ matrix.illuminate_version }}" "illuminate/http:${{ matrix.illuminate_version }}" "illuminate/support:${{ matrix.illuminate_version }}" --no-interaction --no-progress --prefer-dist --${{ matrix.stability }}
30+
composer require "laravel/framework:${{ matrix.illuminate_version }}" "illuminate/container:${{ matrix.illuminate_version }}" "illuminate/contracts:${{ matrix.illuminate_version }}" "illuminate/database:${{ matrix.illuminate_version }}" "illuminate/http:${{ matrix.illuminate_version }}" "illuminate/support:${{ matrix.illuminate_version }}" --no-interaction --no-progress --prefer-dist --${{ matrix.stability }}
6031
6132
- name: Run Tests
6233
run: composer test

composer.json

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,32 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^7.3|^8.0",
14+
"php": "^8.0",
1515
"ext-simplexml": "*",
16-
"illuminate/config": "^6.0 || ^8.0",
17-
"illuminate/container": "^6.0 || ^8.0",
18-
"illuminate/contracts": "^6.0 || ^8.0",
19-
"illuminate/database": "^6.0 || ^8.0",
20-
"illuminate/events": "^6.0 || ^8.0",
21-
"illuminate/http": "^6.0 || ^8.0",
22-
"illuminate/routing": "^6.0 || ^8.0",
23-
"illuminate/support": "^6.0 || ^8.0",
24-
"illuminate/view": "^6.0 || ^8.0",
16+
"illuminate/config": "^8.0 || ^9.0",
17+
"illuminate/container": "^8.0 || ^9.0",
18+
"illuminate/contracts": "^8.0 || ^9.0",
19+
"illuminate/database": "^8.0 || ^9.0",
20+
"illuminate/events": "^8.0 || ^9.0",
21+
"illuminate/http": "^8.0 || ^9.0",
22+
"illuminate/routing": "^8.0 || ^9.0",
23+
"illuminate/support": "^8.0 || ^9.0",
24+
"illuminate/view": "^8.0 || ^9.0",
2525
"vimeo/psalm": "^4.8.1",
26-
"orchestra/testbench": "^3.8 || ^4.0 || ^5.0 || ^6.22 || ^7.0",
27-
"barryvdh/laravel-ide-helper": ">=2.8.0"
26+
"orchestra/testbench": "^6.22 || ^7.0",
27+
"barryvdh/laravel-ide-helper": "^2.10"
2828
},
2929
"require-dev": {
30-
"codeception/codeception": "^4.1.6",
31-
"codeception/module-phpbrowser": "^1.0.0",
32-
"codeception/module-asserts": "^1.0.0",
33-
"weirdan/codeception-psalm-module": "^0.13.1",
30+
"codeception/codeception": "^5.0",
31+
"codeception/module-asserts": "*@dev",
32+
"codeception/module-cli": "^2.0",
33+
"codeception/module-filesystem": "^3.0",
34+
"codeception/module-phpbrowser": "*@dev",
35+
"slevomat/coding-standard": "^6.2",
3436
"squizlabs/php_codesniffer": "*",
35-
"slevomat/coding-standard": "^6.2"
37+
"phpoption/phpoption": "^1.8.0",
38+
"symfony/http-foundation": "^5.3.7 || ^6.0",
39+
"ramsey/collection": "^1.2.0"
3640
},
3741
"autoload": {
3842
"psr-4": {

phpcs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@
2222
<file>tests</file>
2323
<exclude-pattern>src/cache/</exclude-pattern>
2424
<exclude-pattern>tests/_support/</exclude-pattern>
25+
<exclude-pattern>tests/Support/</exclude-pattern>
2526
</ruleset>

psalm-baseline.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<files psalm-version="dev-master@b07de1fefde4714f29bca0b56c632bd82855fc64">
2+
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
3+
<file src="src/Providers/ApplicationProvider.php">
4+
<MissingFile occurrences="1">
5+
<code>require $applicationPath</code>
6+
</MissingFile>
7+
</file>
38
<file src="src/Providers/ModelStubProvider.php">
49
<PossiblyUndefinedMethod occurrences="1">
510
<code>databasePath</code>

src/Fakes/FakeMetaCommand.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ protected function registerClassAutoloadExceptions(): callable
1414
// by default, the ide-helper throws exceptions when it cannot find a class. However it does not unregister that
1515
// autoloader when it is done, and we certainly do not want to throw exceptions when we are simply checking if
1616
// a certain class exists. We are instead changing this to be a noop.
17-
1817
return function () {
1918
};
2019
}

src/Fakes/FakeModelsCommandLogic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public function getModels(): array
2626
*
2727
* @param Model $model
2828
*/
29-
protected function getPropertiesFromTable($model): void
29+
public function getPropertiesFromTable($model): void
3030
{
3131
$table_name = $model->getTable();
3232

stubs/EloquentBuilder.stubphp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,20 @@ class Builder
167167
*/
168168
public function firstOr($columns = ['*'], Closure $callback = null) { }
169169

170+
/**
171+
* @param array $attributes
172+
* @param array $values
173+
* @return TModel|self<TModel>
174+
*/
175+
public function firstOrNew(array $attributes = [], array $values = []) { }
176+
177+
/**
178+
* @param array $attributes
179+
* @param array $values
180+
* @return TModel|self<TModel>
181+
*/
182+
public function firstOrCreate(array $attributes = [], array $values = []) { }
183+
170184
/**
171185
* @param string $column
172186
* @return mixed

stubs/HasOneOrMany.stubphp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,20 @@ abstract class HasOneOrMany extends Relation
6666
* @psalm-return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
6767
*/
6868
public function createMany(array $records) { }
69+
70+
/**
71+
* @param array $attributes
72+
* @param array $values
73+
* @return \Illuminate\Database\Eloquent\Model
74+
* @psalm-return TRelatedModel
75+
*/
76+
public function firstOrNew(array $attributes = [], array $values = []) { }
77+
78+
/**
79+
* @param array $attributes
80+
* @param array $values
81+
* @return \Illuminate\Database\Eloquent\Model
82+
* @psalm-return TRelatedModel
83+
*/
84+
public function firstOrCreate(array $attributes = [], array $values = []) { }
6985
}

0 commit comments

Comments
 (0)