1. Go to this page and download the library: Download forrest79/phpcs 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/ */
forrest79 / phpcs example snippets
use Foo\IP\Bar;
use Foo\Php\Bar;
use Foo\UI\Bar;
use Foo\Xml\Bar;
use LogAware;
use LogFactory;
use LogLevel;
use LogStandard;
use LogableTrait;
use LoggerInterface;
declare(strict_types=1);
namespace Forrest79;
sprintf('%s/%s', $dir, $fileName);
// vs
$foo . $bar;
namespace Forrest79;
use Forrest79\Bar;
use Forrest79\Foo;
use DateTime;
use Lorem\Amet;
use Lorem\Ipsum\Dolor\Foo as DolorFoo;
use Lorem\Sit;
use ReflectionClass;
use ReflectionMethod;
namespace Forrest79\Foo;
use Forrest79;
class LoremException extends Forrest79\PhpException
{
private strinf $lorem;
public function __construct(string $lorem, \Throwable $previous = NULL)
{
parent::__construct(sprintf('%s ipsum dolor sit amet', $lorem), $previous);
$this->lorem = $lorem;
}
public function getLorem(): string
{
return $this->lorem;
}
}
/**
* Short description - one line (optional)
*
* Long description (optional)
*
* Documentation annotations (optional)
*
* Code analysis annotations (optional)
*
* Application annotations (optional)
*
* @param string $foo only if some optional description is needed
* @param int $bar only if some optional description is needed
* @return bool only if some optional description is needed
* @throws \MyException\BarException
* @throws \MyException\FooException
*/
public function myMethod(string $foo, int $bar): bool;
/**
* Short description - one line (optional)
*
* Long description (optional)
*
* Documentation annotations (optional)
*
* Code analysis annotations (optional)
*
* Application annotations (optional)
*
* @var string optional description
*/
private $foo;