PHP code example of chancedigital / wp-coding-standards
1. Go to this page and download the library: Download chancedigital/wp-coding-standards 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/ */
chancedigital / wp-coding-standards example snippets
namespace ChanceDigital\Tests\Layout;
use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;
/**
* Class name must follow the directory structure to be autoloaded correctly.
*/
class OrderUnitTest extends AbstractSniffUnitTest {
/**
* Returns the lines where errors should occur.
*
* @return array <int line number> => <int number of errors>
*/
public function getErrorList() {
return [
1 => 1, // line 1 expects 1 error
];
}
/**
* Returns the lines where warnings should occur.
*
* @return array <int line number> => <int number of warnings>
*/
public function getWarningList() {
return [];
}
}
bash
rm -r vendor/squizlabs/php_codesniffer
composer install --prefer-source
composer dump-autoload