PHP code example of nexusphp / cs-config

1. Go to this page and download the library: Download nexusphp/cs-config 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/ */

    

nexusphp / cs-config example snippets




use Nexus\CsConfig\Factory;
use Nexus\CsConfig\Ruleset\Nexus82;

return Factory::create(new Nexus82())->forProjects();




/**
 * This file is part of My Library.
 *
 * (c) 2020 John Doe <[email protected]>
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */

namespace Nexus\CsConfig;



/**
 * This file is part of My Library.
 *
 * (c) John Doe
 *
 * For the full copyright and license information, please view
 * the LICENSE file that was distributed with this source code.
 */

namespace Nexus\CsConfig;



namespace MyCompany\CodingStandards\Ruleset;

use Nexus\CsConfig\Ruleset\AbstractRuleset;

final class MyCompany extends AbstractRuleset
{
  public function __construct()
  {
    $this->name = 'My Company';
    $this->rules = [
      '@PSR2' => true,
      ...
    ];
    $this->



use Nexus\CsConfig\Factory;
use MyCompany\CodingStandards\Ruleset\MyCompany;

return Factory::create(new MyCompany())->forProjects();

diff
 vendor/

+# php-cs-fixer
+.php-cs-fixer.php
+.php-cs-fixer.cache
diff
 

 use Nexus\CsConfig\Factory;
 use Nexus\CsConfig\Ruleset\Nexus82;

-return Factory::create(new Nexus82())->forProjects();
+return Factory::create(new Nexus82(), [
+    'binary_operator_spaces' => false,
+])->forProjects();

diff
 

 use Nexus\CsConfig\Factory;
 use Nexus\CsConfig\Ruleset\Nexus82;

-return Factory::create(new Nexus82())->forProjects();
+return Factory::create(new Nexus82(), [], [
+    'usingCache'  => false,
+    'hideProgress => true,
+])->forProjects();