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

New Universal.DeclareStatements.DeclareStatementsStyle sniff #129

Open
wants to merge 126 commits into
base: develop
Choose a base branch
from

Commits on Dec 9, 2022

  1. Configuration menu
    Copy the full SHA
    a70635c View commit details
    Browse the repository at this point in the history
  2. Remove renamed files

    dingo-d authored and jrfnl committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    7e27d1b View commit details
    Browse the repository at this point in the history
  3. Rewrite the sniff according to the PR suggestions

    To do: add fixers and metric
    dingo-d authored and jrfnl committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    98925a9 View commit details
    Browse the repository at this point in the history
  4. Update docs for the sniff

    Will probably need some fixup.
    dingo-d authored and jrfnl committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    74ee334 View commit details
    Browse the repository at this point in the history
  5. Update test file

    dingo-d authored and jrfnl committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    0acf7a2 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    bfcf2b4 View commit details
    Browse the repository at this point in the history
  7. Initial attempt at adding metrics

    dingo-d authored and jrfnl committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    dede6f8 View commit details
    Browse the repository at this point in the history
  8. Remove fixer comments

    dingo-d authored and jrfnl committed Dec 9, 2022
    Configuration menu
    Copy the full SHA
    a8d53eb View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    5834c64 View commit details
    Browse the repository at this point in the history

