Skip to content

Fix newly reported PHPStan errors#142

Merged
swissspidy merged 1 commit into
mainfrom
fix/phpstan
May 19, 2026
Merged

Fix newly reported PHPStan errors#142
swissspidy merged 1 commit into
mainfrom
fix/phpstan

Conversation

@swissspidy
Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings May 19, 2026 09:46
@swissspidy swissspidy requested a review from a team as a code owner May 19, 2026 09:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses newly reported PHPStan static analysis errors in the cron event command by removing an incorrect inline PHPDoc type assertion for callbacks.

Changes:

  • Removed an overly-specific @var array{0: string, 1: string} PHPDoc annotation in format_callback() that conflicts with valid callable array forms (e.g., object method callbacks).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request removes an inaccurate PHPDoc annotation in src/Cron_Event_Command.php that incorrectly restricted the first element of a callback array to a string. The reviewer suggests that instead of removing the annotation entirely, it should be updated to correctly reflect that the first element can be either an object or a string, which preserves the benefits of static analysis.

I am having trouble creating individual review comments. Click here to see my feedback.

src/Cron_Event_Command.php (864-866)

medium

The removed @var annotation was incorrect because it specified that the first element of the array must be a string, whereas the code below correctly handles cases where it is an object (e.g., [$object, 'method']). Instead of removing the annotation entirely, it is better to provide an accurate type definition. This maintains the benefits of static analysis and provides clearer documentation for the expected structure of the $callback array.

			/**
			 * @var array{0: object|string, 1: string} $callback
			 */

@swissspidy swissspidy added this to the 2.3.9 milestone May 19, 2026
@swissspidy swissspidy merged commit 1203c73 into main May 19, 2026
70 checks passed
@swissspidy swissspidy deleted the fix/phpstan branch May 19, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants