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

More precise mixed-type subtraction #3420

Open
wants to merge 16 commits into
base: 1.12.x
Choose a base branch
from
Open

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Sep 8, 2024

realized this nit while looking more into division related types

src/Type/MixedType.php Outdated Show resolved Hide resolved
src/Type/MixedType.php Outdated Show resolved Hide resolved
@staabm staabm force-pushed the mixsub branch 2 times, most recently from a26a7a0 to 1f9a3bf Compare September 8, 2024 14:54
src/Type/MixedType.php Outdated Show resolved Hide resolved
src/Type/MixedType.php Outdated Show resolved Hide resolved
src/Type/MixedType.php Outdated Show resolved Hide resolved
@staabm
Copy link
Contributor Author

staabm commented Sep 9, 2024

after a break and thinking about your feedback, I came to a new implementation idea :).


if ($m != false) {
assertType("mixed~0|0.0|''|'0'|array{}|false|null", $m);
assertType('int<min, -1>|int<1, max>', (int) $m);
Copy link
Contributor Author

@staabm staabm Sep 12, 2024

Choose a reason for hiding this comment

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

running my new tool thru this test, told me that (int) $m can still be zero at this point:

https://3v4l.org/AiaKX

we already knew that because ondrey told us - but as of now I can find this errors myself without wasting his time

@staabm
Copy link
Contributor Author

staabm commented Sep 12, 2024

just reduced this PR to mixed->toString() and will to the toInteger part in a separate PR

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