DamienHarper / auditor

auditor, the missing audit log library
MIT License
164 stars 53 forks source link

Update SimpleFilter value type to accept int #197

Closed StevenRenaux closed 5 months ago

StevenRenaux commented 8 months ago
Q A
auditor version 2.3
PHP version 8.3
Database MySQL

Summary

Related to this documentation page, and specifically to the query section.

image

Current behavior

As explain in the documentation, normally int value can be passed to SimpleFilter construct.

How to reproduce

If you want to pass an int as value, and as explain in the documentation you will get an error of typing if you use PHPStan.

SimpleFilter class:

class SimpleFilter implements FilterInterface
{
    protected string $name;

    /**
     * @var array|string
     */
    protected $value;

    /**
     * @param array|string $value
     */
    public function __construct(string $name, $value)
    {
        $this->name = $name;
        $this->value = $value;
    }

// rest of the code...    
}

Expected behavior

Update typing.