I guess you are wondering why isn't throwing an error
because you have 4 mandatory arguments in
User::notify(), right?

Hmmm, it makes sense what you're saying, because if I
would use your class and only know you're implementing
SplSubject, I'd knew there's notify() that I can use,
but as you have 4 mandatory parameters that would
throw 4 warnings.

I'm curious what other, more experienced PHP
developers have to say about this. I'm using PHP 5.2.5
too



--- "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

> On Wed, Apr 16, 2008 at 5:38 PM, Keith Pope
> <[EMAIL PROTECTED]> wrote:
> 
> >
> > Hi this is a little off topic but I thought this
> would be a good place to
> > ask, I have a really strange php behaviour when
> using an interface. I have
> > tried finding a bug that matches but no success.
> >
> > Right the code:
> >
> > <?php
> > class User implements SplSubject
> > {
> >    public function attach( SplObserver $observer )
> >    {
> >
> >    }
> >
> >    public function detach( SplObserver $observer)
> >    {
> >
> >    }
> >
> >    //this should fail with fatal??
> >    public function notify( $th1s, $should, $not,
> $work )
> >    {
> >    }
> > }
> >
> > interface ITest
> > {
> >    public function notify();
> >
> >    public function test();
> > }
> >
> > class ATest implements ITest
> > {
> >    //this should fail with fatal
> >    public function notify( $break )
> >    {
> >
> >    }
> >
> >    //this should work ok
> >    public function test( $dontBreak = 1 )
> >    {
> >
> >    }
> > }
> > ?>
> >
> > Now when I run this I get:
> >
> > <b>Fatal error</b>:  Declaration of
> ATest::notify() must be compatible
> > with that of ITest::notify() in
> <b>C:\www\24dash\tests\tmp.php</b> on line
> > <b>24</b><br />
> >
> Seems that this is the expected behavior.
> 
> >
> > Which is exactly what I would expect, but wheres
> my error for
> > SplSubject???
> 
> 
> SplSubject is one of the Interfaces currently
> shipped on PHP 5.1 and later.
> 
> 
> >
> > My PHP version is 5.2.5.
> >
> > What do you think?
> >
> > Thx
> >
> > Keith Pope
> > Web Developer
> >
> > --
> >
> > allpay.net Limited, Fortis et Fides, Whitestone
> Business Park, Whitestone,
> > Hereford, HR1 3SE.
> >
> > Registered in England No. 02933191. UK VAT Reg.
> No. 666 9148 88.
> >
> >
> >
> > Telephone: 0870 243 3434, Fax: 0870 243 6041.
> >
> > Website: www.allpay.net
> >
> > Email: [EMAIL PROTECTED]
> >
> >
> >
> > This email, and any files transmitted with it, is
> confidential and
> > intended solely for the use of the individual or
> entity to whom it is
> > addressed. If you have received this email in
> error please notify the
> > allpay.net Information Security Manager at the
> number above.
> >
> 
> 
> 
> -- 
> Favorite Quotes:
> 
> For I know the plans I have for you," declares the
> LORD, "plans to prosper
> you and not to harm you, plans to give you hope and
> a future.
> -- Jeremiah 29:11 - New International Version (NIV)
> 
> --------
> This email and/or attachments are confidential and
> may also be
> legally privileged. If you are not the intended
> recipient, you are
> hereby notified, that any review, dissemination,
> distribution or
> copying of this email and/or attachments is strictly
> prohibited.
> Please notify [EMAIL PROTECTED] immediately by
> email and
> delete this message and all its attachments. Thank
> you.
> 



      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

Reply via email to