Joomla-Bible-Study / Proclaim

Joomla Proclaim Component - Christian Web Ministries
https://www.christianwebministries.org/
GNU General Public License v3.0
11 stars 9 forks source link

Coding Standard for @ #114

Closed bcordis closed 11 years ago

bcordis commented 11 years ago

Need to make a coding standard for using @ in code. Make a comment of why you are having to use it in that line.

genu commented 11 years ago

Which line are you referring to?

bcordis commented 11 years ago

No file in mind. Just would like to add to are coding standards.

bcordis commented 11 years ago

If we find one without comment we should see why we are doing it.

genu commented 11 years ago

Do you mean using @ before a function call?

like whether we should have

$result = @doSmething($param)

or

$result = doSomething($param)
bcordis commented 11 years ago

Yes that is what I'm talking about.

genu commented 11 years ago

Ahh, ok

According to the php docs, the "@" before functions just suppresses the errors if there are any. I'm not sure whether that it is a good or bad thing to have it. I'm guessing if we do a lot of error checking and we have an error mechanism it would be nice to keep that at the component level, but since we don't have it, maybe its a good idea to have php throw errors...

bcordis commented 11 years ago

Yes.

Only time some errors we just ignore do to the file or function dos not have a great way to ignore if the file of system is not needed.

On Sat, Mar 23, 2013 at 2:54 PM, Eugen Istoc notifications@github.comwrote:

Ahh, ok

According to the php docs, the "@" before functions just suppresses the errors if there are any. I'm not sure whether that it is a good or bad thing to have it. I'm guessing if we do a lot of error checking and we have an error mechanism it would be nice to keep that at the component level, but since we don't have it, maybe its a good idea to have php throw errors...

— Reply to this email directly or view it on GitHubhttps://github.com/Joomla-Bible-Study/Joomla-Bible-Study/issues/114#issuecomment-15343603 .

Thanks, Brent Cordis 2406 Hermitage Park Dr. Hermitage, TN 37076 615.429.6426

genu commented 11 years ago

I don't know exactly how joomla does it, but I think we can just ignore the @ in front of functions because either way, error reporting is handled by the error_reporting() function or is set directly in the php.ini file.

if we hard-code error suppression in the code, it may be more difficult to debug, because we may want to see errors when we're developing.

tomfuller2 commented 11 years ago

I know of at least one place where I had to an @ before a function because of an error that is really a bug in Joomla. But I added comments near the code as to why.

genu commented 11 years ago

I think we all agree that the @ should only be used if necessary to suppress errors that are cause by other systems other than the component.

If the @ is used, a comment should state why its necessary.