Skip to content

Commit 3d23ea2

Browse files
Add 13.x support for Orbit 1.x (#180)
* Add 13.x support for Orbit 1.x * Exclude PHP 8.2 for 13.x * Drop Laravel 11 support * Remove Laravel 11 from CI * Simplify dependencies * Simplify CI * Keep PHPStan high * Prevent recursive booting * Fix PHPStan * Fix dependencies * Make PHPStan happy
1 parent 2a4274d commit 3d23ea2

7 files changed

Lines changed: 29 additions & 21 deletions

File tree

.github/workflows/tests.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,17 @@ jobs:
1414
matrix:
1515
os: [ubuntu-latest]
1616
php: ['8.2', '8.3', '8.4']
17-
laravel: ['11.*', '12.*']
18-
stability: [prefer-lowest, prefer-stable]
17+
laravel: ['12.*', '13.*']
1918
include:
20-
- laravel: 11.*
21-
testbench: 9.*
2219
- laravel: 12.*
2320
testbench: ^10.0
21+
- laravel: 13.*
22+
testbench: ^11.0
23+
exclude:
24+
- laravel: 13.*
25+
php: '8.2'
2426

25-
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
27+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.os }}
2628

2729
steps:
2830
- name: Checkout code
@@ -43,7 +45,7 @@ jobs:
4345
- name: Install dependencies
4446
run: |
4547
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
46-
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
48+
composer update --prefer-dist --no-interaction
4749
4850
- name: Execute tests
4951
run: vendor/bin/phpunit --colors=always

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@
1111
}
1212
],
1313
"require": {
14-
"php": "^8.0",
14+
"php": "^8.2",
1515
"ext-json": "*",
16-
"illuminate/console": "^11.0 | ^12.0",
17-
"illuminate/database": "^11.0 | ^12.0",
18-
"illuminate/events": "^11.0 | ^12.0",
19-
"illuminate/support": "^11.0 | ^12.0",
16+
"illuminate/console": "^12.0 | ^13.0",
17+
"illuminate/database": "^12.0 | ^13.0",
18+
"illuminate/events": "^12.0 | ^13.0",
19+
"illuminate/support": "^12.0 | ^13.0",
2020
"spatie/yaml-front-matter": "^2.0",
2121
"symfony/yaml": "^6.0 | ^7.0"
2222
},
2323
"require-dev": {
24-
"laravel/scout": "^9.4 | ^10.0",
25-
"nunomaduro/larastan": "^2.0",
26-
"orchestra/testbench": "^9.0 | ^10.0",
24+
"laravel/scout": "^10.0 | ^11.0",
25+
"nunomaduro/larastan": "^3.0",
26+
"orchestra/testbench": "^10.0 | ^11.0",
2727
"phpstan/extension-installer": "^1.1",
2828
"phpstan/phpstan-deprecation-rules": "^1.0 | ^2.0",
2929
"phpstan/phpstan-phpunit": "^1.0 | ^2.0",
30-
"phpunit/phpunit": "^10.0 | ^11.5.3"
30+
"phpunit/phpunit": "^11.5.3"
3131
},
3232
"extra": {
3333
"laravel": {

phpstan.neon.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ parameters:
55
level: 5
66
paths:
77
- src
8-
- config
98
tmpDir: build/phpstan
109
checkOctaneCompatibility: true
1110
checkModelProperties: true
12-
checkMissingIterableValueType: false

src/Commands/GenerateCommand.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Illuminate\Database\Schema\Blueprint;
77
use Illuminate\Database\Schema\ColumnDefinition;
88
use Illuminate\Support\Collection;
9+
use Illuminate\Support\Facades\DB;
910
use Illuminate\Support\Str;
1011

1112
class GenerateCommand extends Command
@@ -41,7 +42,10 @@ public function handle()
4142

4243
protected function getColumnsFromModel(string $modelClass): Collection
4344
{
44-
$blueprint = new Blueprint('__orbit:generate__');
45+
$blueprint = new Blueprint(
46+
DB::connection('orbit'),
47+
Str::snake(Str::pluralStudly(class_basename($modelClass))),
48+
);
4549

4650
/**
4751
* @psalm-suppress InvalidStringClass

src/Concerns/Orbital.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Orbit\Support;
1717
use ReflectionClass;
1818

19+
// @phpstan-ignore trait.unused
1920
trait Orbital
2021
{
2122
protected static $orbit;
@@ -31,13 +32,15 @@ public static function bootOrbital()
3132
$driver = Orbit::driver(static::getOrbitalDriver());
3233
$modelFile = (new ReflectionClass(static::class))->getFileName();
3334

35+
$instance = (new ReflectionClass(static::class))->newInstanceWithoutConstructor();
36+
3437
if (
3538
Orbit::isTesting() ||
3639
filemtime($modelFile) > filemtime(Orbit::getDatabasePath()) ||
3740
$driver->shouldRestoreCache(static::getOrbitalPath()) ||
38-
! static::resolveConnection()->getSchemaBuilder()->hasTable((new static())->getTable())
41+
! static::resolveConnection()->getSchemaBuilder()->hasTable($instance->getTable())
3942
) {
40-
(new static())->migrate();
43+
$instance->migrate();
4144
}
4245

4346
static::created(function (Model $model) {

src/Concerns/SoftDeletes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use Orbit\Events\OrbitalUpdated;
1313
use Orbit\Facades\Orbit;
1414

15+
// @phpstan-ignore trait.unused
1516
trait SoftDeletes
1617
{
1718
use EloquentSoftDeletes;

tests/TestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ protected function getPackageProviders($app)
1515
];
1616
}
1717

18-
public function getEnvironmentSetUp($app)
18+
public function defineEnvironment($app)
1919
{
2020
$app['config']->set('database.default', 'sqlite');
2121
$app['config']->set('database.connections.sqlite.database', ':memory:');

0 commit comments

Comments
 (0)