No Code Attached Yet
avatar PhilETaylor
PhilETaylor
15 Aug 2021

Steps to reproduce the issue

run build/stubGenerator.php
inspect stubs.php

Expected result

All the classes in that file should exist, else you are telling developers and IDE's to allow auto-completion to non-existing classes

Actual result

For example the following are all invalid, as the class that is on the right of extends no longer exists in Joomla:
(There are a lot! This is just an example from near the bottom of the file)

/**
 * @deprecated 5.0 Use Joomla\CMS\Filesystem\Wrapper\FileWrapper instead.
 */
class JFilesystemWrapperFile extends Joomla\CMS\Filesystem\Wrapper\FileWrapper {}

/**
 * @deprecated 5.0 Use Joomla\CMS\Filesystem\Wrapper\FolderWrapper instead.
 */
class JFilesystemWrapperFolder extends Joomla\CMS\Filesystem\Wrapper\FolderWrapper {}

/**
 * @deprecated 5.0 Use Joomla\CMS\Filesystem\Wrapper\PathWrapper instead.
 */
class JFilesystemWrapperPath extends Joomla\CMS\Filesystem\Wrapper\PathWrapper {}

/**
 * @deprecated 5.0 Use Joomla\Image\Filter\Backgroundfill instead.
 */
class JImageFilterBackgroundfill extends Joomla\Image\Filter\Backgroundfill {}

/**
 * @deprecated 5.0 Use Joomla\Image\Filter\Brightness instead.
 */
class JImageFilterBrightness extends Joomla\Image\Filter\Brightness {}

/**
 * @deprecated 5.0 Use Joomla\Image\Filter\Contrast instead.
 */
class JImageFilterContrast extends Joomla\Image\Filter\Contrast {}

/**
 * @deprecated 5.0 Use Joomla\Image\Filter\Edgedetect instead.
 */
class JImageFilterEdgedetect extends Joomla\Image\Filter\Edgedetect {}

/**
 * @deprecated 5.0 Use Joomla\Image\Filter\Emboss instead.
 */
class JImageFilterEmboss extends Joomla\Image\Filter\Emboss {}

/**
 * @deprecated 5.0 Use Joomla\Image\Filter\Negate instead.
 */
class JImageFilterNegate extends Joomla\Image\Filter\Negate {}

/**
 * @deprecated 5.0 Use Joomla\Image\Filter\Sketchy instead.
 */
class JImageFilterSketchy extends Joomla\Image\Filter\Sketchy {}

/**
 * @deprecated 5.0 Use Joomla\Image\Filter\Smooth instead.
 */
class JImageFilterSmooth extends Joomla\Image\Filter\Smooth {}
avatar PhilETaylor PhilETaylor - open - 15 Aug 2021
avatar joomla-cms-bot joomla-cms-bot - change - 15 Aug 2021
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 15 Aug 2021
avatar PhilETaylor PhilETaylor - change - 15 Aug 2021
The description was changed
avatar PhilETaylor PhilETaylor - edited - 15 Aug 2021
avatar PhilETaylor
PhilETaylor - comment - 15 Aug 2021

@wilsonge A mutual anonymous friend states: "This is a release blocker. The stub generator uses the classmap aliases to generate the stub file, which means the B/C layer for renamed/removed classes is incorrect and B/C is broken by aliasing to non-existent classes."

avatar wilsonge
wilsonge - comment - 15 Aug 2021

I think your version of the stubs file must be old or something? For example JFilesystemWrapperFile isn't in the classmap file or my generated stubs file? The image ones in the latest classmap file also correctly map to the CMS now https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/classmap.php#L457-L465

avatar PhilETaylor
PhilETaylor - comment - 15 Aug 2021

I guess we will never know.

I have just manually run stubGenerator.php (Im in a different location, different mac today) and the stubs.php file generated has PHP errors in it now.

PHP Parse error:  syntax error, unexpected fully qualified name "\Joomla\CMS\Crypt\CipherInterface", expecting identifier in /Users/phil/Sites/JOOMLA/joomla4/stubs.php on line 1960

Parse error: syntax error, unexpected fully qualified name "\Joomla\CMS\Crypt\CipherInterface", expecting identifier in /Users/phil/Sites/JOOMLA/joomla4/stubs.php on line 1960

Screenshot 2021-08-15 at 19 11 44

Screenshot 2021-08-15 at 19 11 54

Screenshot 2021-08-15 at 19 12 28

Screenshot 2021-08-15 at 19 12 43

Screenshot 2021-08-15 at 19 12 56

avatar wilsonge
wilsonge - comment - 15 Aug 2021

I mean remember stubs is just a file for developers to get typehints with because IntelliJ/vscode don’t understand the class map. So the final class extensions is totally fine.

The other part is I don’t think it likes the class name being a namespace for the extends. Not really sure what the workaround is in a php file I guess a namespace section within the file. But that’s just a bug in the way the stub map is generated as a cheap workaround. The class map itself is sound. Definitely a nice to fix though

avatar PhilETaylor PhilETaylor - change - 15 Aug 2021
Status New Closed
Closed_Date 0000-00-00 00:00:00 2021-08-15 19:02:04
Closed_By PhilETaylor
avatar PhilETaylor PhilETaylor - close - 15 Aug 2021
avatar wilsonge
wilsonge - comment - 15 Aug 2021

Fixes for the namespaced classes #35144

Add a Comment

Login with GitHub to post a comment