Skip to content

Upgrade Codebase for PHP 7.4+ Compatibility Using Rector (Targeting Quantum v3.0) #307

Description

@armanist

Quantum PHP Framework v3.0 (planned for release around end of November) will raise the minimum supported PHP version to 7.4, while maintaining compatibility with PHP 8.0+.

This issue tracks the required upgrades using Rector to refactor and modernize the codebase accordingly.

🎯 Goals:

  • Enforce PHP 7.4 as the new minimum requirement
  • Ensure forward compatibility with PHP 8.0 and higher
  • Apply automated Rector refactoring rules where applicable
  • Prepare CI environment to test against multiple PHP versions (7.4, 8.0, 8.1, etc.)

🔧 Tasks:

  • Update composer.json to set php: ^7.4
  • Add Rector as a dev dependency:

composer require rector/rector --dev

  • Create rector.php config with these main rule sets:
LevelSetList::UP_TO_PHP_74
LevelSetList::UP_TO_PHP_80
SetList::CODE_QUALITY
SetList::TYPE_DECLARATION
  • Run Rector and review changes:

  • vendor/bin/rector process src --dry-run

  • Manually fix/refactor edge cases that Rector cannot handle

Update CI pipeline to test on:

  • PHP 7.4

  • PHP 8.0

  • PHP 8.1 (optional)

  • Add changelog entry about PHP 7.4+ requirement for v3.0

📌 Notes:

This upgrade must be completed before releasing v3.0
Ensure backward compatibility is not broken unnecessarily

Avoid usage of PHP 8.x-only features (union types, attributes, etc.) in core unless conditionally handled

Metadata

Metadata

Assignees

Fields

No fields configured for Feature.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions