ID:               34697
 Updated by:       [EMAIL PROTECTED]
 Reported By:      direvus at gmail dot com
-Status:           Open
+Status:           Closed
 Bug Type:         Documentation problem
 Operating System: Linux
 PHP Version:      Irrelevant
-Assigned To:      
+Assigned To:      colder
 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation
better.




Previous Comments:
------------------------------------------------------------------------

[2005-10-03 00:58:55] direvus at gmail dot com

> I doubt anyone will know exactly what are the features that will
make
you have to declare the class prior of its usage.

Well somebody wrote the code that causes this behaviour, so somebody
must know about it.  Unless it's unintended.

> Anyway, declaring the
class before its usage has some performance advantages.

That's good to know, and should also be noted in the manual.

Don't get me wrong, I'm all for declaring classes prior to usage.  I
think it's much better programming style.  But there's a big difference
between "it's good style" and "the language requires it".  A difference
that needs to be well documented.

------------------------------------------------------------------------

[2005-10-02 22:58:49] [EMAIL PROTECTED]

I doubt anyone will know exactly what are the features that will make
you have to declare the class prior of its usage. Anyway, declaring the
class before its usage has some performance advantages.

However I couldn't find this info in the language.oop5 chapter, so I'm
leaving this open to add a note to that page.

------------------------------------------------------------------------

[2005-10-02 22:26:36] direvus at gmail dot com

No, it doesn't.

It says "some of the new features of PHP5".  That's extremely
non-specific.  It could mean that only a couple of the new features
cause the restriction, or it could mean that all of them do.

And I'd like to reiterate my point that, regardless of how clear the
mention is, it is not where it needs to be.  It needs to be in the
manual *and* in the migration guide.

This is a significant (and again, peculiar) property of PHP5 class
syntax.  It's just not right to leave it out of the manual.

Whether you think the existing sentence is sufficient or not, how is
the manual not improved by adding this?

------------------------------------------------------------------------

[2005-10-02 18:21:56] [EMAIL PROTECTED]

I think it is clear enough.
It says that if you use the "new" PHP 5 features (interfaces,
inheritance,..) you must declare the class before using it.

------------------------------------------------------------------------

[2005-10-01 03:12:54] direvus at gmail dot com

Description:
------------
In the php5 migration guide, we have

"In some cases classes must be declared before used. It only happens
only if some of the new features of PHP 5 are used. Otherwise the
behaviour is the old."

I request that this behaviour be documented properly (which features? 
And why?) in the manual chapter on Classes and Objects in PHP5.

I think for most people who are accustomed to PHP definition
conventions, this will come as a surprise.  Functions never need to be
declared before use.  Even methods within a class definition need not
be declared before use.  So why do we have this strange requirement in
the declaration of classes?

This vague mention in the migration guide really isn't sufficient ...
it's a strange and opaque behaviour whether you're migrating code or
not.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34697&edit=1

Reply via email to