PHP code example of nish / phpstan-echo-html-rule

1. Go to this page and download the library: Download nish/phpstan-echo-html-rule 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/ */

    

nish / phpstan-echo-html-rule example snippets




namespace App;

class ProductDto
{
    /** @var int */
    public $product_id;
    /** @var string */
    public $name;
    /** @var ?string */
    public $description;
}


namespace App;
class ProductHtml {
    public function view(ProductDto $product): void {



/**
 * @param int|string|null $input
 * @return safehtml-string
 */
function h($input)
{
    return htmlspecialchars((string)$input);
}

/**
 * @param int|string|null $input
 * @return safehtml-string
 */
function raw($input)
{
    return (string)$input;
}


namespace App;
class ProductHtml {
    public function view(ProductDto $product): void {


namespace App;
class TypeHtml {
    const CURRENT_TYPE_ID = 2;
    const TYPES = [
        1 => 'TYPE 1',
        2 => 'TYPE 2',
        3 => 'TYPE 3',
    ];
    public function view(): void {
yaml
 vendor/nish/phpstan-echo-html-rule/rules.neon