I have 3 class as A, B and C like the following:
a.php
<?php
abstract class A {
public static function getInstance() {
$child = get_called_class();
$instance = new $child;
}
}
?>
b.php
<?php
class B extends A {
const MY_CONSTANT = SomeClass::UNKNOWN_CONSTANT;
}
?>
c.php
<?php
include 'a.php';
include 'b.php';
B::getInstance();
//Here will got an error
//Fatal error: Class 'SomeClass' not found in a.php on line 5
?>
Clearly there is an error in the B class, but when I call B::getInstance() method, that error message is "Fatal error: Class 'SomeClass' not found in a.php on line 5"
I don't understand why that error message does not tell me that error in "b.php on line 3"? How to know that real error place and debug it?
EDIT 1
I think PHP should have told me error in b.php on line 3, otherwise I will hard to debug.