vendor/bin/phpcs -n --standard=vendor/stefna/codestyle/library.xml src/The MIT License (MIT). Please see License File for more information.
Now enforces that <?php declare(strict_types=1);
becomes the first line in the file.
Add support for empty methods on a single line. Example:
class Example
{
public function empty(): void {};
}Enforce multi row parameters to not be on the first row. Example:
class Example
{
public function test(
#[Attribute]
int $param,
)
}Allows some doc blocks to work as single line:
- @var
- @phpstan-var
- @type
- @lang
- @noinspection
- @use
- @deprecated
- @phpstan-ignore-next-line
/** @var string $var */@return doesn't need any description/data:
/**
* @return
*/Adding an exception to allow multiline if-statments to be indented less, if started on the same line as the opening parenthesis.
Example:
if (isset(
$a['key'],
$a['key']['subKey'],
)) {
}Allow a the custom case of everything being upper case.
class Example
{
public function METHOD(): void {}
}Two rules are enfored by this.
First, a control statement has to be on it's own line. Example:
if (false) {
doSomething();
}
else {
doSomethingElse();
}Second, foces the closing bracket to be on it's own line except if it's on a single line with an empty body. Example:
if (false) {}Enforces that inside a function, the first line after the opening { can't be empty
Example:
function test(): void
{
$var = 'This has to be the first line';
}It also enforces that the spacing between rows can be 0 or 1 blank line. Example:
function test(): void
{
$var = 0;
$var += 1;
$var *= 2;
}Now warns about closures to be static if they don't have $this in body
Example:
$closure = static function () {
something();
};
$fn = static fn () => something();