Re: inheritance check too strict?
| From: | Nathan Rixham | Date: | Thu, 19 Aug 2010 21:10:07 +0000 |
| Subject: | Re: inheritance check too strict? | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-49470@lists.php.net to get a copy of this message | ||
Chris Stockton wrote:
Hello, On Thu, Aug 19, 2010 at 12:33 PM, Nathan Rixham <nrixham@gmail.com> wrote:Perhaps I am, I think his example was wrong - if it was an example of doing it the wrong way and an example which should trigger a warning then yes I totally agree. To clarify, hopefully - given: class Point2D {} class Point3D extends Point2D {} the following is incorrect and should raise a (heavy) warning (Zeev's example with class names changed for clarity): class Point2DManager {Guys, this is going a bit nuts, let's swap all the Foo and Bar's for a real example - Zeev I've copied the way you specified above.I think your misunderstanding his position. To summarize my understanding: he clearly states that in such a use case a warning is in order, however currently the warning is overly aggressive. I think in general this is a small fish in the pond but I see his point.
public function distanceBetween( Point3D $p1 , Point3D $p2 ) {};
}
class Point3DManager extends Point2DManager {
public function distanceBetween( Point2D $p1 , Point2D $p2 ) {};
}
whilst the following is correct, and should not raise any warning:
class Point2DManager {
public function distanceBetween( Point2D $p1 , Point2D $p2 ) {};
}
class Point3DManager extends Point2DManager {
public function distanceBetween( Point3D $p1 , Point3D $p2 ) {};
}
If we're all saying the same thing then great and apologies for the confusion.
Best,
Nathan