Skip to content

Releases: graze/standards

v3.0.0 — PHP_CodeSniffer 4 support (BC break)

Choose a tag to compare

@rick-lam rick-lam released this 28 May 10:14
df8a5d9

Breaking changes

  • Requires squizlabs/php_codesniffer: ^4.0. Drops PHPCS 3 support entirely. Consumers must upgrade both squizlabs/php_codesniffer to ^4.0 and graze/standards to ^3.0 together.

What's changed

  • Ruleset migrated to PHPCS 4: Generic.WhiteSpace.ScopeIndent's ignoreIndentationTokens now uses <element value="..."/> nodes (legacy comma-separated form removed), and Generic.Functions.CallTimePassByReference is dropped (sniff removed in PHPCS 4; modern PHP enforces this at the language level).
  • All sniffs updated to PHPCS 4's tightened Sniff interface (register(): array return type).
  • CI migrated from Travis to GitHub Actions, with a PHP 7.2–8.5 matrix plus markdown lint and gh-pages mkdocs deploy on main.

See #53 for full details.

Fix AbstractClassNaming sniff error message

Choose a tag to compare

@biggianteye biggianteye released this 18 Aug 15:46
eac7737

Previously the error message for the Graze.Naming.AbstractClassNaming sniff showed a placeholder rather than the class name, like this:

Abstract class name "%s" must be prefixed with "Abstract"

It now correctly shows the class name, like this:

Abstract class name "Foo" must be prefixed with "Abstract"

Correct sniff names in output

Choose a tag to compare

@biggianteye biggianteye released this 06 Aug 14:22
fb6c746

This version ensures that when you run phpcs with the -s flag, the custom sniffs included will produce a message that actually matches the sniff name.

Previously you would see this:

------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
 13 | ERROR | Space found after logical NOT operator
    |       | (graze.controlStructures.NegationNoSpaces)
------------------------------------------------------------------------------------------------

That's not the name of the sniff and so if you try to do anything with that (eg. adding it to a ruleset) phpcs will complain that the sniff does not exist.

Now you will correctly see this instead:

------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
------------------------------------------------------------------------------------------------
 13 | ERROR | Space found after logical NOT operator
    |       | (Graze.ControlStructures.NegationNoSpaces)
------------------------------------------------------------------------------------------------

Negation and whitespace

Choose a tag to compare

@biggianteye biggianteye released this 04 Jul 13:26
a90e559

Adds a new sniff (Graze\Sniffs\ControlStructures\NegationNoSpacesSniff) to check for the following rule:

'Not' logical operators MUST NOT have whitespace between them and the subject being negated.

This means that the following will now produce an error:

$foo = ! $bar;

This can be fixed by removing the whitespace:

$foo = !$bar;

Fix for abstract name checking

Choose a tag to compare

@biggianteye biggianteye released this 20 Sep 09:16
0770959

The following class definition no longer causes the abstract name checking sniff to crash:

<?php
class Foo
{
}

Minor php cs fix

Choose a tag to compare

@h-bragg h-bragg released this 06 Nov 11:47
0381502

Fix for checking for doc comments with child functions:

this should be valid:

function first()
{
    /**
     * @return string
     */
    function second()
    {
        return '2';
    }

    second();
}

phpcs -> v3

Choose a tag to compare

@h-bragg h-bragg released this 23 Aug 09:33

This updates phpcs to version 3.0.2. And requires a major version bump as a result.

Initial public release

Choose a tag to compare

@john-n-smith john-n-smith released this 16 Feb 12:08
v1.0.0

Add LICENSE file