Loosing narrowed type on `Symfony\Contracts\Cache\CacheInterface`
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Start with the linked reproducer repository and trace the Symfony\Contracts\Cache\CacheInterface call that changes the non-negative-int return type. Compare PHPStan's inferred type before and after the cache call, then verify that the return type remains int<0, max> without introducing new issues.
Written by the indexing model from the issue text.
Description
Bug report
I'm passing a non-negative-int in my method, which is correctly detected by PHPStan. However, it looses it's narrowed type on the way passing through CacheInterface. I'm not sure why.
I created a reproducer repo, as I'm unable to reproduce this issue on Playground.
https://github.com/mvhirsch/phpstan-symfony-cache-reproducer
Code snippet that reproduces the problem
No response
Expected output
No issues. Return type of $this->cache->get() should be int<0, max>, not int.
Did PHPStan help you today? Did it make you happy in any way?
It helps me keeping calm and settled in a hasty project.
- Dominant language
- PHP
- Stars
- 800
- Forks
- 104
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from phpstan/phpstan-symfony
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
phpstan/phpstan-symfony#510 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
phpstan/phpstan-symfony#494 · 5 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
phpstan/phpstan-symfony#268 ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
phpstan/phpstan-symfony#509 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
phpstan/phpstan-symfony#466 · 4 comments ·
All issues in phpstan/phpstan-symfony
Similar issues
-
priority: p3
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
googleapis/librarian#7636 ·
-
0. Needs triage bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nextcloud/fulltextsearch#1011 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
phpstan/phpstan-doctrine#794 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/static-site-importer#1767 ·