<?php
$depth = 0;
spl_autoload_register(function ($class) use (&$depth) {
$depth++;
$indent = str_repeat('| ', $depth);
echo $indent."$depth: $class\n";
if ($class == 'IFace') {
interface IFace {}
} elseif ($class == 'IFaceImplementor') {
class IFaceImplementor implements IFace {}
} elseif ($class == 'InterfaceOfMainParent') {
interface InterfaceOfMainParent
{
public function methodForSecondaryLspCheck(): IFace;
}
} elseif ($class == 'MainParent') {
abstract class MainParent implements InterfaceOfMainParent
{
public function methodForSecondaryLspCheck(): IFaceImplementor {}
}
} elseif ($class == 'Intermediate') {
abstract class Intermediate extends MainParent {}
} elseif ($class == 'Child1') {
class Child1 extends Intermediate {}
} elseif ($class == 'Child2') {
class Child2 extends Intermediate {}
} elseif ($class == 'EntrypointParent') {
abstract class EntrypointParent
{
abstract public function methodForLspCheck1(): MainParent;
abstract public function methodForLspCheck2(): MainParent;
}
} elseif ($class == 'Entrypoint') {
class Entrypoint extends EntrypointParent
{
public function methodForLspCheck1(): Child1 {}
public function methodForLspCheck2(): Child2 {}
}
}
$depth--;
});
class_exists(Entrypoint::class);
- Output for 8.4.1 - 8.4.13
- | 1: Entrypoint
| | 2: EntrypointParent
| | 2: Child1
| | | 3: Intermediate
| | | | 4: MainParent
| | | | | 5: InterfaceOfMainParent
| | | | | 5: Child2
Fatal error: During inheritance of MainParent, while autoloading Child2: Uncaught Error: Class "Intermediate" not found in /in/G5fFe:31
Stack trace:
#0 /in/G5fFe(22): {closure:/in/G5fFe:7}('Child2')
#1 /in/G5fFe(27): {closure:/in/G5fFe:7}('MainParent')
#2 /in/G5fFe(29): {closure:/in/G5fFe:7}('Intermediate')
#3 /in/G5fFe(39): {closure:/in/G5fFe:7}('Child1')
#4 [internal function]: {closure:/in/G5fFe:7}('Entrypoint')
#5 /in/G5fFe(49): class_exists('Entrypoint')
#6 {main} in /in/G5fFe on line 22
Process exited with code 255. - Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26
- | 1: Entrypoint
| | 2: EntrypointParent
| | 2: Child1
| | | 3: Intermediate
| | | | 4: MainParent
| | | | | 5: InterfaceOfMainParent
| | | | | 5: Child2
Fatal error: During inheritance of MainParent, while autoloading Child2: Uncaught Error: Class "Intermediate" not found in /in/G5fFe:31
Stack trace:
#0 /in/G5fFe(22): {closure}('Child2')
#1 /in/G5fFe(27): {closure}('MainParent')
#2 /in/G5fFe(29): {closure}('Intermediate')
#3 /in/G5fFe(39): {closure}('Child1')
#4 [internal function]: {closure}('Entrypoint')
#5 /in/G5fFe(49): class_exists('Entrypoint')
#6 {main} in /in/G5fFe on line 22
Process exited with code 255. - Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
- | 1: Entrypoint
| | 2: EntrypointParent
| | 2: Child1
| | | 3: Intermediate
| | | | 4: MainParent
| | | | | 5: InterfaceOfMainParent
| | | | | 5: IFaceImplementor
| | | | | | 6: IFace
| | 2: Child2
- Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33
- | 1: Entrypoint
| | 2: EntrypointParent
| | 2: Child1
| | | 3: Intermediate
| | | | 4: MainParent
| | | | | 5: InterfaceOfMainParent
| | | | | 5: IFaceImplementor
| | | | | | 6: IFace
Fatal error: Declaration of MainParent::methodForSecondaryLspCheck(): IFaceImplementor must be compatible with InterfaceOfMainParent::methodForSecondaryLspCheck(): IFace in /in/G5fFe on line 22
Process exited with code 255. - Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
- Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/G5fFe on line 19
Process exited with code 255. - Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
- Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /in/G5fFe on line 7
Process exited with code 255. - Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
- Parse error: parse error, unexpected T_FUNCTION, expecting ')' in /in/G5fFe on line 7
Process exited with code 255. - Output for 4.3.2 - 4.3.4
- Parse error: parse error, expecting `')'' in /in/G5fFe on line 7
Process exited with code 255.
preferences:
68.51 ms | 416 KiB | 5 Q