UnionOfRAD / li3_quality

(unmaintained) Code quality assurance for li₃.
BSD 3-Clause "New" or "Revised" License
12 stars 10 forks source link

Exception with bad variable name #46

Closed bayleedev closed 11 years ago

bayleedev commented 11 years ago

Most of our exceptions have a protected $code.

When extending exceptions you have a protected $code however the name goes against our current coding standards.

We could make them public, since in PHP we can always make the visibility of members and methods more visible. This opens up our exceptions to be 'leaky' and edited at runtime.

Or we could make an exception, but this is the tricky part. We could do it for $code with obvious repercussions, or possibly check for "/Exception$/" in class name, but this doesn't ensure that it extends exception. We could open up the file and use Reflection or in_a to determine if it's an exception, but then our static code analyzer becomes a hybrid static/dynamic code analyzer.

Thoughts?

gwoo commented 11 years ago

I think we should rename.

nateabele commented 11 years ago

The $code property is part of PHP's Exception interface.

gwoo commented 11 years ago

But we could still do public instead of protected?

bayleedev commented 11 years ago

Yeah, we can make it public and everything will work. Or check out the class name for 'exception' in it.

nateabele commented 11 years ago

I guess I'm fine with making them public, assuming that doesn't break anything.