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

Fix warnings for upcoming PHP 8.1 #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mjot
Copy link

@mjot mjot commented Dec 7, 2023

I got the following Notice while using the last image-generator version:

NOTICE: PHP message: PHP Deprecated:  Implicit conversion from float 219.5 to int loses precision in /var/www/html/vendor/nicoverbruggen/image-generator/src/ImageGenerator.php on line 111

I have seen that similar fixes have already been applied to other parts of the codebase, but these two lines were missing.

To address this, I have explicitly cast the floating-point values to integers where $x and $y coordinates are calculated. This change aligns with the fixes made elsewhere in the code by you and ensures compatibility with PHP 8's type enforcement, preventing the deprecation notice related to precision loss during the float-to-int conversion. This should maintain the functionality while adhering to PHP 8's stricter type requirements.

I hope you can add this fix into the main codebase. This modification has resolved the issue in my environment, and I believe it would be beneficial for other users as well. Looking forward to seeing this enhancement in the next update of the image-generator. :)

I got the following Notice while using the last image-generator version:
```
NOTICE: PHP message: PHP Deprecated:  Implicit conversion from float 219.5 to int loses precision in /var/www/html/vendor/nicoverbruggen/image-generator/src/ImageGenerator.php on line 111
```
I have seen that similar fixes have already been applied to other parts of the codebase, but these two lines were missing.

To address this, I have explicitly cast the floating-point values to integers where `$x` and `$y` coordinates are calculated. This change aligns with the fixes made elsewhere in the code by you and ensures compatibility with PHP 8's type enforcement, preventing the deprecation notice related to precision loss during the float-to-int conversion. This should maintain the functionality while adhering to PHP 8's stricter type requirements.

I hope you can add this fix into the main codebase. This modification has resolved the issue in my environment, and I believe it would be beneficial for other users as well. Looking forward to seeing this enhancement in the next update of the image-generator. :)
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.

None yet

1 participant