symplify/coding-standard
Symplify Coding Standard provides 23 fixer rules for clean, consistent PHP code, covering array formatting, line length, and strict types. It works best with Easy Coding Standard but is deprecated in favor of using ECS directly.
The monolithic ParamReturnAndVarTagMalformsFixer (and its internal "malform worker" system) has been split into focused, single-responsibility fixers, registered together in the new docblock set. Each one fixes exactly one kind of [@param](https://github.com/param) / [@return](https://github.com/return) / [@var](https://github.com/var) malform, and all of them handle the [@phpstan-](https://github.com/phpstan-) and [@psalm-](https://github.com/psalm-) prefixed variants too.
AddMissingParamNameFixer — add a missing variable name to a [@param](https://github.com/param)
/**
- * [@param](https://github.com/param) string
+ * [@param](https://github.com/param) string $name
*/
function getPerson($name)
{
}
AddMissingVarNameFixer — add a missing variable name to an inline [@var](https://github.com/var)
-/** [@var](https://github.com/var) int */
+/** [@var](https://github.com/var) int $value */
$value = 1000;
DoubleAsteriskInlineVarFixer (new capability) — use a double-asterisk /** doc block for an inline [@var](https://github.com/var)
-/* [@var](https://github.com/var) int $variable */
+/** [@var](https://github.com/var) int $variable */
$variable = 5;
FixParamNameTypoFixer — fix a typo in the [@param](https://github.com/param) variable name to match the real argument
/**
* [@param](https://github.com/param) string $one
- * [@param](https://github.com/param) string $twoTypo
+ * [@param](https://github.com/param) string $two
*/
function anotherFunction(string $one, string $two)
{
}
RemoveDeadParamFixer — remove a dead [@param](https://github.com/param) line that has only a name and no type
/**
* [@param](https://github.com/param) string $name
- * [@param](https://github.com/param) $age
*/
function withDeadParam(string $name, $age)
{
}
RemoveParamNameReferenceFixer — remove the reference & from a [@param](https://github.com/param) variable name
/**
- * [@param](https://github.com/param) string &$name
+ * [@param](https://github.com/param) string $name
*/
function paramReference($name)
{
}
RemoveSuperfluousReturnNameFixer — remove a superfluous variable name from a [@return](https://github.com/return)
/**
- * [@return](https://github.com/return) int $value
+ * [@return](https://github.com/return) int
*/
function function1(): int
{
}
RemoveSuperfluousVarNameFixer — remove a superfluous variable name from a property [@var](https://github.com/var)
/**
- * [@var](https://github.com/var) string $property
+ * [@var](https://github.com/var) string
*/
private $property;
SingleLineInlineVarDocBlockFixer — collapse a multi-line inline [@var](https://github.com/var) doc block into a single line
-/**
- * [@var](https://github.com/var) int $value
- */
+/** [@var](https://github.com/var) int $value */
$value = 1000;
SwitchedTypeAndNameFixer — reorder switched type and variable name in [@param](https://github.com/param) / [@var](https://github.com/var)
/**
- * [@param](https://github.com/param) $a string
- * [@param](https://github.com/param) $b string|null
+ * [@param](https://github.com/param) string $a
+ * [@param](https://github.com/param) string|null $b
*/
function test($a, string $b = null): string
{
}
AbstractDocBlockFixer base class shared by the new fixers.MalformWorkerInterface and the MalformWorker/ implementations (DeadParamMalformWorker, InlineVarMalformWorker, ParamNameReferenceMalformWorker).Full changelog: https://github.com/symplify/coding-standard/pull/86
Full Changelog: https://github.com/symplify/coding-standard/compare/12.4.2...12.4.3
How can I help you explore Laravel packages today?