Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev: Remove the Pager, Publisher and RESTful ignore errors in phpstan-baseline.php #7771

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 0 additions & 55 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -1466,61 +1466,6 @@
'count' => 1,
'path' => __DIR__ . '/system/Model.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Pager\\\\Exceptions\\\\PagerException\\:\\:forInvalidPaginationGroup\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Pager/Exceptions/PagerException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Pager\\\\Exceptions\\\\PagerException\\:\\:forInvalidTemplate\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Pager/Exceptions/PagerException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Pager\\\\Pager\\:\\:calculateCurrentPage\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Pager/Pager.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Pager\\\\Pager\\:\\:ensureGroup\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Pager/Pager.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Pager\\\\PagerRenderer\\:\\:updatePages\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Pager/PagerRenderer.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Publisher\\\\Exceptions\\\\PublisherException\\:\\:forCollision\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Publisher/Exceptions/PublisherException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Publisher\\\\Exceptions\\\\PublisherException\\:\\:forDestinationNotAllowed\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Publisher/Exceptions/PublisherException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Publisher\\\\Exceptions\\\\PublisherException\\:\\:forFileNotAllowed\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Publisher/Exceptions/PublisherException.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Publisher\\\\Publisher\\:\\:verifyAllowed\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/Publisher/Publisher.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\RESTful\\\\BaseResource\\:\\:initController\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/RESTful/BaseResource.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\RESTful\\\\BaseResource\\:\\:setModel\\(\\) has no return type specified\\.$#',
'count' => 1,
'path' => __DIR__ . '/system/RESTful/BaseResource.php',
];
$ignoreErrors[] = [
'message' => '#^Method CodeIgniter\\\\Router\\\\AutoRouter\\:\\:setDirectory\\(\\) has no return type specified\\.$#',
'count' => 1,
Expand Down
10 changes: 10 additions & 0 deletions system/Pager/Exceptions/PagerException.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,21 @@

class PagerException extends FrameworkException
{
/**
* Throws when the template is invalid.
*
* @return static
*/
public static function forInvalidTemplate(?string $template = null)
{
return new static(lang('Pager.invalidTemplate', [$template]));
}

/**
* Throws when the group is invalid.
*
* @return static
*/
public static function forInvalidPaginationGroup(?string $group = null)
{
return new static(lang('Pager.invalidPaginationGroup', [$group]));
Expand Down
4 changes: 4 additions & 0 deletions system/Pager/Pager.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,8 @@ public function only(array $queries): self
* Ensures that an array exists for the group specified.
*
* @param int $perPage
*
* @return void
*/
protected function ensureGroup(string $group, ?int $perPage = null)
{
Expand All @@ -414,6 +416,8 @@ protected function ensureGroup(string $group, ?int $perPage = null)

/**
* Calculating the current page
*
* @return void
*/
protected function calculateCurrentPage(string $group)
{
Expand Down
2 changes: 2 additions & 0 deletions system/Pager/PagerRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,8 @@ public function links(): array
* to show.
*
* @param int|null $count The new "surroundCount"
*
* @return void
*/
protected function updatePages(?int $count = null)
{
Expand Down
6 changes: 6 additions & 0 deletions system/Publisher/Exceptions/PublisherException.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ class PublisherException extends FrameworkException
*
* @param string $from The source file
* @param string $to The destination file
*
* @return static
*/
public static function forCollision(string $from, string $to)
{
Expand All @@ -33,6 +35,8 @@ public static function forCollision(string $from, string $to)

/**
* Throws when given a destination that is not in the list of allowed directories.
*
* @return static
*/
public static function forDestinationNotAllowed(string $destination)
{
Expand All @@ -41,6 +45,8 @@ public static function forDestinationNotAllowed(string $destination)

/**
* Throws when a file fails to match the allowed pattern for its destination.
*
* @return static
*/
public static function forFileNotAllowed(string $file, string $directory, string $pattern)
{
Expand Down
2 changes: 1 addition & 1 deletion system/Publisher/Publisher.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public function addLineBefore(string $file, string $line, string $before): bool
/**
* Verify this is an allowed file for its destination.
*/
private function verifyAllowed(string $from, string $to)
private function verifyAllowed(string $from, string $to): void
{
// Verify this is an allowed file for its destination
foreach ($this->restrictions as $directory => $pattern) {
Expand Down
4 changes: 4 additions & 0 deletions system/RESTful/BaseResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ abstract class BaseResource extends Controller

/**
* Constructor.
*
* @return void
*/
public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger)
{
Expand All @@ -52,6 +54,8 @@ public function initController(RequestInterface $request, ResponseInterface $res
* Given either the name or the object, determine the other.
*
* @param object|string|null $which
*
* @return void
*/
public function setModel($which = null)
{
Expand Down