Skip to content

type combinator: fix integer ranges operations#89

Merged
ondrejmirtes merged 1 commit intophpstan:masterfrom
hrach:ranges
Jan 11, 2020
Merged

type combinator: fix integer ranges operations#89
ondrejmirtes merged 1 commit intophpstan:masterfrom
hrach:ranges

Conversation

@hrach
Copy link
Copy Markdown
Contributor

@hrach hrach commented Jan 5, 2020

Another minute, another PR. 💦

public function doFoo(array $integers, string $string, $mixedIsset, $mixedArrayKeyExists)
{
if (rand(0, 1) === 0) {
if (rand(0, 10) === 0) {
Copy link
Copy Markdown
Contributor Author

@hrach hrach Jan 5, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that PhpStan already has some definition of pure functions and therefore using rand with same args is cached. 🤔 But not sure what is the current state.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually not yet, it currently dumbly caches rand(0, 1) result for all functions.

@ondrejmirtes
Copy link
Copy Markdown
Member

I really don't understand the math, @JanTvrdik has to review this. Thank you.

@ondrejmirtes
Copy link
Copy Markdown
Member

OK, let's just see if anyone finds a bug in this :) Thank you very much!

@ondrejmirtes ondrejmirtes merged commit 56d2e30 into phpstan:master Jan 11, 2020
@hrach hrach deleted the ranges branch January 11, 2020 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants