From: Tim Düsterhus Date: Tue, 30 Jun 2020 07:30:09 +0000 (+0200) Subject: Add compatibility layer from leafo/scssphp to scssphp/scssphp X-Git-Tag: 5.3.0_Alpha_1~150^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9bfa7303627983c13607536aae839e7e0ebb0968;p=GitHub%2FWoltLab%2FWCF.git Add compatibility layer from leafo/scssphp to scssphp/scssphp The basic usage of this compatibility layer appears to work well: A CSS file can be compiled from the default style, without needing any additional adjustments. What this compatibility layer cannot do is rewrite the Exceptions that are thrown by scssphp/scssphp. A strict catch block catching a specific Exception, such as `\Leafo\ScssPhp\Exception\ParserException` will not match the aliased `ScssPhp\ScssPhp\Exception\ParserException`. Resolves #3398 --- diff --git a/wcfsetup/install/files/lib/core.functions.php b/wcfsetup/install/files/lib/core.functions.php index 6e53aacb03..adfe6593a2 100644 --- a/wcfsetup/install/files/lib/core.functions.php +++ b/wcfsetup/install/files/lib/core.functions.php @@ -17,6 +17,16 @@ namespace { // set autoload function spl_autoload_register([WCF::class, 'autoload']); + spl_autoload_register(function ($className) { + /** + * @deprecated 5.3 This file is a compatibility layer mapping from Leafo\\ to ScssPhp\\ + */ + $leafo = 'Leafo\\'; + if (substr($className, 0, strlen($leafo)) === $leafo) { + class_alias('ScssPhp\\'.substr($className, strlen($leafo)), $className, true); + } + }); + /** * Escapes a string for use in sql query. * diff --git a/wcfsetup/install/files/lib/system/style/scssphp/scss.inc.php b/wcfsetup/install/files/lib/system/style/scssphp/scss.inc.php index c7038bfcd4..2916dee430 100644 --- a/wcfsetup/install/files/lib/system/style/scssphp/scss.inc.php +++ b/wcfsetup/install/files/lib/system/style/scssphp/scss.inc.php @@ -1,2 +1,5 @@