Skip to content

Remove stale generic annotation on Application class - #1099

Merged
ADmad merged 1 commit into
5.xfrom
fix-baseapplication-generics
Aug 5, 2026
Merged

Remove stale generic annotation on Application class#1099
ADmad merged 1 commit into
5.xfrom
fix-baseapplication-generics

Conversation

@dereuromark

Copy link
Copy Markdown
Member

Fixes the PHPStan error every fresh 5.x app hits after installing CakePHP 5.4:

src/Application.php:41
PHPDoc tag @extends contains generic type Cake\Http\BaseApplication<App\Application>
but class Cake\Http\BaseApplication is not generic. (generics.notGeneric)

CakePHP 5.4.0 removed the template from Cake\Http\BaseApplication (commit ba510db081, "Simplify generics template for event subject"):

- * @template TSubject of \Cake\Http\BaseApplication
- * @implements \Cake\Event\EventDispatcherInterface<TSubject>
- * @implements \Cake\Core\PluginApplicationInterface<TSubject>

The event subject template now defaults to $this on EventDispatcherInterface/EventDispatcherTrait, so the skeleton no longer needs to name it - and naming it is now an error.

This branch pins cakephp/cakephp: 5.4.*, so removal is safe here. 5.next still pins 5.3.*, where BaseApplication is generic, so it is intentionally left alone.

Reported in cakephp/cakephp#19583.

CakePHP 5.4.0 dropped the TSubject template from Cake\Http\BaseApplication,
so the skeleton's extends annotation now reports
"generics.notGeneric" on every freshly created app running PHPStan.
@ADmad
ADmad merged commit d9feb07 into 5.x Aug 5, 2026
4 checks passed
@ADmad
ADmad deleted the fix-baseapplication-generics branch August 5, 2026 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants