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

Fix: Remove the Debug ignore errors. #7796

Closed

Conversation

kai890707
Copy link
Contributor

@kai890707 kai890707 commented Aug 8, 2023

Description
See #7731

The remaining two sections of the Debug have not been corrected.

The viewer attribute refers to the RendererInterface, but the RendererInterface has undefined method of getPerformanceData() and getData() methods.
Maybe replace the viewer attribute reference with CodeIgniter\View\View?

After issuing this PR, I tried to change the reference attribute and phpstan does not show Debug section related errors.
I will update the commit to this PR if needed.

before the change viewer attribute refers

  • phpstan-baseline.php :

image

  • system/Debug/Toolbar/Collectors/Views.php :

image
image

after the change viewer attribute refers

  • phpstan-baseline.php :
    image

  • system/Debug/Toolbar/Collectors/Views.php :
    image

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again! Some more comments on this one.

system/Debug/Iterator.php Outdated Show resolved Hide resolved
system/Debug/Timer.php Outdated Show resolved Hide resolved
system/Debug/Toolbar/Collectors/Database.php Outdated Show resolved Hide resolved
system/Debug/Toolbar/Collectors/Database.php Outdated Show resolved Hide resolved
*/
public $logCache;
public array $logCache;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change for class extensions. Please explain or revert.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @MGatner , thanks for your reply.
I have now restored this attribute to its original state.
The reason I will make this change is because of the following.

$ignoreErrors[] = [ 'message' => '#^Property CodeIgniter\\\\Log\\\\Logger\\:\\:\\$logCache \\(array\\) on left side of \\?\\? is not nullable\\.$#', 'count' => 1, 'path' => __DIR__ . '/system/Debug/Toolbar/Collectors/Logs.php', ];

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is not a "type specified" error. We can tackle that in separate PR.

system/Debug/Timer.php Outdated Show resolved Hide resolved
* @param string $name The name of the timer
* @param callable $callable callable to be executed
* @param string $name The name of the timer
* @phpstan-param callable():mixed $callable callable to be executed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @phpstan-param callable():mixed $callable callable to be executed
* @phpstan-param callable(): mixed $callable callable to be executed

@@ -434,6 +436,8 @@ public function prepare(?RequestInterface $request = null, ?ResponseInterface $r
* Inject debug toolbar into the response.
*
* @codeCoverageIgnore
*
* @return void
Copy link
Member

@kenjis kenjis Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return void
* @return void
* @phpstan-return never|void

@@ -112,6 +114,8 @@ public function initialize()
* and fire an event that allows custom actions to be taken at this point.
*
* @codeCoverageIgnore
*
* @return void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return void
* @return void
* @phpstan-return never|void

@@ -189,6 +193,8 @@ public function errorHandler(int $severity, string $message, ?string $file = nul
* need to be caught and handle them.
*
* @codeCoverageIgnore
*
* @return void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return void
* @return void
* @phpstan-return never|void

@@ -243,6 +249,8 @@ protected function determineView(Throwable $exception, string $templatePath): st

/**
* Given an exception and status code will display the error to the client.
*
* @return void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return void
* @return void
* @phpstan-return never|void

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants