- Output for 7.1.25 - 7.1.33, 7.2.0 - 7.2.24, 7.3.0 - 7.3.11
- Fatal error: Declaration of B::getSize(): ?int must be compatible with A::getSize(): int in /in/DnSXf on line 13
Process exited with code 255.
<?php
class A {
public function getSize(): int {
return 2;
}
}
class B extends A {
public function getSize(): ?int
{
return null;
}
}
$b = new B;
var_dump($b->getSize());