PHP-TYPEHINT-OVERRIDE-001

public function display($tpl = null)

Child class missing Joomla 4 typehints

Joomla 4 added scalar/return types on MVC parents. A J3 subclass that omits them fatals: Declaration must be compatible.

public function display($tpl = null)Match parent signatures (including types and return)

Dies at Joomla 3 → 4J3: Works nativelyJ4: Changed behaviourJ6: Changed behaviourBC plugin: not applicablePatch possible — review itPHP

What you will see

  • Declaration of ... must be compatible with
  • Fatal error: Declaration

Symptoms people search

incompatible declaration · typehint override · PHP fatal on view display

Replace this code

Swap public function display($tpl = null) for Match parent signatures (including types and return).

Joomla 3

Remove or stop calling this

public function display($tpl = null) { parent::display($tpl); }

Joomla 4 / 6

Use this instead

public function display($tpl = null): void { parent::display($tpl); }

How to fix it

  1. 1Copy the parent method signature from HtmlView / BaseController / ListModel.
  2. 2Do not guess — open the Joomla 6 class.

Also known as

must be compatible · Return type · typed properties

Related issues

Get in touch

Have a project in mind? Let's talk about it.

Tell us what you're building. Whether it's a new site, an online store, a mobile app, or something that needs AI under the hood, we'll get back to you within a business day.

Free consultation
No commitment, no pressure
Reply within 24 hours
Usually much faster

Prefer a direct conversation?

Request a project quote

Tell us about your project

Fill out the quick form and we'll reach out.