User tests: Successful: Unsuccessful:
A side effect of using lowercased aliases in JLoader
to cope with class aliasing issues, the log messages now also used the lowercased aliased name, and that just makes the log messages a little hard to read. This PR changes JLoader::registerAlias()
so that the lowercased alias is stored as a separate variable, making the original alias (with proper casing) available in the deprecation tracker.
Code review, check deprecation logs (must have this enabled, options in log plugin) for class name casing.
JCacheExceptionConnecting has been aliased to Joomla\CMS\Cache\Exception\CacheConnectingException and the former class name is deprecated. The alias will be removed in 5.0
jcacheexceptionconnecting has been aliased to Joomla\CMS\Cache\Exception\CacheConnectingException and the former class name is deprecated. The alias will be removed in 5.0
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Not related to this but StubGenerator still generate class name is lower case :(
It's because it uses the $classAlias
property which is written to with lowercased aliases. FWIW Nicholas' tool just parses out the libraries/classmap.php
file to get a list of classes, so he's not really using the API either and the output from his tool is fine (but he's also supporting more versions with his tool and all the API pieces aren't consistently there).
StubGenerator may be able to be updated to use JLoader::getDeprecatedAliases()
as that would have the correctly cased aliases and it would allow us to generate a stub class doc block with a @deprecated <version>
tag so that IDEs also report the aliases as deprecated (this was one of the complaints I had seen about our script that Nicholas' tool addresses).
Yes, use JLoader::getDeprecatedAliases() solves that issue, thanks
public function doExecute()
{
$file = "<?php\n";
foreach (JLoader::getDeprecatedAliases() as $deprecation)
{
$oldName = $deprecation['old'];
$newName = $deprecation['new'];
// Figure out if the alias is for a class or interface
$reflection = new ReflectionClass($newName);
$type = $reflection->isInterface() ? 'interface' : 'class';
$modifier = ($reflection->isAbstract() && !$reflection->isInterface()) ? 'abstract ' : '';
$file .= "$modifier$type $oldName extends $newName {}\n";
}
// And save the file locally
file_put_contents(JPATH_ROOT . '/stubs.php', $file);
$this->out('Stubs file written', true);
}
Status | Pending | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-12-23 15:55:25 |
Closed_By | ⇒ | mbabker | |
Labels |
Added:
?
|
I have tested this item✅ successfully on 8bac562
Deprecation logging shows class name in correct case now. Also, navigate to random pages and it is still working as expected
Not related to this but StubGenerator still generate class name is lower case :(
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/19050.