PHP code example of corpus / coding-standard

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

    

corpus / coding-standard example snippets


if( $foo ) {
    echo $bar;
}
echo $baz;

if( $foo ) {
    echo $bar;
}

echo $baz;

class Foo
{
    public function bar()
    {
        echo "bbq";
    }
}

class Foo {
    public function bar() {
        echo "bbq";
    }
}

if(
    $foo &&
    $bar &&
    $baz
)}

if(
    $foo
    && $bar
    && $baz
)}

if( $foo == true ){
    return 1;

}

if( $foo == true ){
    return 1;
}

$foo = function ( string $foo ) { echo $foo; };
$bar = fn ( int $bar ) => $bar + 1;

$foo = function( string $foo ) { echo $foo; };
$bar = fn( int $bar ) => $bar + 1;

function Foo( ClosingBraceNewlineSniffTest $closingBraceNewlineSniffTest, OpeningOneTrueBraceSniffTest $openingOneTrueBraceSniffTest ) { }

function Foo(
    ClosingBraceNewlineSniffTest $closingBraceNewlineSniffTest,
    OpeningOneTrueBraceSniffTest $openingOneTrueBraceSniffTest
) { }


namespace Corpus\Sniffs\Methods;

class MethodParameterFormattingSniff {
	/**
	 * Maximum line character length after which to break function arguments into newlines
	 */
	public $maxLength = 130;
}