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

wrong cast usage: was casting isset() not its result #8

Closed
wants to merge 1 commit into from

Conversation

bgeneto
Copy link
Contributor

@bgeneto bgeneto commented Nov 9, 2024

Main changes:

  1. Moved type casts after the ternary conditions
  2. For complex conditions with multiple isset checks, grouped the condition in parentheses
  3. For cases with multiple null coalescing operators, wrapped them in parentheses before applying the cast
  4. Added some line breaks for better readability in complex conditions
  5. The (bool) casts were moved to wrap the filter_var results instead of the isset checks

Easy to check the wrong behavior of casting with this line:

$value = (float) false ? 1.5 : 3;
print($value);
print(gettype($value)); // will print integer not float 
`` 

Main changes:
1. Moved type casts after the ternary conditions
2. For complex conditions with multiple isset checks, grouped the condition in parentheses
3. For cases with multiple null coalescing operators, wrapped them in parentheses before applying the cast
4. Added some line breaks for better readability in complex conditions
5. The (bool) casts were moved to wrap the filter_var results instead of the isset checks
@bgeneto bgeneto changed the title wrong cast usage: was casting isset result wrong cast usage: was casting isset() not its result Nov 10, 2024
@guilherme-cota-efi
Copy link
Member

Thank you for your PR, @bgeneto! The improvement has been implemented in SDK version 1.10.0, correcting the improper casting with isset() for proper type conversion.

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