-
Notifications
You must be signed in to change notification settings - Fork 2
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
Replace constant() with defined() #8
Comments
This is in the main plugin file and also here: https://github.com/ntemple/bracketpress/blob/master/bracketpress.php#L699 |
The code is correct as written. The intent of the code is to check if BRACKETPRESS_DEBUG is defined, and if defined() only tells you if the constant is defined or not. constant(), on the other hand, will tell you: See: In the case it's defined but false, or in the case it's not defined at all, The alternative would be the much more verbose: if (defined('BRACKETPRESS_DEBUG') && BRACKETPRESS_DEBUG != false) { } Any specific reason you bring this up? On Sun, Feb 9, 2014 at 8:28 PM, Pippin Williamson
|
That makes sense. For me it was mostly for "standards" reasons, but I fully understand that's not always a good reason :) Is there any reason that |
In a community project, I'd treat it as "user input". TRUE, true, 'true', 1, YES, etc should all be ok, and no "valid" input On Mon, Feb 10, 2014 at 12:30 PM, Pippin Williamson <
|
Ha I wasn't "concerned" about it :) Very good points. On Mon, Feb 10, 2014 at 10:03 PM, Nick Temple notifications@github.comwrote:
|
While I really don't think there's anything wrong with using the
constant()
function, it's a bit cleaner and more standard to usedefined()
.becomes
The text was updated successfully, but these errors were encountered: