Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing "possible division by zero" error #11090

Open
staabm opened this issue May 27, 2024 · 2 comments · May be fixed by phpstan/phpstan-src#3419
Open

missing "possible division by zero" error #11090

staabm opened this issue May 27, 2024 · 2 comments · May be fixed by phpstan/phpstan-src#3419

Comments

@staabm
Copy link
Contributor

staabm commented May 27, 2024

Bug report

I think there should be a "possible division by zero" error on line 16

Code snippet that reproduces the problem

https://phpstan.org/r/5565ace0-6db6-4e00-aa45-7c429557d088

Expected output

or maybe it should be a Binary operation "/" between int and int<0, max> might result in an error. ..?

Did PHPStan help you today? Did it make you happy in any way?

No response

@trailsnail
Copy link

trailsnail commented Sep 6, 2024

Error would be nice ❤️
Running on hard "division by zero" while preparing application for PHP8.x

@VincentLanglet
Copy link
Contributor

It already exists

You have to enable

parameters:
	exceptions:
		check:
			missingCheckedExceptionInThrows: true
		checkedExceptionClasses:
			- 'DivisionByZeroError'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants