GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - symplify/coding-standard: [Deprecated] Use ECS that includes this set with more new rules

This repository was archived by the owner on Jul 12, 2026. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

1,009 Commits
1,009 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
config
config
 
 
src
src
 
 
tests
tests
 
 
.editorconfig
.editorconfig
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
composer.json
composer.json
 
 
ecs.php
ecs.php
 
 
phpstan.neon
phpstan.neon
 
 
phpunit.xml
phpunit.xml
 
 
rector.php
rector.php
 
 

Repository files navigation

Coding Standard

Downloads

Warning

This package is deprecated. Use Easy Coding Standard (ECS) instead, where these rules and coding standard work out of the box—no extra setup needed.

Coding standard rules for clean, consistent, and readable PHP code. No configuration needed—just install and let it handle the rest.

They run best with ECS.


Install

composer require symplify/coding-standard symplify/easy-coding-standard --dev
  1. Register in ecs.php config:
 # ecs.php
 use Symplify\EasyCodingStandard\Config\ECSConfig;

 return ECSConfig::configure()
    ->withPreparedSets(symplify: true);
  1. And run:
# dry-run without changes
vendor/bin/ecs


# apply changes
vendor/bin/ecs --fix

23 Rules to Keep Your Code Clean

ArrayListItemNewlineFixer

Indexed PHP array item has to have one line per item

  • class: Symplify\CodingStandard\Fixer\ArrayNotation\ArrayListItemNewlineFixer
-$value = ['simple' => 1, 'easy' => 2];
+$value = ['simple' => 1,
+'easy' => 2];

ArrayOpenerAndCloserNewlineFixer

Indexed PHP array opener [ and closer ] must be on own line

  • class: Symplify\CodingStandard\Fixer\ArrayNotation\ArrayOpenerAndCloserNewlineFixer
-$items = [1 => 'Hey'];
+$items = [
+1 => 'Hey'
+];

BlankLineAfterStrictTypesFixer

Strict type declaration has to be followed by empty line

  • class: Symplify\CodingStandard\Fixer\Strict\BlankLineAfterStrictTypesFixer
 declare(strict_types=1);
+
 namespace App;

LineLengthFixer

Array items, method parameters, method call arguments, new arguments should be on same/standalone line to fit line length.

🔧 configure it!

  • class: Symplify\CodingStandard\Fixer\LineLength\LineLengthFixer
-function some($veryLong, $superLong, $oneMoreTime)
-{
+function some(
+    $veryLong,
+    $superLong,
+    $oneMoreTime
+) {
 }

-function another(
-    $short,
-    $now
-) {
+function another($short, $now) {
 }

MethodChainingNewlineFixer

Each chain method call must be on own line

  • class: Symplify\CodingStandard\Fixer\Spacing\MethodChainingNewlineFixer
-$someClass->firstCall()->secondCall();
+$someClass->firstCall()
+->secondCall();

Doc block malform rules

Single-task rules that each fix one kind of @param/@return/@var malform. They are registered together in the docblock set and all handle the @phpstan- and @psalm- prefixed variants of these tags.


AddMissingParamNameFixer

Add a missing variable name to a @param annotation

  • class: Symplify\CodingStandard\Fixer\Commenting\AddMissingParamNameFixer
 /**
- * @param string
+ * @param string $name
  */
 function getPerson($name)
 {
 }

AddMissingVarNameFixer

Add a missing variable name to an inline @var annotation

  • class: Symplify\CodingStandard\Fixer\Commenting\AddMissingVarNameFixer
-/** @var int */
+/** @var int $value */
 $value = 1000;

DoubleAsteriskInlineVarFixer

Use a double asterisk /** doc block for an inline @var comment

  • class: Symplify\CodingStandard\Fixer\Commenting\DoubleAsteriskInlineVarFixer
-/* @var int $variable */
+/** @var int $variable */
 $variable = 5;

FixParamNameTypoFixer

Fix a typo in the @param variable name to match the real argument

  • class: Symplify\CodingStandard\Fixer\Commenting\FixParamNameTypoFixer
 /**
  * @param string $one
- * @param string $twoTypo
+ * @param string $two
  */
 function anotherFunction(string $one, string $two)
 {
 }

RemoveDeadParamFixer

Remove a dead @param line that has only a name and no type

  • class: Symplify\CodingStandard\Fixer\Commenting\RemoveDeadParamFixer
 /**
  * @param string $name
- * @param $age
  */
 function withDeadParam(string $name, $age)
 {
 }

RemoveParamNameReferenceFixer

Remove the reference & from a @param variable name

  • class: Symplify\CodingStandard\Fixer\Commenting\RemoveParamNameReferenceFixer
 /**
- * @param string &$name
+ * @param string $name
  */
 function paramReference($name)
 {
 }

RemoveSuperfluousReturnNameFixer

Remove a superfluous variable name from a @return annotation

  • class: Symplify\CodingStandard\Fixer\Commenting\RemoveSuperfluousReturnNameFixer
 /**
- * @return int $value
+ * @return int
  */
 function function1(): int
 {
 }

RemoveSuperfluousVarNameFixer

Remove a superfluous variable name from a property @var annotation

  • class: Symplify\CodingStandard\Fixer\Commenting\RemoveSuperfluousVarNameFixer
 /**
- * @var string $property
+ * @var string
  */
 private $property;

SingleLineInlineVarDocBlockFixer

Collapse a multi-line inline @var doc block into a single line

  • class: Symplify\CodingStandard\Fixer\Commenting\SingleLineInlineVarDocBlockFixer
-/**
- * @var int $value
- */
+/** @var int $value */
 $value = 1000;

SwitchedTypeAndNameFixer

Reorder switched type and variable name in @param/@var annotation

  • class: Symplify\CodingStandard\Fixer\Commenting\SwitchedTypeAndNameFixer
 /**
- * @param $a string
- * @param $b string|null
+ * @param string $a
+ * @param string|null $b
  */
 function test($a, string $b = null): string
 {
 }

RemovePropertyVariableNameDescriptionFixer

Remove docblock descriptions which duplicate their property name

  • class: Symplify\CodingStandard\Fixer\Annotation\RemovePropertyVariableNameDescriptionFixer
 /**
- * @var string $name
+ * @var string
  */
 private $name;

RemoveMethodNameDuplicateDescriptionFixer

Remove docblock descriptions which duplicate their method name

  • class: Symplify\CodingStandard\Fixer\Annotation\RemoveMethodNameDuplicateDescriptionFixer
 /**
- * Get name
  *
  * @return string
  */
 function getName()
 {
 }

RemovePHPStormAnnotationFixer

Remove "Created by PhpStorm" annotations

  • class: Symplify\CodingStandard\Fixer\Annotation\RemovePHPStormAnnotationFixer
-/**
- * Created by PhpStorm.
- * User: ...
- * Date: 17/10/17
- * Time: 8:50 AM
- */
 class SomeClass
 {
 }

RemoveUselessDefaultCommentFixer

Remove useless PHPStorm-generated @todo comments, redundant "Class XY" or "gets service" comments etc.

  • class: Symplify\CodingStandard\Fixer\Commenting\RemoveUselessDefaultCommentFixer
-/**
- * class SomeClass
- */
 class SomeClass
 {
-    /**
-     * SomeClass Constructor.
-     */
     public function __construct()
     {
-        // TODO: Change the autogenerated stub
-        // TODO: Implement whatever() method.
     }
 }

It also removes "Class representing XY" comments:

-/**
- * Class representing TeamPlayer
- */
 class TeamPlayer
 {
 }

Comments that only repeat the class name are removed:

-/**
- * TeamPlayer
- */
 class TeamPlayer
 {
 }

As well as the default doc block generated by the Doctrine ORM:

-/**
- * This class was generated by the Doctrine ORM. Add your own custom
- * repository methods below.
- */
 class SomeRepository
 {
 }

SpaceAfterCommaHereNowDocFixer

Add space after nowdoc and heredoc keyword, to prevent bugs on PHP 7.2 and lower, see https://laravel-news.com/flexible-heredoc-and-nowdoc-coming-to-php-7-3

  • class: Symplify\CodingStandard\Fixer\Spacing\SpaceAfterCommaHereNowDocFixer
 $values = [
     <<<RECTIFY
 Some content
-RECTIFY,
+RECTIFY
+,
     1000
 ];

StandaloneLineConstructorParamFixer

Constructor param should be on a standalone line to ease git diffs on new dependency

  • class: Symplify\CodingStandard\Fixer\Spacing\StandaloneLineConstructorParamFixer
 final class PromotedProperties
 {
-    public function __construct(int $age, string $name)
-    {
+    public function __construct(
+        int $age,
+        string $name
+    ) {
     }
 }

StandaloneLineInMultilineArrayFixer

Indexed arrays must have 1 item per line

  • class: Symplify\CodingStandard\Fixer\ArrayNotation\StandaloneLineInMultilineArrayFixer
-$friends = [1 => 'Peter', 2 => 'Paul'];
+$friends = [
+    1 => 'Peter',
+    2 => 'Paul'
+];

StandaloneLinePromotedPropertyFixer

Promoted property should be on standalone line

  • class: Symplify\CodingStandard\Fixer\Spacing\StandaloneLinePromotedPropertyFixer
 final class PromotedProperties
 {
-    public function __construct(public int $age, private string $name)
-    {
+    public function __construct(
+        public int $age,
+        private string $name
+    ) {
     }
 }

About

[Deprecated] Use ECS that includes this set with more new rules

github.com/ecsphp/ecs

Topics

coding-standardcoding-styleecsphp

Resources

Readme
MIT license
Activity
Custom properties

Stars

377 stars

Watchers

9 watching

Forks

24 forks
Report repository

Releases

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.