# interfaces extending multiple interfaces

- Thread: https://externals.io/message/7140
- Original archive: https://news-web.php.net/php.internals/7140
- Started by Hans Lellelid on 2004-01-16T21:16:10+00:00
- Messages: 7
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #7140 — Hans Lellelid — 2004-01-16T21:16:10+00:00

URL: https://externals.io/message/7140#7140

Is there any way to have an _interface_ implement or extend multiple 
interfaces?  This was working as of PHP5b3, but seems to work no longer 
as of latest snapshot I downloaded.

The only way to do it before was to have an interface implement other 
interfaces:

interface ExtendFileSelector implements Parameterizable, FileSelector {
}

This was a very useful way to get around a need for multiple 
inheritance.  Obviously an interface that implements other interfaces is 
kinda weird -- but I was very pleased that it worked.

I apolgoize if I've missed a thread where this was discussed.

Hans

---

## #7145 — Andrey Hristov — 2004-01-17T00:59:28+00:00

URL: https://externals.io/message/7140#7145 · In reply to: #7140

Hi,
Hans Lellelid wrote:
> Is there any way to have an _interface_ implement or extend multiple 
> interfaces?  This was working as of PHP5b3, but seems to work no longer 
> as of latest snapshot I downloaded.
> 
> The only way to do it before was to have an interface implement other 
> interfaces:
> 
> interface ExtendFileSelector implements Parameterizable, FileSelector {
> }
> 
> This was a very useful way to get around a need for multiple 
> inheritance.  Obviously an interface that implements other interfaces is 
> kinda weird -- but I was very pleased that it worked.

Yeah, it's like that for about 2 days. Hopefully this will be fixed before RC1 which is 
scheduled for the end of the month. Sebastian Bergmann already complained :)



> I apolgoize if I've missed a thread where this was discussed.
No, it wasn't.

Andrey

---

## #7205 — Andi Gutmans — 2004-01-20T22:41:36+00:00

URL: https://externals.io/message/7140#7205 · In reply to: #7140

Zeev is planning on fixing this. Interfaces should be allowed to extend 
other interfaces but not to implement them.

Andi

At 04:16 PM 1/16/2004 -0500, Hans Lellelid wrote:
>Is there any way to have an _interface_ implement or extend multiple 
>interfaces?  This was working as of PHP5b3, but seems to work no longer as 
>of latest snapshot I downloaded.
>
>The only way to do it before was to have an interface implement other 
>interfaces:
>
>interface ExtendFileSelector implements Parameterizable, FileSelector {
>}
>
>This was a very useful way to get around a need for multiple 
>inheritance.  Obviously an interface that implements other interfaces is 
>kinda weird -- but I was very pleased that it worked.
>
>I apolgoize if I've missed a thread where this was discussed.
>
>Hans

---

## #7257 — Sebastian Bergmann — 2004-01-21T21:30:25+00:00

URL: https://externals.io/message/7140#7257 · In reply to: #7205

Andi Gutmans wrote:
> Zeev is planning on fixing this.

  Cool.

> Interfaces should be allowed to extend other interfaces but not
> to implement them.

    interface Bar extends Foo {}

  works already (at least last time I checked). What I need (and meant) is

    interface Barbara extends Bar, Foo {}

  Just to make sure :-),
Sebastian

-- 
Sebastian Bergmann
http://sebastian-bergmann.de/                   http://phpOpenTracker.de/

Das Buch zu PHP 5: http://professionelle-softwareentwicklung-mit-php5.de/

---

## #7862 — Hans Lellelid — 2004-02-16T05:01:58+00:00

URL: https://externals.io/message/7140#7862 · In reply to: #7257

Hi -


Sebastian Bergmann wrote:
> Andi Gutmans wrote:
> 
> > […]
> 
> 
>   Cool.
> 
> > […]
> 
> 
>     interface Bar extends Foo {}
> 
>   works already (at least last time I checked). What I need (and meant) is
> 
>     interface Barbara extends Bar, Foo {}
> 
>   Just to make sure :-),

This multiple extension would be very nice.  I thought this was going to 
be fixed for beta4/RC1, but still seems not to be. Is the plan not to 
implement this feature? As Sebastian points out here (some time ago), 
perhaps there was some misunderstanding about what the original issue was.

Hans


> Sebastian

---

## #7863 — Sebastian Bergmann — 2004-02-16T05:10:52+00:00

URL: https://externals.io/message/7140#7863 · In reply to: #7862

Hans Lellelid wrote:
> I thought this was going to be fixed for beta4/RC1, but still seems
> not to be.

  Works for me:

     <?php
     interface Foo {
         public function doFoo();
     }

     interface Bar {
         public function doBar();
     }

     interface Barbara extends Foo, Bar {}

     class BarbaraImpl implements Barbara {
         public function doFoo() {}
         public function doBar() {}
     }
     ?>

  Greetings,
Sebastian

-- 
Sebastian Bergmann
http://sebastian-bergmann.de/                   http://phpOpenTracker.de/

Das Buch zu PHP 5: http://professionelle-softwareentwicklung-mit-php5.de/

---

## #7865 — Hans Lellelid — 2004-02-16T05:25:06+00:00

URL: https://externals.io/message/7140#7865 · In reply to: #7863

Sebastian Bergmann wrote:

> Hans Lellelid wrote:
> 
> > […]
> 
> 
>   Works for me:

Apologies! -- yes, it does work.  I was still doing the old "Foo 
implements Foo, Bar" which used to work (but never should have).

Thanks-
Hans
