Skip to content

Commit 04b70af

Browse files
authored
Merge pull request #7771 from ping-yee/220804-phpstan-pager-publisher-restful
Dev: Remove the `Pager`, `Publisher` and `RESTful` ignore errors in phpstan-baseline.php
2 parents eaa8f1a + 3eb083c commit 04b70af

File tree

7 files changed

+27
-56
lines changed

7 files changed

+27
-56
lines changed

phpstan-baseline.php

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,61 +1321,6 @@
13211321
'count' => 1,
13221322
'path' => __DIR__ . '/system/Model.php',
13231323
];
1324-
$ignoreErrors[] = [
1325-
'message' => '#^Method CodeIgniter\\\\Pager\\\\Exceptions\\\\PagerException\\:\\:forInvalidPaginationGroup\\(\\) has no return type specified\\.$#',
1326-
'count' => 1,
1327-
'path' => __DIR__ . '/system/Pager/Exceptions/PagerException.php',
1328-
];
1329-
$ignoreErrors[] = [
1330-
'message' => '#^Method CodeIgniter\\\\Pager\\\\Exceptions\\\\PagerException\\:\\:forInvalidTemplate\\(\\) has no return type specified\\.$#',
1331-
'count' => 1,
1332-
'path' => __DIR__ . '/system/Pager/Exceptions/PagerException.php',
1333-
];
1334-
$ignoreErrors[] = [
1335-
'message' => '#^Method CodeIgniter\\\\Pager\\\\Pager\\:\\:calculateCurrentPage\\(\\) has no return type specified\\.$#',
1336-
'count' => 1,
1337-
'path' => __DIR__ . '/system/Pager/Pager.php',
1338-
];
1339-
$ignoreErrors[] = [
1340-
'message' => '#^Method CodeIgniter\\\\Pager\\\\Pager\\:\\:ensureGroup\\(\\) has no return type specified\\.$#',
1341-
'count' => 1,
1342-
'path' => __DIR__ . '/system/Pager/Pager.php',
1343-
];
1344-
$ignoreErrors[] = [
1345-
'message' => '#^Method CodeIgniter\\\\Pager\\\\PagerRenderer\\:\\:updatePages\\(\\) has no return type specified\\.$#',
1346-
'count' => 1,
1347-
'path' => __DIR__ . '/system/Pager/PagerRenderer.php',
1348-
];
1349-
$ignoreErrors[] = [
1350-
'message' => '#^Method CodeIgniter\\\\Publisher\\\\Exceptions\\\\PublisherException\\:\\:forCollision\\(\\) has no return type specified\\.$#',
1351-
'count' => 1,
1352-
'path' => __DIR__ . '/system/Publisher/Exceptions/PublisherException.php',
1353-
];
1354-
$ignoreErrors[] = [
1355-
'message' => '#^Method CodeIgniter\\\\Publisher\\\\Exceptions\\\\PublisherException\\:\\:forDestinationNotAllowed\\(\\) has no return type specified\\.$#',
1356-
'count' => 1,
1357-
'path' => __DIR__ . '/system/Publisher/Exceptions/PublisherException.php',
1358-
];
1359-
$ignoreErrors[] = [
1360-
'message' => '#^Method CodeIgniter\\\\Publisher\\\\Exceptions\\\\PublisherException\\:\\:forFileNotAllowed\\(\\) has no return type specified\\.$#',
1361-
'count' => 1,
1362-
'path' => __DIR__ . '/system/Publisher/Exceptions/PublisherException.php',
1363-
];
1364-
$ignoreErrors[] = [
1365-
'message' => '#^Method CodeIgniter\\\\Publisher\\\\Publisher\\:\\:verifyAllowed\\(\\) has no return type specified\\.$#',
1366-
'count' => 1,
1367-
'path' => __DIR__ . '/system/Publisher/Publisher.php',
1368-
];
1369-
$ignoreErrors[] = [
1370-
'message' => '#^Method CodeIgniter\\\\RESTful\\\\BaseResource\\:\\:initController\\(\\) has no return type specified\\.$#',
1371-
'count' => 1,
1372-
'path' => __DIR__ . '/system/RESTful/BaseResource.php',
1373-
];
1374-
$ignoreErrors[] = [
1375-
'message' => '#^Method CodeIgniter\\\\RESTful\\\\BaseResource\\:\\:setModel\\(\\) has no return type specified\\.$#',
1376-
'count' => 1,
1377-
'path' => __DIR__ . '/system/RESTful/BaseResource.php',
1378-
];
13791324
$ignoreErrors[] = [
13801325
'message' => '#^Method CodeIgniter\\\\Router\\\\AutoRouter\\:\\:setDirectory\\(\\) has no return type specified\\.$#',
13811326
'count' => 1,

system/Pager/Exceptions/PagerException.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,21 @@
1515

1616
class PagerException extends FrameworkException
1717
{
18+
/**
19+
* Throws when the template is invalid.
20+
*
21+
* @return static
22+
*/
1823
public static function forInvalidTemplate(?string $template = null)
1924
{
2025
return new static(lang('Pager.invalidTemplate', [$template]));
2126
}
2227

28+
/**
29+
* Throws when the group is invalid.
30+
*
31+
* @return static
32+
*/
2333
public static function forInvalidPaginationGroup(?string $group = null)
2434
{
2535
return new static(lang('Pager.invalidPaginationGroup', [$group]));

system/Pager/Pager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,8 @@ public function only(array $queries): self
388388
* Ensures that an array exists for the group specified.
389389
*
390390
* @param int $perPage
391+
*
392+
* @return void
391393
*/
392394
protected function ensureGroup(string $group, ?int $perPage = null)
393395
{
@@ -414,6 +416,8 @@ protected function ensureGroup(string $group, ?int $perPage = null)
414416

415417
/**
416418
* Calculating the current page
419+
*
420+
* @return void
417421
*/
418422
protected function calculateCurrentPage(string $group)
419423
{

system/Pager/PagerRenderer.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ public function links(): array
289289
* to show.
290290
*
291291
* @param int|null $count The new "surroundCount"
292+
*
293+
* @return void
292294
*/
293295
protected function updatePages(?int $count = null)
294296
{

system/Publisher/Exceptions/PublisherException.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ class PublisherException extends FrameworkException
2525
*
2626
* @param string $from The source file
2727
* @param string $to The destination file
28+
*
29+
* @return static
2830
*/
2931
public static function forCollision(string $from, string $to)
3032
{
@@ -33,6 +35,8 @@ public static function forCollision(string $from, string $to)
3335

3436
/**
3537
* Throws when given a destination that is not in the list of allowed directories.
38+
*
39+
* @return static
3640
*/
3741
public static function forDestinationNotAllowed(string $destination)
3842
{
@@ -41,6 +45,8 @@ public static function forDestinationNotAllowed(string $destination)
4145

4246
/**
4347
* Throws when a file fails to match the allowed pattern for its destination.
48+
*
49+
* @return static
4450
*/
4551
public static function forFileNotAllowed(string $file, string $directory, string $pattern)
4652
{

system/Publisher/Publisher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ public function addLineBefore(string $file, string $line, string $before): bool
466466
/**
467467
* Verify this is an allowed file for its destination.
468468
*/
469-
private function verifyAllowed(string $from, string $to)
469+
private function verifyAllowed(string $from, string $to): void
470470
{
471471
// Verify this is an allowed file for its destination
472472
foreach ($this->restrictions as $directory => $pattern) {

system/RESTful/BaseResource.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ abstract class BaseResource extends Controller
3939

4040
/**
4141
* Constructor.
42+
*
43+
* @return void
4244
*/
4345
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
4446
{
@@ -52,6 +54,8 @@ public function initController(RequestInterface $request, ResponseInterface $res
5254
* Given either the name or the object, determine the other.
5355
*
5456
* @param object|string|null $which
57+
*
58+
* @return void
5559
*/
5660
public function setModel($which = null)
5761
{

0 commit comments

Comments
 (0)