CMS MADE SIMPLE FORGE

AceSyntax

 

[#12866] Warning: Private methods cannot be final as they are never overridden by other classes

avatar
Created By: Benoit Rambaud (brambaud)
Date Submitted: Sat Oct 03 08:57:37 -0400 2026

Assigned To: Fernando Morgado (JoMorg)
Version: 1.0.1
CMSMS Version: 2.2.24
Severity: Trivial
Resolution: None
State: Open
Summary:
Warning: Private methods cannot be final as they are never overridden by other classes
Detailed Description:
Under PHP 8.4.6

Warning: Private methods cannot be final as they are never overridden by other
classes in C:\wamp64\www\eat-lyon\modules\AceSyntax\AceSyntax.module.php on line
54

The warning you are seeing occurs because you have defined a method as both
private and final.
In PHP, private methods are not visible to child classes; therefore, they cannot
be overridden by definition. Declaring them final is redundant and causes a
syntax warning in newer versions of PHP (as of PHP 8.0+).

The Fix

Open your file modules\AceSyntax\AceSyntax.module.php and locate the method
_autoloader around line 54.

Change this:

private final function _autoloader($classname)
{
    // ...
}

To this:

private function _autoloader($classname)
{
    // ...
}

Additional Note

You should check if there are other methods in the file with the same
combination. Looking at the code provided:

- Line 54: private final function _autoloader — Fix this.
- Line 160: final public function AceGetPreference — This is fine
(Public/Protected methods can be final).
- Line 175: final protected function AceSetPreference — This is fine.
- Line 185: final public function AceGetModes — This is fine.
- Line 203: final public function AceGetThemes — This is fine.

Only private final combinations cause this warning. Simply removing the final
keyword from any private method will resolve the issue.


History