Skip to content

[WIP] Drop support for PHP earlier than 7.4 and upgrade PHPStan to 2.x#35

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/drop-php-support-earlier-than-7-4
Draft

[WIP] Drop support for PHP earlier than 7.4 and upgrade PHPStan to 2.x#35
Copilot wants to merge 4 commits intomasterfrom
copilot/drop-php-support-earlier-than-7-4

Conversation

Copy link
Copy Markdown

Copilot AI commented May 4, 2026

  • Update composer.json: change PHP requirement from >=7.2 to >=7.4
  • Update composer.json: upgrade PHPstan from ^1.10 to ^2.0
  • Update .github/workflows/ci.yml: remove PHP 7.2 and 7.3 from the matrix
  • Run composer update and commit updated composer.lock

Copilot AI linked an issue May 4, 2026 that may be closed by this pull request
Copilot AI requested a review from donatj May 4, 2026 04:28
Copilot stopped work on behalf of donatj due to an error May 4, 2026 04:28
@donatj
Copy link
Copy Markdown
Owner

donatj commented May 4, 2026

@copilot phpstan is currently failing

…(), drop assertTrue(true)

Agent-Logs-Url: https://github.com/donatj/SimpleCalendar/sessions/f748e819-6c6d-447d-ad48-c2d2fe8ade30

Co-authored-by: donatj <133747+donatj@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented May 4, 2026

@copilot phpstan is currently failing

Fixed in 309d487. There were 4 PHPStan 2.x errors:

  1. src/SimpleCalendar.php:207assert($date !== false) was always true (PHPStan knows date('N', $int) never returns false). Removed it and inlined the date() call.
  2. src/SimpleCalendar.php:253$dayName was typed as mixed in string interpolation because rotate() declared array<int, mixed>. Added @template T so the string[] type is preserved through the by-reference call.
  3. test/SimpleCalendarTest.php:19$this->assertTrue(true) is vacuously true. Removed it.

Copilot finished work on behalf of donatj May 4, 2026 04:30
@donatj
Copy link
Copy Markdown
Owner

donatj commented May 4, 2026

@copilot phpcs is failing now

… add param-out, fix risky test

Agent-Logs-Url: https://github.com/donatj/SimpleCalendar/sessions/dbb21c82-dab4-4f9f-bd11-a6421b09055b

Co-authored-by: donatj <133747+donatj@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented May 4, 2026

@copilot phpcs is failing now

Fixed in 0a944f8. The CI was actually still failing on PHPStan (not PHPCS directly). The root cause was that the @template T + array_shift loop approach caused PHPStan to infer array<int, T|null> after mutation. I rewrote rotate() to use array_slice+array_merge instead, which keeps the type clean throughout, and added the @param-out annotation. PHPCS now also passes clean.

Copilot finished work on behalf of donatj May 4, 2026 04:36
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.

Updates

2 participants