PHP code example of loadsys / loadsys_codesniffer

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

    

loadsys / loadsys_codesniffer example snippets


	$var = new \DateTime(); // invalid
	$var = new \Vendor\Lib(); // invalid
	$var = new Local\SubClass(); // invalid
	//---
	use \DateTime
	$var = new DateTime(); // valid
	

		 //~Standard.Section.Sniff.Rule,Second.Rule.To.Expect
		$a = [1 , 2]; // Error: Space before comma.

$ vendor/bin/phpcs -ps --standard=./Loadsys snifftests/files/sample_file_name.php

$ find snifftests/files -type f -name '*pass.php' -exec vendor/bin/phpcs -p --standard=./Loadsys {} +

$ find snifftests/files -type f -name '*.php' ! -name '*pass.php' -exec vendor/bin/phpcs -p --standard=./Loadsys {} +

snifftests/files/must_not/array_syntax_long.php
snifftests/files/must/array_syntax_short_pass.php