Useless code #7340
Closed
MallauryGerard
started this conversation in
General
Useless code
#7340
Replies: 1 comment 1 reply
-
We need to improve their method for its return types. Currently, there are three possible types: "1", "0", and nullable itself. Both "1" and "0" are not boolean values; they are string values. That's why you commonly see this in most places. We are already aware of these issues, and we are trying to make the return type cleaner to eliminate this inconsistency. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I was editing a file and I came across this code which is useless...
Regardless of the PHP version, it is not necessary to cast a string to a boolean.
And if you look for
== "1" ? true
in your IDE, you will find this code 30 times...Solution 1:
Solution 2:
A cleaner way to do that would be to create your own blade directive. This way:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions