Skip to content

Commit 14f6963

Browse files
committed
fix: make non-sqlsrv tests all green again
1 parent 51c3c25 commit 14f6963

5 files changed

Lines changed: 23 additions & 28 deletions

File tree

composer.json

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,23 +18,14 @@
1818
],
1919
"require": {
2020
"php": "^8.1",
21-
"illuminate/contracts": "^10.13.1|^11.0|^12.0",
22-
"illuminate/database": "^10.13.1|^11.0|^12.0",
23-
"illuminate/support": "^10.0|^11.0|^12.0"
21+
"laravel/framework": "^10.13.1|^11.0|^12.0"
2422
},
2523
"require-dev": {
26-
"larastan/larastan": "^2.7.0|^3.0",
2724
"laravel/pint": "^1.0",
28-
"nunomaduro/collision": "^7.0|^8.0",
2925
"orchestra/testbench": "^8.0|^9.0|^10.0",
3026
"pestphp/pest": "^2.28.1|^3.0.0",
3127
"pestphp/pest-plugin-laravel": "^2.2.0|^3.0.0",
32-
"phpstan/extension-installer": "^1.1",
33-
"phpstan/phpstan": "^1.11|^2.0",
34-
"phpstan/phpstan-deprecation-rules": "^1.0|^2.0",
35-
"phpstan/phpstan-phpunit": "^1.0|^2.0",
36-
"phpunit/phpunit": "^10.5.3|^11.0.0",
37-
"spatie/laravel-ray": "^1.26"
28+
"phpstan/phpstan": "^1.11|^2.0"
3829
},
3930
"autoload": {
4031
"psr-4": {
@@ -54,6 +45,9 @@
5445
"format": "vendor/bin/pint"
5546
},
5647
"config": {
48+
"audit": {
49+
"block-insecure": false
50+
},
5751
"sort-packages": true,
5852
"allow-plugins": {
5953
"pestphp/pest-plugin": true,

src/Function/Conditional/ManyArgumentsExpression.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ abstract class ManyArgumentsExpression implements Expression
1616
use StringizeExpression;
1717

1818
/**
19-
* @param non-empty-array<int, string|\Illuminate\Contracts\Database\Query\Expression> $expressions
19+
* @param non-empty-array<int, string|Expression> $expressions
2020
*/
2121
public function __construct(
2222
private readonly array $expressions,

src/Language/Cast.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ private function castMysql(float|int|string $expression): string
4545
// float one, but it will be silently downsized to a float when stored in a table.
4646
return match ($this->type) {
4747
'bigint', 'int' => "cast({$expression} as signed)",
48-
'float', 'double' => "(({$expression})*1.0)",
49-
default => throw new RuntimeException("Unknown cast type '{$this->type}'."), // @phpstan-ignore match.unreachable
48+
'float', 'double' => "(({$expression})*1.0)", // @phpstan-ignore match.alwaysTrue
49+
default => throw new RuntimeException("Unknown cast type '{$this->type}'."),
5050
};
5151
}
5252

@@ -56,17 +56,17 @@ private function castPgsql(float|int|string $expression): string
5656
'bigint' => "cast({$expression} as bigint)",
5757
'float' => "cast({$expression} as real)",
5858
'double' => "cast({$expression} as double precision)",
59-
'int' => "cast({$expression} as int)",
60-
default => throw new RuntimeException("Unknown cast type '{$this->type}'."), // @phpstan-ignore match.unreachable
59+
'int' => "cast({$expression} as int)", // @phpstan-ignore match.alwaysTrue
60+
default => throw new RuntimeException("Unknown cast type '{$this->type}'."),
6161
};
6262
}
6363

6464
private function castSqlite(float|int|string $expression): string
6565
{
6666
return match ($this->type) {
6767
'bigint', 'int' => "cast({$expression} as integer)",
68-
'float', 'double' => "cast({$expression} as real)",
69-
default => throw new RuntimeException("Unknown cast type '{$this->type}'."), // @phpstan-ignore match.unreachable
68+
'float', 'double' => "cast({$expression} as real)", // @phpstan-ignore match.alwaysTrue
69+
default => throw new RuntimeException("Unknown cast type '{$this->type}'."),
7070
};
7171
}
7272

@@ -76,8 +76,8 @@ private function castSqlsrv(float|int|string $expression): string
7676
'bigint' => "cast({$expression} as bigint)",
7777
'float' => "cast({$expression} as float(24))",
7878
'double' => "cast({$expression} as float(53))",
79-
'int' => "(({$expression})*1)",
80-
default => throw new RuntimeException("Unknown cast type '{$this->type}'."), // @phpstan-ignore match.unreachable
79+
'int' => "(({$expression})*1)", // @phpstan-ignore match.alwaysTrue
80+
default => throw new RuntimeException("Unknown cast type '{$this->type}'."),
8181
};
8282
}
8383
}

src/Operator/Arithmetic/ArithmeticExpression.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function getValue(Grammar $grammar): string
3434
}
3535

3636
/**
37-
* @return array<int, float|int|string>
37+
* @return array<array-key, float|int|string>
3838
*/
3939
protected function expressions(Grammar $grammar): array
4040
{

tests/Pest.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
declare(strict_types=1);
44

5+
use Illuminate\Database\Connection;
56
use Illuminate\Support\Facades\DB;
67
use Illuminate\Support\Facades\Schema;
78
use Pest\Expectation;
@@ -13,7 +14,7 @@
1314
)->in(__DIR__);
1415

1516
expect()->extend('toBeExecutable', function (?Closure $migration = null, array $options = []): Expectation {
16-
/** @var \Illuminate\Database\Connection $connection */
17+
/** @var Connection $connection */
1718
$connection = DB::connection();
1819

1920
$table = null;
@@ -67,10 +68,10 @@
6768

6869
function skipOnMariaBefore(string $version)
6970
{
70-
/** @var \Illuminate\Database\Connection $connection */
71+
/** @var Connection $connection */
7172
$connection = DB::connection();
7273

73-
if ($connection->getDriverName() !== 'mysql') {
74+
if (! in_array($connection->getDriverName(), ['mariadb', 'mysql'])) {
7475
return;
7576
}
7677

@@ -82,7 +83,7 @@ function skipOnMariaBefore(string $version)
8283

8384
function skipOnMysqlBefore(string $version): void
8485
{
85-
/** @var \Illuminate\Database\Connection $connection */
86+
/** @var Connection $connection */
8687
$connection = DB::connection();
8788

8889
if ($connection->getDriverName() !== 'mysql') {
@@ -97,7 +98,7 @@ function skipOnMysqlBefore(string $version): void
9798

9899
function skipOnPgsqlBefore(string $version): void
99100
{
100-
/** @var \Illuminate\Database\Connection $connection */
101+
/** @var Connection $connection */
101102
$connection = DB::connection();
102103

103104
if ($connection->getDriverName() !== 'pgsql') {
@@ -112,7 +113,7 @@ function skipOnPgsqlBefore(string $version): void
112113

113114
function skipOnSqliteBefore(string $version): void
114115
{
115-
/** @var \Illuminate\Database\Connection $connection */
116+
/** @var Connection $connection */
116117
$connection = DB::connection();
117118

118119
if ($connection->getDriverName() !== 'sqlite') {
@@ -127,7 +128,7 @@ function skipOnSqliteBefore(string $version): void
127128

128129
function skipOnSqlsrvBefore(string $version): void
129130
{
130-
/** @var \Illuminate\Database\Connection $connection */
131+
/** @var Connection $connection */
131132
$connection = DB::connection();
132133

133134
if ($connection->getDriverName() !== 'sqlsrv') {

0 commit comments

Comments
 (0)