PHP code example of isaac / php-code-sniffer-standard

1. Go to this page and download the library: Download isaac/php-code-sniffer-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/ */

    

isaac / php-code-sniffer-standard example snippets


try {
    $this->logger->log(LogLevel::INFO, new DateTimeImmutable());
//phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch -- DateTimeImmutable creation cannot fail in this case
} catch (Exception $exception) {
}

    <config name="testVersion" value="7.0"/> <!-- check for compatability with php 7.0 -->
    <config name="testVersion" value="7.1-"/> <!-- check for 7.1 and higher -->
    <config name="testVersion" value="7.0-7.2"/> <!-- check within range 7.0 to 7.2 -->