Skip to content

Commit 496dece

Browse files
authored
Merge pull request #5970 from kenjis/fix-Model-static-analysis
fix: Model::_call() static analysis
2 parents a7fe439 + 56afff0 commit 496dece

3 files changed

Lines changed: 31 additions & 8 deletions

File tree

phpstan-baseline.neon.dist

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -665,11 +665,6 @@ parameters:
665665
count: 1
666666
path: system/Log/Logger.php
667667

668-
-
669-
message: "#^Call to an undefined method CodeIgniter\\\\Database\\\\BaseBuilder\\:\\:asArray\\(\\)\\.$#"
670-
count: 1
671-
path: system/Model.php
672-
673668
-
674669
message: "#^Property CodeIgniter\\\\RESTful\\\\ResourceController\\:\\:\\$formatter \\(CodeIgniter\\\\Format\\\\FormatterInterface\\) in isset\\(\\) is not nullable\\.$#"
675670
count: 1

system/Model.php

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,37 @@
3838
* - allow intermingling calls to the builder
3939
* - removes the need to use Result object directly in most cases
4040
*
41-
* @mixin BaseBuilder
42-
*
4341
* @property BaseConnection $db
42+
*
43+
* @method $this havingIn(?string $key = null, $values = null, ?bool $escape = null)
44+
* @method $this havingLike($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
45+
* @method $this havingNotIn(?string $key = null, $values = null, ?bool $escape = null)
46+
* @method $this join(string $table, string $cond, string $type = '', ?bool $escape = null)
47+
* @method $this like($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
48+
* @method $this limit(?int $value = null, ?int $offset = 0)
49+
* @method $this notHavingLike($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
50+
* @method $this notLike($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
51+
* @method $this offset(int $offset)
52+
* @method $this orderBy(string $orderBy, string $direction = '', ?bool $escape = null)
53+
* @method $this orHaving($key, $value = null, ?bool $escape = null)
54+
* @method $this orHavingIn(?string $key = null, $values = null, ?bool $escape = null)
55+
* @method $this orHavingLike($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
56+
* @method $this orHavingNotIn(?string $key = null, $values = null, ?bool $escape = null)
57+
* @method $this orLike($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
58+
* @method $this orNotHavingLike($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
59+
* @method $this orNotLike($field, string $match = '', string $side = 'both', ?bool $escape = null, bool $insensitiveSearch = false)
60+
* @method $this orWhere($key, $value = null, ?bool $escape = null)
61+
* @method $this orWhereIn(?string $key = null, $values = null, ?bool $escape = null)
62+
* @method $this orWhereNotIn(?string $key = null, $values = null, ?bool $escape = null)
63+
* @method $this select($select = '*', ?bool $escape = null)
64+
* @method $this selectAvg(string $select = '', string $alias = '')
65+
* @method $this selectCount(string $select = '', string $alias = '')
66+
* @method $this selectMax(string $select = '', string $alias = '')
67+
* @method $this selectMin(string $select = '', string $alias = '')
68+
* @method $this selectSum(string $select = '', string $alias = '')
69+
* @method $this where($key, $value = null, ?bool $escape = null)
70+
* @method $this whereIn(?string $key = null, $values = null, ?bool $escape = null)
71+
* @method $this whereNotIn(?string $key = null, $values = null, ?bool $escape = null)
4472
*/
4573
class Model extends BaseModel
4674
{

tests/system/Models/FindModelTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public function testSoftDeleteWithTableJoinsFirst(): void
338338
{
339339
$this->seeInDatabase('user', ['name' => 'Derek Jones', 'deleted_at' => null]);
340340

341-
$results = $this->createModel(UserModel::class)->join('job', 'job.id = user.id')->first(1);
341+
$results = $this->createModel(UserModel::class)->join('job', 'job.id = user.id')->first();
342342
$this->assertSame(1, (int) $results->id);
343343
}
344344
}

0 commit comments

Comments
 (0)