PHPSocialNetwork / phpfastcache

A high-performance backend cache system. It is intended for use in speeding up dynamic web applications by alleviating database load. Well implemented, it can drops the database load to almost nothing, yielding faster page load times for users, better resource utilization. It is simple yet powerful.
https://www.phpfastcache.com
MIT License
2.38k stars 451 forks source link

Psalm issue with the 3rd parameter of Psr16Adapter::set has to be null #768

Closed flecki89 closed 3 years ago

flecki89 commented 3 years ago

Configuration

Describe the bug

Not a functional bug, but psalm insists that the 3rd parameter in Phpfastcache\Helper\Psr16Adapter::set has to be null.

When I run psalm, it throws this error

ERROR: InvalidArgument - src\SFCache.php:88:38 - Argument 3 of Phpfastcache\Helper\Psr16Adapter::set expects null, int provided (see https://psalm.dev/004)
            $inst->set($key, $value, $ttl);

where $inst is my Cache instance

To Reproduce Steps to reproduce the behavior:

  1. Use Psr16Adapter::set with 3rd parameter set
  2. Run psalm with default configuration
  3. Encounter the error above

Expected behavior Psalm should not recognize this or similar errors.

Possible solution Changing https://github.com/PHPSocialNetwork/phpfastcache/blob/99a345aae21f1c6d54955f8bbb622f3fba39a322/lib/Phpfastcache/Helper/Psr16Adapter.php#L93 to

     * @param int|null $ttl

solves this problem.

github-actions[bot] commented 3 years ago

Hello curious contributor ! Since it seems to be your first contribution, make sure that you've been:

Geolim4 commented 3 years ago

Hello,

Indeed the Phpdoc are outdated. I'll fix that asap, thanks for the report !

Cheers, Georges

Geolim4 commented 3 years ago

Hello,

This is now fixed, expect the next release to be out in 2 weeks,

Thanks again ! Cheers, Georges