Class aliases

Local plugins ::: local_classalias
Maintained by Mark Sharp
Development utility for users of VSCode. Aliased classes are not picked up by VSCode, so this prevents VSCode red-lining valid code.

Class aliases 2.1

Moodle 5.1
Released: lundi 6 octobre 2025, 17:47

Class Aliases

This is intended for development purposes only. Do not use on Production sites; it's not needed.

Moodle has started namespacing lots of old classes using the class_alias function.

Trouble is VSCode doesn't recognise these class aliases as they are only parsed at runtime (apparently this isn't a problem in PHPStorm), this will mean that VSCode will red-underline these classes.

To work-around this, this plugin uses "extends" to map the old class name with the new one. It isn't intended for the code to see these extends, so they are simply listed in a file that is not read. VScode will pick up on the extends and won't show the red underline anymore.

Eventually, these class_alias mappings will be dropped, so do migrate any instances you find in your code, rather than relying on this mapping.

Version information

Version build number
2025092901
Version release name
2.1
Maturity
Version stable
MD5 Sum
64316a690760d4512bde1e61c821f540
Supported software
Moodle 5.1
  • Latest release for Moodle 5.1

Version control information

Version control system (VCS)
GIT
VCS repository URL
VCS tag
v2.1

Default installation instructions for plugins of the type Local plugins

  1. Make sure you have all the required versions.
  2. Download and unpack the module.
  3. Place the folder in the "local" subdirectory.
  4. Visit http://yoursite.com/admin to finish the installation.