PHP - require_once and class inheritance issue
I get a fatal error: Fatal error: Class 'Foo1' not found in .../Foo2.php
on line 5 with the following files:
index.php:
<?php
require_once("./Foo1.php");
?>
<h1>Success</h1>
Foo1.php:
<?php
require_once('./IFoo.php');
require_once('./Bar.php');
class Foo1 implements IFoo
{
/** @var Bar */
private $bar;
}
IFoo.php:
<?php
interface IFoo {
}
Bar.php:
<?php
require_once('./Foo2.php');
class Bar {
/** @var Foo2 */
private $foo;
}
Foo2.php:
<?php
require_once("./Foo1.php");
class Foo2 extends Foo1
{
}
Questions:
How to solve this situation?
Why when I suppress the implements IFoo statements, this code works?
No comments:
Post a Comment