Skip to content

Make slic compatible with PHP 8.5 - #251

Draft
dpanta94 wants to merge 2 commits into
3.0.0from
fix/php-8-5-compatibility
Draft

dpanta94 wants to merge 2 commits into
3.0.0from
fix/php-8-5-compatibility

Conversation

@dpanta94

Copy link
Copy Markdown
Member

Make slic compatible with PHP 8.5, with a PHPCompatibility check in CI to keep it that way.

Ticket: none. This came out of the main → 3.0.0 merge cleanup, not a tracked issue.

What changed

PHP 8.5 deprecates the backtick operator, case labels ending in a semicolon and curl_close(), all of which slic used, so every command printed deprecation notices. Those are replaced. The new sniff also caught slic_stacks_resolve_from_path() reading its argument through func_get_arg(), which since PHP 7 returns the current value rather than the original, so its fallback for paths that do not exist was working with false.

composer compat runs PHPCompatibility (its develop branch, which is where the 8.5 sniffs live) with testVersion 8.2-8.5. The upper bound is pinned because develop already sniffs unreleased 8.6 changes; raise it when a new PHP version ships. The test matrix now covers PHP 8.2 through 8.5 and runs the compat check on 8.5.

Proof

Before, on PHP 8.5.10, any command:

Deprecated: Case statements followed by a semicolon (;) are deprecated ... src/docker.php on line 149
Deprecated: The backtick (`) operator is deprecated, use shell_exec() instead ... src/slic.php on line 1743

After:

composer compat    →  8 / 8 (100%), no errors or warnings
vendor/bin/phpunit →  OK (16 tests, 24 assertions)

Covered by the new PhpDeprecationsTest, which boots the CLI and fails on any Deprecated: output. It was red before the fixes and green after. The func_get_arg fix has no test of its own.

AI usage: Drafted with Claude Fable 5.1. I reviewed and tested every change — this is my work and I am accountable for it.

## Summary
slic now runs on PHP 8.5 without deprecation notices, and a PHPCompatibility check plus a wider CI matrix keep it that way.

## Why
PHP 8.5 deprecates the backtick operator, `case` labels ending in a semicolon and `curl_close()`, all of which slic used. The new sniff also caught `slic_stacks_resolve_from_path()` reading its argument through `func_get_arg()`, which since PHP 7 returns the current value rather than the original, so the fallback for paths that do not exist was working with `false` instead of the path.

`testVersion` is pinned to `8.2-8.5` rather than open-ended: the develop branch of PHPCompatibility already sniffs unreleased PHP 8.6 changes, which would fail CI for behavior that has not shipped. Raise the upper bound when a new PHP version lands.

## Testing
- [ ] `composer compat` reports no errors or warnings
- [ ] `vendor/bin/phpunit` passes on PHP 8.5, including the new `PhpDeprecationsTest`
@coderabbitai

coderabbitai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Comment @coderabbitai help to get the list of available commands.

Comment thread phpcs.xml.dist Outdated
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.

1 participant