Skip to content

Commit

Permalink
Merge pull request #213 from Nielsvanpach/laravel-9
Browse files Browse the repository at this point in the history
Add support for Laravel 9
  • Loading branch information
mr-feek committed May 2, 2022
2 parents 72380c2 + 76a53f5 commit 7524304
Show file tree
Hide file tree
Showing 17 changed files with 635 additions and 153 deletions.
37 changes: 4 additions & 33 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,11 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [7.3, 7.4, 8.0, 8.1]
illuminate_version: [6.*, 8.*]
php: [8.0, 8.1]
illuminate_version: [8.67.*, 9.7.*]
stability: [prefer-lowest, prefer-stable]
exclude:
- illuminate_version: 6.*
php: 7.3
stability: prefer-stable

- illuminate_version: 6.*
php: 7.4
stability: prefer-stable

- illuminate_version: 6.*
php: 8.0
stability: prefer-stable

# Exclude unsupported combination
# https://laravel.com/docs/8.x/releases#support-policy
- illuminate_version: 6.*
php: 8.1

# "Added PHP 8.1 Support from v8.67.0"
# https://github.com/laravel/framework/blob/8.x/CHANGELOG-8.x.md#v8670-2021-10-22
# see also `matrix.include` section
- illuminate_version: 8.*
php: 8.1

include:
# "Added PHP 8.1 Support from v8.67.0"
- illuminate_version: ^8.67.0
php: 8.1
stability: 'prefer-stable'

name: ${{ matrix.php }} | Illuminate ${{ matrix.illuminate_version }} | ${{ matrix.stability }}
name: P${{ matrix.php }} | I ${{ matrix.illuminate_version }} | ${{ matrix.stability }}

steps:
- name: Checkout code
Expand All @@ -56,7 +27,7 @@ jobs:

- name: Install dependencies
run: |
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 }}
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 }}
- name: Run Tests
run: composer test
38 changes: 21 additions & 17 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,32 @@
}
],
"require": {
"php": "^7.3|^8.0",
"php": "^8.0",
"ext-simplexml": "*",
"illuminate/config": "^6.0 || ^8.0",
"illuminate/container": "^6.0 || ^8.0",
"illuminate/contracts": "^6.0 || ^8.0",
"illuminate/database": "^6.0 || ^8.0",
"illuminate/events": "^6.0 || ^8.0",
"illuminate/http": "^6.0 || ^8.0",
"illuminate/routing": "^6.0 || ^8.0",
"illuminate/support": "^6.0 || ^8.0",
"illuminate/view": "^6.0 || ^8.0",
"illuminate/config": "^8.0 || ^9.0",
"illuminate/container": "^8.0 || ^9.0",
"illuminate/contracts": "^8.0 || ^9.0",
"illuminate/database": "^8.0 || ^9.0",
"illuminate/events": "^8.0 || ^9.0",
"illuminate/http": "^8.0 || ^9.0",
"illuminate/routing": "^8.0 || ^9.0",
"illuminate/support": "^8.0 || ^9.0",
"illuminate/view": "^8.0 || ^9.0",
"vimeo/psalm": "^4.8.1",
"orchestra/testbench": "^3.8 || ^4.0 || ^5.0 || ^6.22 || ^7.0",
"barryvdh/laravel-ide-helper": ">=2.8.0"
"orchestra/testbench": "^6.22 || ^7.0",
"barryvdh/laravel-ide-helper": "^2.10"
},
"require-dev": {
"codeception/codeception": "^4.1.6",
"codeception/module-phpbrowser": "^1.0.0",
"codeception/module-asserts": "^1.0.0",
"weirdan/codeception-psalm-module": "^0.13.1",
"codeception/codeception": "^5.0",
"codeception/module-asserts": "*@dev",
"codeception/module-cli": "^2.0",
"codeception/module-filesystem": "^3.0",
"codeception/module-phpbrowser": "*@dev",
"slevomat/coding-standard": "^6.2",
"squizlabs/php_codesniffer": "*",
"slevomat/coding-standard": "^6.2"
"phpoption/phpoption": "^1.8.0",
"symfony/http-foundation": "^5.3.7 || ^6.0",
"ramsey/collection": "^1.2.0"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 1 addition & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@
<file>tests</file>
<exclude-pattern>src/cache/</exclude-pattern>
<exclude-pattern>tests/_support/</exclude-pattern>
<exclude-pattern>tests/Support/</exclude-pattern>
</ruleset>
7 changes: 6 additions & 1 deletion psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="dev-master@b07de1fefde4714f29bca0b56c632bd82855fc64">
<files psalm-version="4.22.0@fc2c6ab4d5fa5d644d8617089f012f3bb84b8703">
<file src="src/Providers/ApplicationProvider.php">
<MissingFile occurrences="1">
<code>require $applicationPath</code>
</MissingFile>
</file>
<file src="src/Providers/ModelStubProvider.php">
<PossiblyUndefinedMethod occurrences="1">
<code>databasePath</code>
Expand Down
1 change: 0 additions & 1 deletion src/Fakes/FakeMetaCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ protected function registerClassAutoloadExceptions(): callable
// by default, the ide-helper throws exceptions when it cannot find a class. However it does not unregister that
// autoloader when it is done, and we certainly do not want to throw exceptions when we are simply checking if
// a certain class exists. We are instead changing this to be a noop.

return function () {
};
}
Expand Down
2 changes: 1 addition & 1 deletion src/Fakes/FakeModelsCommandLogic.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function getModels(): array
*
* @param Model $model
*/
protected function getPropertiesFromTable($model): void
public function getPropertiesFromTable($model): void
{
$table_name = $model->getTable();

Expand Down
14 changes: 14 additions & 0 deletions stubs/EloquentBuilder.stubphp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,20 @@ class Builder
*/
public function firstOr($columns = ['*'], Closure $callback = null) { }

/**
* @param array $attributes
* @param array $values
* @return TModel|self<TModel>
*/
public function firstOrNew(array $attributes = [], array $values = []) { }

/**
* @param array $attributes
* @param array $values
* @return TModel|self<TModel>
*/
public function firstOrCreate(array $attributes = [], array $values = []) { }

/**
* @param string $column
* @return mixed
Expand Down
16 changes: 16 additions & 0 deletions stubs/HasOneOrMany.stubphp
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,20 @@ abstract class HasOneOrMany extends Relation
* @psalm-return \Illuminate\Database\Eloquent\Collection<TRelatedModel>
*/
public function createMany(array $records) { }

/**
* @param array $attributes
* @param array $values
* @return \Illuminate\Database\Eloquent\Model
* @psalm-return TRelatedModel
*/
public function firstOrNew(array $attributes = [], array $values = []) { }

/**
* @param array $attributes
* @param array $values
* @return \Illuminate\Database\Eloquent\Model
* @psalm-return TRelatedModel
*/
public function firstOrCreate(array $attributes = [], array $values = []) { }
}

0 comments on commit 7524304

Please sign in to comment.