Skip to content

Commit

Permalink
Merge pull request codeigniter4#7755 from ddevsr/model-type-specified
Browse files Browse the repository at this point in the history
docs: PHPStan `Model` no type specified
  • Loading branch information
kenjis authored Aug 1, 2023
2 parents 87454e6 + 82a8df2 commit add8ad8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
25 changes: 0 additions & 25 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,11 @@
'count' => 1,
'path' => __DIR__ . '/system/Autoloader/Autoloader.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\BaseModel\\:\\:chunk\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/BaseModel.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\BaseModel\\:\\:chunk\\(\\) has parameter \\$userFunc with no signature specified for Closure\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/BaseModel.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\BaseModel\\:\\:doOnlyDeleted\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/BaseModel.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\BaseModel\\:\\:initialize\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/BaseModel.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Cache\\\\CacheInterface\\:\\:initialize\\(\\) has no return type specified\\.$#',
'count' => 1,
Expand Down Expand Up @@ -1536,21 +1521,11 @@
'count' => 1,
'path' => __DIR__ . '/system/Log/Handlers/ChromeLoggerHandler.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Model\\:\\:chunk\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Model.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Model\\:\\:chunk\\(\\) has parameter \\$userFunc with no signature specified for Closure\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Model.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Model\\:\\:doOnlyDeleted\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Model.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Pager\\\\Exceptions\\\\PagerException\\:\\:forInvalidPaginationGroup\\(\\) has no return type specified\\.$#',
'count' => 1,
Expand Down
6 changes: 6 additions & 0 deletions system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ public function __construct(?ValidationInterface $validation = null)
/**
* Initializes the instance with any additional steps.
* Optionally implemented by child classes.
*
* @return void
*/
protected function initialize()
{
Expand Down Expand Up @@ -458,6 +460,8 @@ abstract protected function doPurgeDeleted();
* Works with the find* methods to return only the rows that
* have been deleted.
* This method works only with dbCalls.
*
* @return void
*/
abstract protected function doOnlyDeleted();

Expand Down Expand Up @@ -524,6 +528,8 @@ abstract public function countAllResults(bool $reset = true, bool $test = false)
* @param int $size Size
* @param Closure $userFunc Callback Function
*
* @return void
*
* @throws DataException
*/
abstract public function chunk(int $size, Closure $userFunc);
Expand Down
4 changes: 4 additions & 0 deletions system/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,8 @@ protected function doPurgeDeleted()
* Works with the find* methods to return only the rows that
* have been deleted.
* This method works only with dbCalls.
*
* @return void
*/
protected function doOnlyDeleted()
{
Expand Down Expand Up @@ -554,6 +556,8 @@ public function getIdValue($data)
* determine the rows to operate on.
* This method works only with dbCalls.
*
* @return void
*
* @throws DataException
*/
public function chunk(int $size, Closure $userFunc)
Expand Down

0 comments on commit add8ad8

Please sign in to comment.