Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The requirements check (minimum PHP version + extensions) needs to stay PHP cross-version compatible to allow it to work properly.
As things were, what with the autoloader being loaded before the requirements check was run and the requirements check being part of the
Runner
class, this would block any PHP modernizations from being made to these files.It is my opinion that the requirements check:
To this end, I'm introducing a new
requirements.php
file in the project root. This file will be loaded in the bootstrapping of PHPCS/PHPCBF, both when running via the plain files (Composer, git clone), as well as when running via the PHAR file.This means there will now be only three files which need to stay PHP cross-version compatible:
bin/phpcs
bin/phpcbf
requirements.php
A very explicit warning about the need for these files to stay cross-version compatible has been added to in the file docblock of each of these files.
The PHP minimum for these three files has been set to PHP 5.3 for the following reasons:
bin/*
files (PHP 5.3+) and b) short arrays in the actual requirements check code (PHP 5.4+).Alongside the changes to the requirement checking, this commit also introduces a new GH Actions workflow to safeguard the requirements check for the future (and two helper scripts for use in the workflow).
This workflow will only run selectively when files involved in the requirements check, and the testing thereof, are changed.
Note: the exit code has not been changed (yet). This will be handled separately when addressing issue #184.
Suggested changelog entry
N/A
Related issues/external references
Fixes #530