diff --git a/composer.json b/composer.json index dcbba3b..c9126b1 100644 --- a/composer.json +++ b/composer.json @@ -14,6 +14,7 @@ }, "require-dev": { "harrygulliford/laravel-firebird": "dev-laravel-11.x", + "larastan/larastan": "^2.9", "orchestra/testbench": "^9.0", "phpstan/phpstan": "^1.10", "phpunit/phpunit": "^11.0", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 47e3df0..cd2b068 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,5 +1,7 @@ +includes: + - ./vendor/larastan/larastan/extension.neon parameters: - level: 0 + level: 1 paths: - src - tests diff --git a/tests/EloquentTest.php b/tests/EloquentTest.php index a18cd38..1e63417 100644 --- a/tests/EloquentTest.php +++ b/tests/EloquentTest.php @@ -11,7 +11,7 @@ class EloquentTest extends TestCase { public function testWithExpression() { - $users = User::withExpression('u', User::where('id', '>', 1)) + $users = User::query()->withExpression('u', User::where('id', '>', 1)) ->from('u') ->orderBy('id') ->get(); @@ -89,7 +89,7 @@ public function testInsertUsing() ->selectRaw('1 as views') ->where('id', '>', 1); - Post::withExpression('u', $query) + Post::query()->withExpression('u', $query) ->insertUsing(['id', 'user_id', 'views'], User::from('u')); $this->assertEquals([1, 2, 2, 3], Post::orderBy('user_id')->pluck('user_id')->all()); @@ -101,7 +101,7 @@ public function testUpdate() $this->markTestSkipped(); } - Post::withExpression('u', User::where('id', '>', 1)) + Post::query()->withExpression('u', User::where('id', '>', 1)) ->update([ 'views' => new Expression('(select count(*) from u)'), 'updated_at' => new DateTime(), @@ -116,7 +116,7 @@ public function testUpdateWithJoin() $this->markTestSkipped(); } - Post::withExpression('u', User::where('id', '>', 1)) + Post::query()->withExpression('u', User::where('id', '>', 1)) ->join('u', 'u.id', '=', 'posts.user_id') ->update([ 'views' => 1 @@ -131,7 +131,7 @@ public function testUpdateWithLimit() $this->markTestSkipped(); } - Post::withExpression('u', User::where('id', '>', 0)) + Post::query()->withExpression('u', User::where('id', '>', 0)) ->whereIn('user_id', User::from('u')->select('id')) ->orderBy('id') ->limit(1) @@ -148,7 +148,7 @@ public function testDelete() $this->markTestSkipped(); } - Post::withExpression('u', User::where('id', '>', 1)) + Post::query()->withExpression('u', User::where('id', '>', 1)) ->whereIn('user_id', User::from('u')->select('id')) ->delete(); @@ -161,7 +161,7 @@ public function testDeleteWithJoin() $this->markTestSkipped(); } - Post::withExpression('u', User::where('id', '>', 1)) + Post::query()->withExpression('u', User::where('id', '>', 1)) ->join('users', 'users.id', '=', 'posts.user_id') ->whereIn('user_id', User::from('u')->select('id')) ->delete(); @@ -176,9 +176,9 @@ public function testDeleteWithLimit() } if ($this->connection === 'singlestore') { - $query = Post::withExpression('u', User::where('id', '<', 2)); + $query = Post::query()->withExpression('u', User::where('id', '<', 2)); } else { - $query = Post::withExpression('u', User::where('id', '>', 0)) + $query = Post::query()->withExpression('u', User::where('id', '>', 0)) ->orderBy('id'); }