View Single Post
Old 11-08-2012, 09:42 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,653
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
Good question. I'd suggest you always use them; the docs do not specify that they are required, but they also do not specify them as optional in void argument constructors. Examples also show the use of them at all times. Hence it may be an unintended "feature" that will be removed in the future; 5.0 had some interesting "features" like being able to overwrite $this, static abstract methods, and several others. These have mostly been corrected by 5.2 and onwards.

I'm not sure why it lets you get away with this tbh. It could be an unintended feature they never bothered to resolve, or that it may be a requirement to not break backwards compatibility. I did find a remnant in the types section that show an example of using new without the parenthesis, but it appears to be an example in PHP4.x. So if that's the case (I didn't program OO in php 4.x, so I'm not all that familiar with the intricacies of it), than it would be for backwards compatibility.
Fou-Lu is offline   Reply With Quote