Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release PHPCSExtra 1.1.1 #269

Merged
merged 25 commits into from
Aug 26, 2023
Merged

Release PHPCSExtra 1.1.1 #269

merged 25 commits into from
Aug 26, 2023

Conversation

jrfnl
Copy link
Member

@jrfnl jrfnl commented Aug 26, 2023

Release checklist

General

Release

  • Merge this PR
  • Make sure all CI builds are green.
  • Tag and create a release (careful, GH defaults to develop!) & copy & paste the changelog to it.
    ✏️ Check if anything from the link collection at the bottom of the changelog needs to be copied in!
  • Make sure all CI builds are green.
  • Close the milestone
  • Open a new milestone for the next release
  • If any open PRs/issues which were milestoned for this release did not make it into the release, update their milestone.
  • Fast-forward develop to be equal to stable

Publicize

  • Tweet about the release.

szepeviktor and others added 25 commits July 19, 2023 21:12
... which wasn't completely alphabetic anymore.
…order

README: fix order of the sniff list
... in anticipation of additional test case files being added.
If no `php_version` is passed, the sniff will behave as before.

However, is a `php_version` is passed, the sniff will now selectively stay silent depending on the configured PHP and whether the proposed fixes could be applied.

Includes additional tests.
Includes adding information about the support of the `php_version` config setting to the README docs.
…version

Modernize/Dirname: respect a passed `php_version`
…e-statements

CS: alphabetize use statements
These variables are only accessed within conditions and those conditions already sufficiently ensure that the variables will be set for the conditions path.

Even so, PHPStan cannot handle this, so we may as well declare sensible defaults for each of those variables to make things more explicit.
This variable is only accessed within conditions and those conditions already sufficiently ensure that the variable will be set for the conditions path.

Even so, PHPStan cannot handle this, so we may as well declare a sensible default for this variable to make things more explicit.
These variables are only accessed within conditions and those conditions already sufficiently ensure that the variables will be set for the conditions path.

Even so, PHPStan cannot handle this, so we may as well declare sensible defaults for each of those variables to make things more explicit.
The condition was checking the wrong variable against `false`.
…t-redundant-defaults

Various sniffs: set redundant default values
... by casting to `int` for a property which expects `int`.
…abs-type-safety

Universal/DisallowInlineTabs: increase type safety
... and make these docblocks a little more consistent.
... and make them more consistent across the sniffs.
Definitely not claiming completeness. This is just another iteration step in improving the documented types.
PHPStan is a good addition to our QA toolkit and with improvements PHPStan has made over the years is now a viable tool for us to use (previously it would give way too many false positives).

This commit:
* Adds a separate job to the `basics` workflow in GH Actions.
    Notes:
    - I've **not** added PHPStan to the Composer dependencies for two reasons:
        1. It doesn't allow for installation on PHP < 7.2, which would break/block the `composer install` for our test runs.
        2. It would add dependencies which could conflict/cause problems for our test runs due to those defining token constants too.
    - [Phive](https://phar.io/) could potentially be used to still have a setup which can be used locally, but just running locally from a PHPStan PHAR file should work just fine.
    - For CI, PHPStan will be installed as a PHAR file by `setup-php` now.
        This does carry a risk _if_ PHPStan would make breaking changes or if a new release adds rules for the levels being scanned as, in that case, builds could unexpectedly start failing.
        Fixing the version for the `setup-php` action installs to the current release `1.10.32` could prevent that, but that adds an additional maintenance burden of having to keep updating the version as PHPStan releases pretty often.
        So, for now, I've elected to run the risk of random failures. If and when those start happening, this should be re-evaluated.
    - The PHP version for the CI run is set to PHP 7.4 to prevent PHPStan throwing some errors/notices related to the outdated PHPUnit version being used.
* Adds a configuration file for PHPStan.
    Notes:
    - PHPStan needs to know about the dependencies (PHPCS et al), so I'm (re-)using the bootstrap file for the tests to load the PHPCS autoloader and register the standard with the PHPCS autoloader as adding an `autoload` directive to the `composer.json` file would cause problems with the PHPCS autoloader.
    - PHPStan flags type checks on properties with a documented type, while without `strict_types` we cannot always be sure the properties set will be of the correct type. For that reason, I've set `treatPhpDocTypesAsCertain` to `false` (which silences those notices).
    - I've gone through the scan results up to level 6 with a fine toothcomb and fixed what was reasonable to fix and ignored those things which should *not* be fixed.
* Adds the configuration file to `.gitattributes` and the typical overload file for the configuration file to `.gitignore`.

Refs:
* https://phpstan.org/
* https://phpstan.org/config-reference
@jrfnl jrfnl added this to the 1.1.1 milestone Aug 26, 2023
@jrfnl jrfnl merged commit 98bcdba into stable Aug 26, 2023
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants