graze/standards
Graze Coding Standards: a cross-language style guide for the Graze tech team. Covers general formatting rules, Git conventions, and standards for PHP, HTML, JavaScript, Python, SQL, CSS/Less, Markdown, and Go, plus open source and environment guidance.
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.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).Sniff interface (register(): array return type).gh-pages mkdocs deploy on main.See #53 for full details.
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"
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)
------------------------------------------------------------------------------------------------
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;
The following class definition no longer causes the abstract name checking sniff to crash:
<?php
class Foo
{
}
Fix for checking for doc comments with child functions:
this should be valid:
function first()
{
/**
* [@return](https://github.com/return) string
*/
function second()
{
return '2';
}
second();
}
This updates phpcs to version 3.0.2. And requires a major version bump as a result.
How can I help you explore Laravel packages today?