Skip to content

Commit

Permalink
Increase PHPStan level
Browse files Browse the repository at this point in the history
  • Loading branch information
staudenmeir committed Aug 28, 2024
1 parent 3b07607 commit 4480082
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
includes:
- ./vendor/larastan/larastan/extension.neon
parameters:
level: 0
level: 1
paths:
- src
- tests
18 changes: 9 additions & 9 deletions tests/EloquentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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());
Expand 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(),
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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();

Expand All @@ -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();
Expand All @@ -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');
}

Expand Down

0 comments on commit 4480082

Please sign in to comment.