PHP code example of netlogix / coding-guidelines-php

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

    

netlogix / coding-guidelines-php example snippets




declare(strict_types=1);

use Netlogix\CodingGuidelines\Php\DefaultPhp;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $ecsConfig): void {
    (new DefaultPhp())->configure($ecsConfig);

    $ecsConfig->paths(
        [
            __DIR__ . '/src',
        ]
    );
};



declare(strict_types=1);

use Netlogix\CodingGuidelines\Php\Neos\Flow\DefaultFlow;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $ecsConfig): void {
    (new DefaultFlow())->configure($ecsConfig);

    $ecsConfig->paths(
        [
            __DIR__ . '/DistributionPackages',
        ]
    );
};



declare(strict_types=1);

use Netlogix\CodingGuidelines\Php\DefaultPhp;
use Netlogix\CodingGuidelines\Php\Neos\Flow\DefaultFlow;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $ecsConfig): void {
    (new DefaultFlow())->configure($ecsConfig);

    // Combine rules of DefaultPhp, DefaultFlow and the FinalClassFixer
    $ecsConfig->rules(
        array_merge(
            DefaultPhp::getRules(),
            DefaultFlow::getRules(),
            [
                \PhpCsFixer\Fixer\ClassNotation\FinalClassFixer::class,
            ]
        )
    );
    
    // Combine skips of DefaultPhp, DefaultFlow and the OrderedClassElementsFixer
    $ecsConfig->skip(
        array_merge(
            DefaultPhp::getSkips(),
            DefaultFlow::getSkips(),
            [
                \PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer::class,
            ]
        )
    );

    $ecsConfig->paths(
        [
            __DIR__ . '/src',
        ]
    );
};