views:

120

answers:

2

I have a class defined as final. Does it make sense to define the methods as final as well? I know that since the class itself is final it can't be extended, which would make the method final declarations redundant, but I want to work up documentation on the class and others, and thought it'd be help since the final property of the method would be there, so you'd know right away.

Thoughts? I couldn't find anything in PEAR's coding standards about this. Thanks.

+1  A: 

No you don't have to do that. Ever modern ide should help you realize, via code completion, that the methods are final to.

chelmertz
+2  A: 

If you define a class as final, then class can't be extends any more but if you define any of the methods final then those methods can't be overridden or extended to add more functionality.

So, it is not necessary to define methods as final if the class itself is final.

More Info: PHP's final Keyword.

Sarfraz