Skip to content

Upgrade to PHP 8.5 and apply Rector cleanup - #675

Open
kayjoosten wants to merge 8 commits into
mainfrom
feature/issue-634-php85-upgrade
Open

kayjoosten wants to merge 8 commits into
mainfrom
feature/issue-634-php85-upgrade

Conversation

@kayjoosten

Copy link
Copy Markdown
Contributor

If applied, this commit will...

Raise the minimum and CI PHP version to 8.5, update Composer dependencies to versions compatible with it, and apply Rector's PHP 8.5 rule set across the codebase.

Why is this change needed?

Prior to this change, the project targeted PHP 8.2 and had not adopted newer language features available since, leaving code more verbose than it needs to be and falling behind the PHP version used by sibling projects.

How does it address the issue?

This change bumps the composer.json PHP constraint to ^8.5, updates the Docker images, CI workflow, and Scrutinizer config to PHP 8.5 with Node 24, adds rector/rector: ^2.4 with a rector.php config matching the one proposed in the issue, and applies Rector across src, tests, config, and bin. Constructor property promotion, readonly properties/classes, match expressions, str_contains()/str_starts_with(), ::class constants, and other PHP 8+ idioms were adopted throughout. One Rector rule (GetToConstructorInjectionRector) was skipped because it breaks this codebase's controllers, which rely on $this->get() service lookups rather than constructor autowiring. The full QA suite (phplint, phpstan, phpcs, phpmd, license headers, PHPUnit, Behat, ESLint, Encore build) passes on PHP 8.5.

Provide links to any relevant tickets, articles or other resources

Closes #634

@kayjoosten
kayjoosten force-pushed the feature/issue-634-php85-upgrade branch 3 times, most recently from 84fc897 to bc11bc4 Compare October 22, 2026 13:05
If applied, this commit will raise the minimum and CI PHP version to
8.5, update dependencies to versions compatible with it, and apply
Rector's PHP 8.5 rule set across the codebase.

Why is this change needed?
Prior to this change, the application was pinned to PHP 8.2 in
composer.json, the Docker base images, CI workflows and Scrutinizer
config. PHP 8.2 is approaching end of life and the project needs to
move to a currently supported version.

How does it address the issue?
This change:
- Raises the composer.json PHP constraint and platform override to
  ^8.5, and bumps rector/rector to ^2.4
- Switches the production and test Dockerfiles, the local compose
  override and the CI build-and-publish workflow to the
  php85-apache2-node24 base image
- Updates .scrutinizer.yml to use PHP 8.5 and Node v24
- Enables Rector's PHP version sets in ci/qa/rector.php and runs
  Rector against src/ and bin/, applying constructor property
  promotion, readonly properties/classes and other PHP 8.5 idioms
- Skips Rector's GetToConstructorInjectionRector, which assumes
  autowired controllers; this codebase relies on container-aware
  controllers resolving services through $this->get() and a service
  locator, so applying that rule broke the compiled DI container
- Reformats the constructors Rector collapsed onto a single line so
  they comply with the project's line-length and multi-line
  declaration coding standards
- Updates composer.lock and symfony.lock via composer update

Provide links to any relevant tickets, articles or other resources
#634
Prior to this change, many classes, attributes and docblock types were
referenced by their fully qualified name inline, which hurts readability.

This change enables Rector's import names option, applies it across the
code base, and aliases the one import that clashes with a local class.
Generated config files are skipped.
Prior to this change, the PR carried a regenerated config/reference.php,
a recipe-generated open_conext_monitor.yaml, and a Rector rewrite that
moved the ORM column of InstitutionConfiguration into a mixed promoted
constructor parameter.

This change restores the generated files from main, restores the explicit
property declaration, and tells Rector not to apply constructor promotion
to Doctrine entities.
Prior to this change, the PR added a retry loop around the functional
Behat suite that is unrelated to the PHP 8.5 upgrade and can hide real
failures, and Rector left the imports it added unsorted.

This change restores ci/qa/behat-functional from main, sorts all use
statements alphabetically, and enables the Slevomat
AlphabeticallySortedUses sniff in the PHPCS ruleset.
Prior to this change, Rector had added string casts, deprecation
attributes on unused test logger methods, and the lock file listed a
recipe for a package whose config file does not exist.

This change skips NullToStrictStringFuncCallArgRector, reverts the
casts it added (the array_key_exists cast is kept because another rule
requires it), drops #[\Deprecated] from the test logger, and removes the
orphan nyholm/psr7 entry from symfony.lock.
@johanib
johanib force-pushed the feature/issue-634-php85-upgrade branch from 6e0e60e to 01a2259 Compare November 19, 2026 09:49
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.

Upgrade to PHP 8.5 and apply Rector cleanup

2 participants