Skip to content

Commit 5a557f7

Browse files
committed
fix: specify parameter types for Model when and whenNot methods via @phpstan-type
1 parent 22a237c commit 5a557f7

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎system/Model.php‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@
4040
*
4141
* @property-read BaseConnection $db
4242
*
43+
* @phpstan-type WhenCallback callable(BaseBuilder, mixed): mixed
44+
* @phpstan-type WhenDefaultCallback callable(BaseBuilder): mixed
45+
* @phpstan-import-type row_array from BaseModel
46+
*
4347
* @method $this groupBy($by, ?bool $escape = null)
4448
* @method $this groupEnd()
4549
* @method $this groupStart()
@@ -78,15 +82,11 @@
7882
* @method $this selectMax(string $select = '', string $alias = '')
7983
* @method $this selectMin(string $select = '', string $alias = '')
8084
* @method $this selectSum(string $select = '', string $alias = '')
81-
* @method $this when($condition, callable $callback, ?callable $defaultCallback = null)
82-
* @method $this whenNot($condition, callable $callback, ?callable $defaultCallback = null)
85+
* @method $this when($condition, WhenCallback $callback, ?WhenDefaultCallback $defaultCallback = null)
86+
* @method $this whenNot($condition, WhenCallback $callback, ?WhenDefaultCallback $defaultCallback = null)
8387
* @method $this where($key, $value = null, ?bool $escape = null)
8488
* @method $this whereIn(?string $key = null, $values = null, ?bool $escape = null)
8589
* @method $this whereNotIn(?string $key = null, $values = null, ?bool $escape = null)
86-
*
87-
* @phpstan-method $this when($condition, callable(BaseBuilder, mixed): mixed $callback, (callable(BaseBuilder): mixed)|null $defaultCallback = null)
88-
* @phpstan-method $this whenNot($condition, callable(BaseBuilder, mixed): mixed $callback, (callable(BaseBuilder): mixed)|null $defaultCallback = null)
89-
* @phpstan-import-type row_array from BaseModel
9090
*/
9191
class Model extends BaseModel
9292
{

0 commit comments

Comments
 (0)