PHP code example of erickskrauch / php-cs-fixer-custom-fixers

1. Go to this page and download the library: Download erickskrauch/php-cs-fixer-custom-fixers library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

erickskrauch / php-cs-fixer-custom-fixers example snippets



return (new \PhpCsFixer\Config())
    ->registerCustomFixers(new \ErickSkrauch\PhpCsFixer\Fixers())
    ->setRules([
        'ErickSkrauch/align_multiline_parameters' => true,
        // See the rest of the fixers below
    ]);
diff
--- Original
+++ New
@@ @@
  function foo(
      string $string,
-     int $index = 0,
-     $arg = 'no type',
-     ...$variadic,
+     int    $index    = 0,
+            $arg      = 'no type',
+         ...$variadic
  ): void {}
diff
--- Original
+++ New
@@ @@
 
 public function foo() {
     $a = 'this';
     $b = 'is';
+
     return "$a $b awesome";
 }

 public function bar() {
     $this->foo();
     return 'okay';
 }
diff
--- Original
+++ New
@@ @@
 
 $a = 123;
 if ($a === 123) {
     // Do something here
 }
+
 $b = [1, 2, 3];
 foreach ($b as $number) {
     if ($number === 3) {
         echo 'it is three!';
     }
 }
+
 $c = 'next statement';
diff
--- Original
+++ New
@@ @@
 
 if ($condition1 === 123
- && $condition2 = 321) {
+ && $condition2 = 321
+) {
     // Do something here
 }
diff
--- Original
+++ New
@@ @@
 
 class Foo implements Serializable {

-    public function unserialize($data) {}
+    public function serialize() {}

-    public function serialize() {}
+    public function unserialize($data) {}

 }