Entity::getStructure should be abstract

Xon

Well-known member
Affected version
2.3.0
XF\Mvc\Entity\Entity is defined as;
PHP:
public static function getStructure(Structure $structure)
{
    throw new \LogicException(static::class . '::getStructure() must be overridden');
}

This generates a false positive for phpstorm's "Missing parent call for method" inspector.

However php v7.0+ supports just marking it as abstract:
PHP:
abstract public static function getStructure(Structure $structure);

Technically this would be a breaking change, but an 3rd party Entity which didn't implement getStructure was frankly broken anyway. Might as well make it explicit.
 
Back
Top Bottom