Commits on May 28, 2023

  1. ✨ New Universal.CodeAnalysis.StaticInFinalClass sniff

    New sniff to detect using `static` instead of `self` in OO constructs which are `final`.
    
    Includes fixer.
    Includes unit tests.
    Includes documentation.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    9a6284e View commit details
    Browse the repository at this point in the history
  2. ✨ New Universal.Operators.TypeSeparatorSpacing sniff

    New sniff to enforce no spaces around union type and intersection type separator operators.
    
    Includes fixer.
    Includes unit tests.
    Includes documentation.
    Includes metrics.
    
    Co-authored-by: Denis Žoljom <denis.zoljom@gmail.com>
    jrfnl and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    e573d36 View commit details
    Browse the repository at this point in the history
  3. NormalizedArrays/ArrayBraceSpacing: allow for trailing comments after…

    … array opener
    
    ... when a new line is required after the opener of a multi-line array.
    
    This sniff should not have an opinion on whether or not trailing comments are allowed. There are other sniffs around to forbid those, if so desired.
    
    Includes extra unit tests to safeguard this change and to safeguard handling of comments after the array opener regardless of this change.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    c1f8436 View commit details
    Browse the repository at this point in the history
  4. ✨ New Universal.WhiteSpace.PrecisionAlignment sniff

    New sniff to enforce indentation to always be a multiple of a tabstop, i.e. disallow precision alignment.
    
    For space-based standards, the `Generic.WhiteSpace.DisallowTabIndent` sniff (unintentionally/incorrectly) already removes precision alignment.
    For tab-based standards, the `Generic.WhiteSpace.DisallowSpaceIndent` sniff, however, does not remove precision alignment.
    With that in mind, this sniff is mostly intended for standards which demand tabs for indentation.
    
    In rare cases, spaces for precision alignment can be intentional and acceptable, but more often than not, precision alignment is a typo.
    
    Notes:
    * This sniff does not concern itself with tabs versus spaces.
        Use the PHPCS native `Generic.WhiteSpace.DisallowTabIndent` or the `Generic.WhiteSpace.DisallowSpaceIndent` sniffs for that.
    * When using this sniff with tab-based standards, please ensure that the `tab-width` is set and either don't set the `$indent` property or set it to the tab-width (or a multiple thereof).
    * Precision alignment *within* text strings (multi-line text strings, heredocs, nowdocs) will NOT be flagged by this sniff.
    * Precision alignment in (trailing) whitespace on otherwise blank lines will not be flagged by default.
        Most standards will automatically remove trailing whitespace anyway using the `Squiz.WhiteSpace.SuperfluousWhitespace` sniff.
        If the Squiz sniff is not used, set the `ignoreBlankLines` property to `false` to enable reporting for this.
    * The sniff also supports an option to ignore precision alignment in specific situations, like for multi-line chained method calls.
    
    **Note**: the fixer works based on "best guess" and may not always result in the desired indentation. Combine this sniff with the `Generic.WhiteSpace.ScopeIndent` sniff for more precise indentation fixes.
    If so desired, the fixer can be turned off by including the rule in a standard like so: `<rule phpcs-only="true" ref="Universal.WhiteSpace.PrecisionAlignment"/>`
    
    As it is, the sniff supports both PHP, as well as JS and CSS, though the support for JS and CSS should be considered incidental and will be removed once PHPCS 4.0 will be released.
    
    Includes fixer.
    Includes unit tests.
    Includes documentation.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    772e7d8 View commit details
    Browse the repository at this point in the history
  5. ✨ New Universal.WhiteSpace.AnonClassKeywordSpacing sniff

    Checks the amount of spacing between the `class` keyword and the open parenthesis (if any) for anonymous class declarations.
    
    The expected amount of spacing is configurable and defaults to `0`.
    
    The default value of `0` has been decided upon based on scanning a not insignificant number of codebases and determining the prevailing style used for anonymous classes.
    It is also in line with the previously proposed [errata for PSR12](php-fig/fig-standards#1206).
    
    Includes fixer.
    Includes unit tests.
    Includes documentation.
    Includes metrics.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    1e78d8e View commit details
    Browse the repository at this point in the history
  6. QA: make all classes final

    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    dacf3d8 View commit details
    Browse the repository at this point in the history
  7. Universal/PrecisionAlignment: rename a local variable

    ... to be more descriptive.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    6a3690c View commit details
    Browse the repository at this point in the history
  8. Universal/PrecisionAlignment: remove superfluous fixed file

    This file is not supposed to yield errors/warnings, so the `.fixed` file is redundant.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    053fa6a View commit details
    Browse the repository at this point in the history
  9. WhiteSpace/PrecisionAlignment: best guess tabs vs spaces when fixing

    Enhancement to minimize fixer conflicts/speed up fixer runs.
    
    With this change, the fixer will check whether tab replacement has been done on the indent in the original token content and if so, the fixer will use tabs for the indent replacement instead of spaces.
    
    Includes updated unit tests.
    Includes minor test adjustment to ensure that tabs used for inline alignment (vs indent) are disregarded when determining whether tabs or spaces should be used by the fixer.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    d6ce6ef View commit details
    Browse the repository at this point in the history
  10. WhiteSpace/PrecisionAlignment: bug fix - improved handling of heredoc…

    …/nowdoc closers
    
    This commit fixes two bugs:
    1. When a heredoc/nowdoc closer (PHP 7.3+ flexible syntax) is indented with tabs, PHPCS does not replace tabs with spaces in the token.
        This means the token `'length'` key will also be tab-based, which leads to incorrrect calculations and false positives with incorrect fixes.
        Fixed now by handling tab replacement in heredoc/nowdoc closer tokens in the sniff itself.
    2. A heredoc/nowdoc closer using flexible syntax is not allowed to have a larger indent than any of the content of the heredoc/nowdoc. Doing so results in a parse error.
        With the "best guess" rounding of the indent, the sniff had a risk of introducing these kind of parse errors.
        Fixed now by always rounding the expected indent down to the nearest tabstop for these tokens.
    
    Includes additional unit tests to cover the changes.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    58fe9e5 View commit details
    Browse the repository at this point in the history
  11. Add "static analysis" Composer keyword

    As per https://getcomposer.org/doc/04-schema.md#keywords by including "static analysis" as a keyword in the `composer.json` file, Composer 2.4.0-RC1 and later will prompt users if the package is installed with `composer require` instead of `composer require --dev`. See composer/composer#10960 for more info.
    GaryJones authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    40140a7 View commit details
    Browse the repository at this point in the history
  12. Composer/GH Actions: start using PHPCSDevTools 1.2.0

    PHPCSDevTools 1.2.0 introduces an XSD for the XML docs which can accompany sniffs.
    
    This commit:
    * Updates the PHPCSDevTools to version 1.2.0.
    * Adds a new check against the XSD for all sniff XML Docs files.
    
    Ref: https://github.com/PHPCSStandards/PHPCSDevTools/releases/tag/1.2.0
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    72e5868 View commit details
    Browse the repository at this point in the history
  13. Sniff XML docs: add schema to docs

    Includes adding the `<?xml..?>` header if it didn't exist in the file.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    7cd20f1 View commit details
    Browse the repository at this point in the history
  14. Composer: up the minimum PHPCS version to 3.7.1

    Raise the minimum supported PHPCS version to PHPCS 3.7.1, in line with PHPCSUtils.
    
    Includes updating the GH Actions matrixes for this change.
    
    Refs: https://github.com/squizlabs/PHP_CodeSniffer/releases/tag/3.7.1
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    3e9f284 View commit details
    Browse the repository at this point in the history
  15. Changelog: improve maintainability and source readability

    ... by moving links to link lists under each release.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    ac0b761 View commit details
    Browse the repository at this point in the history
  16. GH Actions: fix use of deprecated set-output

    GitHub has deprecated the use of `set-output` (and `set-state`) in favour of new environment files.
    
    This commit updates workflows to use the new methodology.
    
    Refs:
    * https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
    * https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    da74f92 View commit details
    Browse the repository at this point in the history
  17. GH Actions: update the xmllint-problem-matcher

    The `xmllint-problem-matcher` action runner has released a new version which updates it to use node 16.
    This gets rid of a warning which was shown in the action logs.
    
    Refs:
    * https://github.com/korelstar/xmllint-problem-matcher/releases/tag/v1.1
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    d901f9b View commit details
    Browse the repository at this point in the history
  18. GH Actions/basics: revert to xmllint-problem-matcher v1

    As the `korelstar/xmllint-problem-matcher` repo now has a long-running `v1` branch, this update which was included in PR 132 is no longer needed (and would necessitate more frequent updates if it would remain).
    
    Ref:
    * korelstar/xmllint-problem-matcher 7
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    9fb1b07 View commit details
    Browse the repository at this point in the history
  19. GH Actions: harden the workflow against PHPCS ruleset errors

    If there is a ruleset error, the `cs2pr` action doesn't receive an `xml` report and exits with a `0` error code, even though the PHPCS run failed (though not on CS errors, but on a ruleset error).
    
    This changes the GH Actions workflow to allow for that situation and still fail the build in that case.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    ed39208 View commit details
    Browse the repository at this point in the history
  20. Upgrade to PHPCSUtils 1.0.0-alpha4

    Take advantage of new features in PHPCSUtils 1.0.0-alpha4.
    
    Ref: https://github.com/PHPCSStandards/PHPCSUtils/releases/tag/1.0.0-alpha4
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    b1620ea View commit details
    Browse the repository at this point in the history
  21. ✨ New Universal.Files.SeparateFunctionsFromOO sniff

    This sniff will enforce that a file should either declare (global/namespaced) functions or declare OO structures, but not both.
    
    Nested function declarations, i.e. functions declared within a function/method will be disregarded for the purposes of this sniff.
    The same goes for anonymous classes, closures and arrow functions.
    
    Other notes:
    - This sniff has no opinion on side effects. If you want to sniff for those, use the PHPCS native `PSR1.Files.SideEffects` sniff.
    - This sniff has no opinion on multiple OO structures being declared in one file.
        If you want to sniff for that, use the PHPCS native `Generic.Files.OneObjectStructurePerFile` sniff.
    
    Includes unit tests.
    Includes documentation.
    Includes metrics.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    e20b0a6 View commit details
    Browse the repository at this point in the history
  22. NormalizedArrays/ArrayBraceSpacing: safeguard upstream bugfix

    The `SpacesFixer` in PHPCSUtils contains a bugfix for a specific situation which affected this sniff.
    
    This adds an extra unit test for the sniff to safeguard that bugfix.
    
    Ref: PHPCSStandards/PHPCSUtils 229
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    a7c61fc View commit details
    Browse the repository at this point in the history
  23. DisallowStandalonePostIncrementDecrement: prevent looking for nullsaf…

    …e object operator
    
    The PHPCSUtils `Collections::$objectOperators` property has been deprecated in favour of a `Collections::objectOperators()` method to allow for the PHP 8.0 `T_NULLSAFE_OBJECT_OPERATOR` token which may not be available.
    
    As the `T_NULLSAFE_OBJECT_OPERATOR` is not allowed in write-context and in/decrement is write-context, remove the token for this sniff.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    ec8166e View commit details
    Browse the repository at this point in the history
  24. ✨ New Universal.CodeAnalysis.ConstructorDestructorReturn sniff

    New sniff to verify that class constructor/destructors:
    * [error] Do not have a return type declaration. This would result in a fatal error in PHP.
    * [warning] Do not return a value via a return statement.
    
    Includes unit tests.
    Includes documentation.
    
    Inspired by:
    * https://wiki.php.net/rfc/make_ctor_ret_void
    * https://twitter.com/derickr/status/1280996420305276934
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    542d969 View commit details
    Browse the repository at this point in the history
  25. QA: remove some redundant/unused code

    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    8b5d591 View commit details
    Browse the repository at this point in the history
  26. CS: minor fixes

    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    28326cd View commit details
    Browse the repository at this point in the history
  27. Documentation: various minor fixes

    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    39bc8e4 View commit details
    Browse the repository at this point in the history
  28. DisallowInlineTabsUnitTest: skip on PHP 5.5

    For some weird and unknown reason, the tests for this sniff have started to fail intermittently in CI on PHP 5.5 (and only on PHP 5.5).
    * The tests pass on PHP 5.4 and PHP 5.6-8.2.
    * The tests regularly pass on PHP 5.5 after restarting the build (?!).
    * The tests pass locally on PHP 5.5 when running with the exact same PHP version and PHPUnit versions.
    
    In other words, this is one of those mystery bugs.
    
    For now, I'm just going to skip running these tests on PHP 5.5 as the build failures are blocking PRs for unrelated features.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    c81abd2 View commit details
    Browse the repository at this point in the history
  29. Universal/ConstructorDestructorReturn: add auto-fixer for return type

    The "returns a value" warning cannot be auto-fixed as it should be looked at by a developer. However, the "return type found" error _can_ be auto-fixed, so let's do so.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    d0dfd66 View commit details
    Browse the repository at this point in the history
  30. ✨ New Universal.Classes.ModifierKeywordOrder sniff

    Sniff to standardize the modifier keyword order for class declarations, what with the `readonly` keyword being introduced in PHP 8.2.
    
    The sniff contains a `public` `$order` property which allows for configuring the preferred order.
    Allowed values:
    * `'extendability readonly'` (= default)
    * `'readonly extendability'`
    
    Includes fixer.
    Includes unit tests.
    Includes documentation.
    Includes metrics.
    
    Ref: https://wiki.php.net/rfc/readonly_classes
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    00d0150 View commit details
    Browse the repository at this point in the history
  31. ✨ New Universal.Constants.ModifierKeywordOrder sniff

    Sniff to standardize the modifier keyword order for OO constant declarations.
    
    The sniff contains a `public` `$order` property which allows for configuring the preferred order.
    Allowed values:
    * `'final visibility'` (= default)
    * `'visibility final'`
    
    Includes fixer.
    Includes unit tests.
    Includes documentation.
    Includes metrics.
    
    Refs:
    * PHP 8.1: https://wiki.php.net/rfc/final_class_const
    * PHP 7.1: https://wiki.php.net/rfc/class_const_visibility
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    50383a9 View commit details
    Browse the repository at this point in the history
  32. NormalizedArrays/CommaAfterLast: improve fixer for flexible heredoc/n…

    …owdoc
    
    When comma's are enforced after the last entry of a (multi-line) array, the fixer would previously always add a new line between the heredoc/nowdoc closer and the comma to prevent parse errors in PHP < 7.3.
    
    However, the "closer" token for a flexible heredoc/nowdoc will include the indentation whitespace. This allows us to distinguish between "old-style" heredoc/nowdocs and PHP 7.3+ heredoc/nowdocs.
    
    This commit updates the fixer to check for this indentation whitespace and if found, will no longer add the new line.
    
    Includes tests in a separate file as these tests can only run on PHP 7.3+ (as the token stream of a file containing flexible heredoc/nowdocs in PHP < 7.3 will be garbage after the first heredoc/nowdoc).
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    7bdb46b View commit details
    Browse the repository at this point in the history
  33. QA: always declare metric names as class constants

    .. to reduce the risk of metrics not recording correctly due to typos in one of the instances recording the metrics.
    
    Note: the metrics in the "Disallow short/long list" sniffs will be addressed separately.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    ee9225d View commit details
    Browse the repository at this point in the history
  34. Universal/ConstructorDestructorReturn: improve return type fixer

    ... to prevent it from removing comments.
    
    Includes adjusting a pre-existing test to cover the change.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    334c8dc View commit details
    Browse the repository at this point in the history
  35. Universal/OneStatementInShortEchoTag: improve error code

    As the name of the sniff is `OneStatementInShortEchoTag`, "Found" would imply that one statement was found, while in actual fact the sniff throws an error when _multiple_ statements are found.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    bffb7c3 View commit details
    Browse the repository at this point in the history
  36. Universal/[Require/Disallow]FinalClass: rename metric

    What with PHP 8.2 introducing `readonly` classes, the metric name `Class declaration type` would become ambiguous as `readonly` is not taken into account for the metric (and doesn't need to be as it doesn't have a direct relationship to `abstract`/`final`).
    
    To prevent confusion about what the metric records, the metric name has been updated.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    253c637 View commit details
    Browse the repository at this point in the history
  37. Universal/[Require/Disallow]FinalClass: add tests with readonly classes

    ... to ensure the fixer continues to work correctly when the class is also `readonly`.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    545f531 View commit details
    Browse the repository at this point in the history
  38. Universal/DisallowUseClass: "docs" update for enums

    This updates the phrasing referencing the different OO structures to include enums in:
    * The error message.
    * The metric names.
    * Documentation.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    f14adb5 View commit details
    Browse the repository at this point in the history
  39. Universal/AlphabeticExtendsImplements: docs/test update for enums

    This commit adds tests confirming that `enum ... implements ...` statements are handled correctly by the sniff.
    
    Additionally, it updates the documentation to include `enum`s and makes a minor grammar fix to one of the metric names.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    58ec58a View commit details
    Browse the repository at this point in the history
  40. Universal/DisallowShortListSyntax: allow for tokenizer issue in PHPCS…

    … 3.7.1
    
    ... which was fixed in 3.7.2.
    
    The utility methods used from PHPCSUtils 1.0.0-alpha4 already take this into account, so this should be handled without problems.
    
    Includes test.
    
    Ref:
    * squizlabs/PHP_CodeSniffer 3632
    * PHPCSStandards/PHPCSUtils 392
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    ed4cfc6 View commit details
    Browse the repository at this point in the history
  41. Universal/DisallowShortListSyntax: bug fix - don't skip over nested b…

    …rackets
    
    ... as short arrays can contain short lists and those still need to be examined.
    
    Includes test to safeguard this.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    685996f View commit details
    Browse the repository at this point in the history
  42. Universal/DisallowShortArraySyntax: don't skip over short lists

    ... as for some unfanthomable reason (short) arrays can be used as keys for short lists and if so, those should still be found and fixed.
    
    Includes test to safeguard this.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    33f2e6e View commit details
    Browse the repository at this point in the history
  43. Universal/DisallowShortArraySyntax: record metrics

    It's quite straight forward to record informative metrics for this sniff, so let's.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    f1646d9 View commit details
    Browse the repository at this point in the history
  44. Universal/DisallowLongListSyntax: don't record metrics

    ... as recording just and only the `no` is not a useful metric and adding the logic to also record the `yes` would severely impact the performance of the sniff.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    2d06343 View commit details
    Browse the repository at this point in the history
  45. Universal/DisallowShortListSyntax: improve metric recording

    Record both the `yes` as well as the `no`, which makes the metric feature complete.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    731f000 View commit details
    Browse the repository at this point in the history
  46. GH Actions: bust the cache semi-regularly

    Caches used in GH Actions do not get updated, they can only be replaced by a different cache with a different cache key.
    
    Now the predefined Composer install action this repo is using already creates a pretty comprehensive cache key:
    
    > `ramsey/composer-install` will auto-generate a cache key which is composed of
    the following elements:
    > * The OS image name, like `ubuntu-latest`.
    > * The exact PHP version, like `8.1.11`.
    > * The options passed via `composer-options`.
    > * The dependency version setting as per `dependency-versions`.
    > * The working directory as per `working-directory`.
    > * A hash of the `composer.json` and/or `composer.lock` files.
    
    This means that aside from other factors, the cache will always be busted when changes are made to the (committed) `composer.json` or the `composer.lock` file (if the latter exists in the repo).
    
    For packages running on recent versions of PHP, it also means that the cache will automatically be busted once a month when a new PHP version comes out.
    
    ### The problem
    
    For runs on older PHP versions which don't receive updates anymore, the cache will not be busted via new PHP version releases, so effectively, the cache will only be busted when a change is made to the `composer.json`/`composer.lock` file - which may not happen that frequently on low-traffic repos.
    
    But... packages _in use_ on those older PHP versions - especially dependencies of declared dependencies - may still release new versions and those new versions will not exist in the cache and will need to be downloaded each time the action is run and over time the cache gets less and less relevant as more and more packages will need to be downloaded for each run.
    
    ### The solution
    
    To combat this issue, a new `custom-cache-suffix` option has been added to the Composer install action in version 2.2.0.
    This new option allows for providing some extra information to add to the cache key, which allows for busting the cache based on your own additional criteria.
    
    This commit implements the use of this `custom-cache-suffix` option for all relevant workflows in this repo.
    
    Refs:
    * https://github.com/ramsey/composer-install/#custom-cache-suffix
    * https://github.com/ramsey/composer-install/releases/tag/2.2.0
    
    Includes removing an accidental double install.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    d3b8a6e View commit details
    Browse the repository at this point in the history
  47. Universal/DisallowAlternativeSyntax: improve test code

    While empty "leafs" of control structures is allowed, it is less common, so make the code used for the tests more realistic.
    
    Includes improvements to the inline documentation in the test code file to make it clearer what is being tested.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    011eaae View commit details
    Browse the repository at this point in the history
  48. Universal/DisallowAlternativeSyntax: add additional tests with empty …

    …control structure bodies
    
    When a control structure condition is directly followed by a PHP close tag, a semicolon is silently inserted by PHP and the control structure will turn into a control structure without body.
    
    This commit adds additional tests to safeguard that the sniff handles this correctly.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    8288e14 View commit details
    Browse the repository at this point in the history
  49. Configuration menu
    Copy the full SHA
    8af66a6 View commit details
    Browse the repository at this point in the history
  50. Universal/DisallowAlternativeSyntax: improve metrics

    * Minor tweak to the metric name.
    * Also record metric for single line/no body control structures.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    0100cbe View commit details
    Browse the repository at this point in the history
  51. Universal/DisallowAlternativeSyntax: improve the error message [1]

    When the `$allowWithInlineHTML` property is set to `true`, the error message could be regarded as confusing and lead to (unfounded) bug reports as the error message doesn't indicate that alternative control structures, in that case, are still allowed in combination with inline HTML.
    
    This commit adjusts the error message based on the `$allowWithInlineHTML` property to be more descriptive.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    fb697d3 View commit details
    Browse the repository at this point in the history
  52. Universal/DisallowAlternativeSyntax: improve the error message [2]

    Improve the readability of the error message by moving the variable part to the end of the message.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    a161fc2 View commit details
    Browse the repository at this point in the history
  53. Universal/DisallowAlternativeSyntax: minor tweak

    Group the setting of the `$code` and `$data` variables for the error message with the conditions which may adjust their value.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    954294a View commit details
    Browse the repository at this point in the history
  54. Universal/DisallowAlternativeSyntax: bug fix - ignore inline HTML in …

    …nested closed scopes
    
    ... as the HTML in that case is not necessarily echo-ed out when the control structure is executed, but rather is executed when the function in the nested closed scope is called and executed, so the inline HTML does not "belong" with the control structure.
    
    This should also potentially improve performance of the sniff when large chunks of code without inline HTML are wrapped within a control structure.
    
    Includes tests.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    2c30b2c View commit details
    Browse the repository at this point in the history
  55. Universal/DisallowAlternativeSyntax: bug fix - handle if/elseif state…

    …ments in one go
    
    As things were, the sniff would examine - and potentially fix - each control structure keyword which could be used with alternative syntax individually.
    
    For potentially multi-part control structures, like `if` - `elseif` - `else`, this could lead to parse errors in the fixed code as mixing curly braces with alternative syntax within the same control structure "chain" is not allowed.
    
    This only comes into play when the `$allowWithInlineHTML` property has been set to `true` as that's the only time when an `if` would potentially be treated differently from the associated `else` (one containing inline HTML being left alone, the other not containing inline HTML being "fixed").
    
    While `try` - `catch` and `do` - `while` are also potentially multi-part control structures, these do not allow for using the alternative control structure syntax, so for the purposes of this sniff, `if` - `elseif` - `else` chains are the only ones we need to take into account.
    
    Also take note of the fact that `else if` (with a space between) is not allowed when using alternative syntax, so we don't need to take the keyword potentially being split into account.
    
    This commit adjusts the sniff to handle these chains in one go and to prevent the potential parse error, by:
    * No longer sniffing for `T_ELSEIF` or `T_ELSE` tokens.
        Note: this does affect how the metrics are recorded. Previously a metric would be recorded for each keyword. Now a metric will be recorded only for the _first_ keyword in a chain.
        This doesn't make a difference for non-chained control structures, but it does make a difference for chained `if/else` sets.
        Also note: the metric will only be recorded for control structure keywords which support alternative syntax, not for _all_ control structures. This remains the same as before.
    * When examining the control structure for inline HTML, the sniff will now loop from the first matching control structure keyword till the `end*` and remembering each control structure keyword (opener/closer) encountered along the way in case of a chain.
        For multi-part chains, once an inline HTML token has been encountered, subsequent "leafs" will no longer be examined for inline HTML. This should yield a small performance improvement.
    * The error messages will now be thrown via a loop based on the remembered information about each keyword encountered in a chain.
    * Along the same lines, the fixer will now make all fixes for a "chain" in one go based on the remembered information about each keyword encountered in the chain.
        This should also help prevent potential fixer conflicts between sniffs.
    
    Includes a range of additional unit tests for this issue.
    
    Also includes additional unit tests to safeguard that the behaviour of PHPCS regarding parse errors in chained control structures will not change, as the sniff has a build-in presumption about the PHPCS behaviour with control structures using alternative syntax, so if at any point in the future, the PHPCS token stream for this would change, the sniff will need adjusting.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    dc6c987 View commit details
    Browse the repository at this point in the history
  56. Universal/DisallowAnonClassParentheses: remove redundant condition

    ... and annotate why the condition has been removed, as well as annotating a second likely redundant condition.
    
    Includes a minor tweak to improve the descriptiveness of the "with parameter" metric.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    8c187c0 View commit details
    Browse the repository at this point in the history
  57. Configuration menu
    Copy the full SHA
    3eaadf4 View commit details
    Browse the repository at this point in the history
  58. Universal/DisallowFinalClass: minor code tweak

    When a class is declared as `abstract`, it would attempt to record both for the `abstract`, as well as the `not abstract, not final` metric.
    
    As a metric can only be recorded once per token, this didn't actually cause any issues, but it still made the code confusing. Fixed now.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    d718bae View commit details
    Browse the repository at this point in the history
  59. Configuration menu
    Copy the full SHA
    615b28b View commit details
    Browse the repository at this point in the history
  60. Universal/DisallowFinalClass: always record the metric

    As things were, the sniff would bow out if the opening brace for the class could not be found (yet) and would also not record the `final` metric in that case, even though for similar code using `abstract`, the metric _would_ be recorded.
    
    This commit ensures the `final` metric will now be recorded either way.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    c303f58 View commit details
    Browse the repository at this point in the history
  61. Universal/DisallowFinalClass: act on more cases

    As things were, the sniff would bow out if the opening brace for the class could not be found (yet).
    
    This commit changes the sniff to act in more cases, i.e. it does require for a (non-empty) token after the `class` keyword, but once that token is found, the sniff will act.
    
    Includes minor changes to how the message text is build up to prevent weird code snippets being show in the message.
    
    Includes additional test.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    407f592 View commit details
    Browse the repository at this point in the history
  62. Configuration menu
    Copy the full SHA
    f2e465b View commit details
    Browse the repository at this point in the history
  63. Universal/RequireFinalClass: always record the metric

    As things were, the sniff would bow out if the opening brace for the class could not be found (yet) and would also not record the `not abstract, not final` metric in that case, even though for similar code using `abstract` or `final`, the metric _would_ be recorded.
    
    This commit ensures the `not abstract, not final` metric will now be recorded either way.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    97d836c View commit details
    Browse the repository at this point in the history
  64. Universal/RequireFinalClass: act on more cases

    As things were, the sniff would bow out if the opening brace for the class could not be found (yet).
    
    This commit changes the sniff to act in more cases, i.e. it does require for a (non-empty) token after the `class` keyword, but once that token is found, the sniff will act.
    
    Includes minor changes to how the message text is build up to prevent weird code snippets being show in the message.
    
    Includes additional test.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    7635da1 View commit details
    Browse the repository at this point in the history
  65. Universal/OneStatementInShortEchoTag: prevent false positive

    In convoluted code, which I hope to never encounter in real life, it _could_ be possible to encounter a semi-colon, which is not the end of the statement, in the statement being executed for the `echo`.
    
    This commit hardens the sniff to improve the handling of these.
    
    Includes additional tests.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    d9f0cf1 View commit details
    Browse the repository at this point in the history
  66. Configuration menu
    Copy the full SHA
    50b4bde View commit details
    Browse the repository at this point in the history
  67. Universal/NoLeadingBackslash: examine imports within a group use stat…

    …ement
    
    Previously the sniff would only examine the start of a complete import statement, now it will also examine the partial imports within a group `use` statement.
    
    A partial import statement within a group use starting with a leading backslash is actually a parse error, which normally gets ignored by PHPCS, but this is a very specific one, which is also auto-fixable, so may as well report it.
    
    This new error for leading backslashes for partial import statements within a group use statement will be reported using a separate error code `LeadingBackslashFoundInGroup`.
    
    Includes updated and extra unit tests.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    56cf767 View commit details
    Browse the repository at this point in the history
  68. Universal/DisallowLonelyIf: add extra test

    .. to cover an edge case which is already handled correctly.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    4dca87c View commit details
    Browse the repository at this point in the history
  69. Universal/DisallowLonelyIf: bow out early for a specific situation (P…

    …HP close tag)
    
    If an inner "if/else" chain using alternative syntax has a PHP close tag after the `endif` instead of a semi-colon, we **know** there will need to be a PHP open tag before the closer for the "outer" `else` can be reached, so this means there will always be additional content within the outer `else` which doesn't belong with the inner `if`, i.e. it's not a lonely `if`.
    
    This commit implements bowing out early for that situation.
    
    Includes unit test.
    
    Includes minor tweaks to the inline documentation to make it clearer that the `do-while` code is part of the "Find the end of an if - else chain." block.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    6044232 View commit details
    Browse the repository at this point in the history
  70. Universal/SeparateFunctionsFromOO: update tests for enums

    As the sniff uses predefined token collections from PHPCSUtils, it automatically takes PHP 8.1 `enum`s into account since Utils-1.0.0-alpha4.
    
    This commit adjusts pre-existing tests and adds an extra test to safeguard this.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    a4c3e45 View commit details
    Browse the repository at this point in the history
  71. Universal/SeparateFunctionsFromOO: update tests for arrow functions

    As the sniff uses predefined token collections from PHPCSUtils, it automatically takes PHP 7.4 arrow functions into account since Utils-1.0.0-alpha4.
    
    This commit adjusts pre-existing tests to safeguard this.
    
    Includes minor test documentation updates.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    a73b66b View commit details
    Browse the repository at this point in the history
  72. Introduce new Modernize standard

    Includes updating CI and other dev related files to take the new standard into account.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    9e785bf View commit details
    Browse the repository at this point in the history
  73. ✨ New Modernize.FunctionCalls.Dirname sniff

    This new sniff will detect and, when possible, auto-fix two typical code modernizations which can be made related to the `dirname()` function:
    1. Since PHP 5.3, calls to `dirname(__FILE__)` can be replaced by `__DIR__`.
        Errorcode: `Modernize.FunctionCalls.Dirname.FileConstant`.
    2. Since PHP 7.0, nested function calls to `dirname()` can be changed to use the new `$levels` parameter.
        Errorcode: `Modernize.FunctionCalls.Dirname.Nested`.
    
    Depending on supported PHP versions of an application, the complete sniff can be enabled and/or just one of the error codes could be enabled.
    
    **Regarding the fixers:**
    
    The sniff - and more importantly, the fixer - take fully qualified function calls, named parameters, as well as trailing comma's in function calls into account.
    
    * If a comment is found in any of the code which would be removed by the fixer, the issues will still be flagged, but not be marked as fixable.
    * If the value of a pre-existing `$levels` parameter cannot be determined, the issues will still be flagged, but not be marked as fixable.
    
    Also take note that the fixer does not make any presumptions about the code style of the project. It is recommended to run the code style fixers together with or after this fixer, so those can adjust the code style to the style applicable in the project.
    
    Includes fixer.
    Includes unit tests.
    Includes documentation.
    
    Notes/Future scope:
    * The sniff is not yet compatible with PHPCS 4.x.
    * When PHPCSUtils releases its own abstract for sniffing function calls, this sniff should switch to it.
    
    Refs:
    * https://www.php.net/manual/en/function.dirname.php
    * PHP 5.3: https://php-legacy-docs.zend.com/manual/php5/en/migration53.global-constants
    * PHp 7.0: https://www.php.net/manual/en/migration70.changed-functions.php#migration70.changed-functions.core
        Note: the parameter was originally called `$depth`, but has since been renamed to `$levels`.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    4473589 View commit details
    Browse the repository at this point in the history
  74. Universal/NoReservedKeywordParameterNames: minor code simplification

    ... which can be made now support for PHPCS < 3.7.1 has been dropped.
    
    The sniff now only listens to tokens which are accepted by the `FunctionDeclarations::getParameters()` method, so checking for an exception should be unnecessary.
    
    Includes removing a stray `$paramNames` variable setting, which is never used.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    63d67fe View commit details
    Browse the repository at this point in the history
  75. Configuration menu
    Copy the full SHA
    df7e718 View commit details
    Browse the repository at this point in the history
  76. Universal/NoReservedKeywordParameterNames: add extra tests

    ... to safeguard bowing out for function declarations without parameters and that the sniff stays silent for unfinished function declarations.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    d9e60ce View commit details
    Browse the repository at this point in the history
  77. Universal/NoReservedKeywordParameterNames: make the check case-insens…

    …itive
    
    While parameters (variables) are case-sensitive in PHP, keywords are not.
    
    This commit improves the sniff to check for the keyword used in parameter names in a case-insensitive manner to make this sniff independent of code style rules regarding the case for parameter names.
    
    Includes additional tests.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    9dd2e18 View commit details
    Browse the repository at this point in the history
  78. Universal/NoReservedKeywordParameterNames: add tests with PHP 8.0 con…

    …structor property promotion
    
    ... to confirm that properties set via the constructor are also checked.
    
    Properties set via the constructor can be _passed_ to the constructor using named parameters, so this check should also apply to those properties.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    0627b70 View commit details
    Browse the repository at this point in the history
  79. Universal/DisallowUse[Class|Const|Function]: minor code coverage tweak

    Ignore a statement which should never be reachable (defense in depth code).
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    765e4b3 View commit details
    Browse the repository at this point in the history
  80. Universal/ForeachUniqueAssignment: fix some tests

    These tests weren't testing the sniff well enough.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    bd76b7c View commit details
    Browse the repository at this point in the history
  81. Universal/ForeachUniqueAssignment: improve analysis for foreach list …

    …assignments
    
    This commit:
    * Prevents "accidentally correct" handling of code like `foreach ($data as [$id => $id])`, where the first `$id` is not the key for the foreach assignment, so is not the concern of this sniff.
    * Improves analysis for key vs value when the value is a list assignment.
        Previously, the key and the value would just be compared as found. Now, each individual assignment in the list will be compared against the key.
        Notes: nested list assignment are not (yet) taken into account.
    
    Includes improved and additional tests.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    1559d36 View commit details
    Browse the repository at this point in the history
  82. Universal/DisallowStandalonePostIncrementDecrement: allow for stateme…

    …nt ending with close tag
    
    A stand-alone statement doesn't necessarily have to end with a semi-colon. It can also end on a PHP close tag.
    
    This commit adjusts the sniff to take this into account.
    
    Includes adjusting some pre-existing tests to safeguard the change.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    c9143c0 View commit details
    Browse the repository at this point in the history
  83. Universal/DuplicateArrayKey: add support for detecting duplicate key …

    …PHP cross-version
    
    How array keys for array items without keys are being determined, has changed in PHP 8.0.
    
    Previously, the key would be the highest previously seen numeric key + 1, providing the highest previously seen numeric key was 0 or higher. Otherwise, it would be 0.
    
    As of PHP 8.0, the key will be the highest previously seen numeric key + 1, independently of whether the previously seen numeric key was negative.
    
    The sniff will now calculate and track the keys for unkeyed array items using both the PHP < 8.0 logic as well as the PHP >= 8.0 logic.
    
    If a duplicate key would yield the same error in both PHP < 8.0 as well as PHP >= 8.0, the `Found` error code will be used.
    If a duplicate key would only be a duplicate on PHP < 8.0, the `FoundForPHPlt80` error code will be used and the error message will indicate the error only applies to PHP < 8.0.
    If a duplicate key would only be a duplicate on PHP > 8.0, the `FoundForPHPgte80` and the error message will indicate the error only applies to PHP >= 8.0.
    
    If the end-user has set the `php_version` configuration option, the sniff will respect that and only report duplicate keys for the PHP version indicated.
    
    Includes additional unit tests.
    
    P.S.: the code could possible be made smarter, but for now, this is fine as the goal of accounting for this change in PHP has been achieved.
    
    Refs:
    * https://3v4l.org/liBXD
    * https://wiki.php.net/rfc/negative_array_index
    * https://github.com/squizlabs/PHP_CodeSniffer/wiki/Configuration-Options#setting-the-php-version
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    3342beb View commit details
    Browse the repository at this point in the history
  84. Universal/DuplicateArrayKey: code simplification

    No functional changes.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    012f9fe View commit details
    Browse the repository at this point in the history
  85. CS/QA: various minor code tweaks

    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    d830ed3 View commit details
    Browse the repository at this point in the history
  86. Docs: normalize @since tags

    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    4bd1a76 View commit details
    Browse the repository at this point in the history
  87. Configuration menu
    Copy the full SHA
    c44b775 View commit details
    Browse the repository at this point in the history
  88. Universal/PrecisionAlignment: update comment

    ... now upstream PR 3639 has been merged.
    
    Ref:
    * squizlabs/PHP_CodeSniffer 3639
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    7d2f692 View commit details
    Browse the repository at this point in the history
  89. Docs: improve a few inline comments

    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    082a661 View commit details
    Browse the repository at this point in the history
  90. Universal/StaticInFinalClass: handle static when used in arrow func…

    …tion
    
    ... as long as the arrow function is within an OO construct which can be `final`.
    
    Includes tests.
    Includes enhancing the closure test a little as well.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    f6595e4 View commit details
    Browse the repository at this point in the history
  91. Composer: add PHPCSDevCS to the dependencies

    PHPCSDevCS was previously not added to the `require-dev` dependencies as the minimum supported PHPCS version conflicted with the minimum supported PHPCS version of this package.
    
    Now this is no longer the case, the package can be safely added to `require-dev` and work-arounds can be removed.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    45f09c9 View commit details
    Browse the repository at this point in the history
  92. Configuration menu
    Copy the full SHA
    c1081b3 View commit details
    Browse the repository at this point in the history
  93. GH Actions/test: remove unused steps related to PHPCS 4.x

    These steps/directives all relate to testing against PHPCS 4.x, but this package is not being tested against PHPCS 4.x at this time and when this will be enabled again, these work-arounds may well no longer be needed anymore anyway, so let's remove it for now and re-evaluate what is needed when testing against PHPCS 4.x is re-enabled.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    bb3597a View commit details
    Browse the repository at this point in the history
  94. GH Actions: no longer allow builds to fail against PHP 8.2

    * Update the PHP version on which the CS run for this package is run to PHP `latest`.
    * Remove the `continue-on-error` for PHP 8.2 in the `test` workflow (and remove the `experimental` key, which is now no longer used.
    * Update the "Tested against" badge in the README.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    6d828cb View commit details
    Browse the repository at this point in the history
  95. Configuration menu
    Copy the full SHA
    2584ccf View commit details
    Browse the repository at this point in the history
  96. README: update badges

    * Update links to workflows.
    * Use re-usable links for links which are used repeatedly.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    25efbd5 View commit details
    Browse the repository at this point in the history
  97. README: add updating instructions

    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    4f603c9 View commit details
    Browse the repository at this point in the history
  98. README: misc updates

    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    6f8e8c2 View commit details
    Browse the repository at this point in the history
  99. Changelog: add missing link

    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    c6c4cfe View commit details
    Browse the repository at this point in the history
  100. GH Actions/basics: move composer validate up

    ... to be before the adjustments made to the composer.json file.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    b38a526 View commit details
    Browse the repository at this point in the history
  101. GH Actions: add new check with additional QA for markdown files

    _Based on a similar workflow previously added to PHPCSUtils._
    
    Remark offers a number of "rules" which are useful, such as checking that links and link definitions match up, verifying all used links work and some formatting checks.
    
    The rule configuration is contained in the .remarkrc file.
    
    Files/directories to be ignored can be listed in the .remarkignore file which supports glob syntax, like .gitignore.
    Note: .-prefixed files and directories are excluded by default. To include those in the scan, they have to be passed explicitly on the command-line.
    
    To run locally, follow the same steps as per the GitHub actions workflow.
    
    Note: the workflow contains a double-run of remark-lint to allow viewing the results both in a human readable way in the actions transscripts, as well as getting annotations for found issue in PRs.
    
    Refs:
    * https://github.com/remarkjs/remark/tree/main/packages/remark-cli
    * https://github.com/remarkjs/remark-lint
    * https://github.com/remarkjs/remark-gfm
    * https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-consistent
    * https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-recommended
    * https://github.com/remarkjs/remark-lint/tree/main/packages/remark-preset-lint-markdown-style-guide
    
    Additional (external) plugins included:
    * https://github.com/vhf/remark-lint-heading-whitespace
    * https://github.com/wemake-services/remark-lint-list-item-punctuation
    * https://github.com/laysent/remark-lint-plugins/tree/HEAD/packages/remark-lint-match-punctuation
    * https://github.com/olizilla/remark-lint-no-hr-after-heading
    * https://github.com/wemake-services/remark-lint-are-links-valid
    * https://github.com/remarkjs/remark-validate-links
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    88a5985 View commit details
    Browse the repository at this point in the history
  102. GH Actions: add Yamllint to QA basics

    ... to loosely safeguard valid and consistent yaml files.
    
    Includes adding a configuration file which loosens up the default ruleset to a degree I'm comfortable with.
    
    Ref: https://yamllint.readthedocs.io/
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    bb8c884 View commit details
    Browse the repository at this point in the history
  103. Modernize/Dirname: magic constants are case-insensitive

    Includes a few updated unit tests to safeguard the fix.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    86293d0 View commit details
    Browse the repository at this point in the history
  104. GH Actions: minor simplification

    ... of the bash `date` command in the earlier pulled cache busting.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    12ef67f View commit details
    Browse the repository at this point in the history
  105. GH Actions: update PHP versions in workflows

    PHP 8.2 has been released today 🎉 and the `setup-php` action has announced support for PHP 8.3, so adding PHP 8.3 to the matrix and no longer allowing PHP 8.2 to fail the build.
    
    Note: PHPCS does not (yet) have full syntax support for PHP 8.2, but it does have runtime support (for the most part, see squizlabs/PHP_CodeSniffer 3629).
    
    Builds against PHP 8.3 are still allowed to fail for now.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    050ae07 View commit details
    Browse the repository at this point in the history
  106. .gitattributes: update export-ignores

    Follow up on 186 which added some new configuration files, but didn't export ignore them.
    
    Includes aligning the values for better readability.
    jrfnl authored and dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    d6ca9a0 View commit details
    Browse the repository at this point in the history
  107. Configuration menu
    Copy the full SHA
    9dc1bc5 View commit details
    Browse the repository at this point in the history
  108. Remove renamed files

    dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    1f8e6bb View commit details
    Browse the repository at this point in the history
  109. Rewrite the sniff according to the PR suggestions

    To do: add fixers and metric
    dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    b89ae7e View commit details
    Browse the repository at this point in the history
  110. Update docs for the sniff

    Will probably need some fixup.
    dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    a689164 View commit details
    Browse the repository at this point in the history
  111. Update test file

    dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    1ddfaa6 View commit details
    Browse the repository at this point in the history
  112. Configuration menu
    Copy the full SHA
    fc79476 View commit details
    Browse the repository at this point in the history
  113. Configuration menu
    Copy the full SHA
    71b2116 View commit details
    Browse the repository at this point in the history
  114. Remove fixer comments

    dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    8562dce View commit details
    Browse the repository at this point in the history
  115. Configuration menu
    Copy the full SHA
    fd64ff1 View commit details
    Browse the repository at this point in the history
  116. Merge remote-tracking branch 'origin/declare-statements-curly-bracket…

    …s' into declare-statements-curly-brackets
    dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    b5e85cb View commit details
    Browse the repository at this point in the history
  117. Replace tabs with spaces

    dingo-d committed May 28, 2023
    Configuration menu
    Copy the full SHA
    2d759b3 View commit details
    Browse the repository at this point in the history