PHP code example of symplify / coding-standard

1. Go to this page and download the library: Download symplify/coding-standard 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/ */

    

symplify / coding-standard example snippets


 # ecs.php
 use Symplify\EasyCodingStandard\Config\ECSConfig;

 return ECSConfig::configure()
    ->withPreparedSets(symplify: true);
diff
-$items = [1 => 'Hey'];
+$items = [
+1 => 'Hey'
+];
diff
 /**
- * @param string
+ * @param string $name
  */
 function getPerson($name)
 {
 }
diff
-/** @var int */
+/** @var int $value */
 $value = 1000;
diff
 /**
  * @param string $name
- * @param $age
  */
 function withDeadParam(string $name, $age)
 {
 }
diff
 /**
- * @param string &$name
+ * @param string $name
  */
 function paramReference($name)
 {
 }
diff
-/**
- * @var int $value
- */
+/** @var int $value */
 $value = 1000;
diff
 /**
- * @param $a string
- * @param $b string|null
+ * @param string $a
+ * @param string|null $b
  */
 function test($a, string $b = null): string
 {
 }