Skip to content

Support scssphp 2.0 – Remove usage of removed getParsedFiles() method #715

Open
@Be-Mann

Description

Description:
When using scssphp version 2.0 with mrclay/minify, a fatal error is thrown due to a call to the now-removed method getParsedFiles() in the ScssPhp\ScssPhp\Compiler class. This issue prevents projects from using the latest version of scssphp.


Error Messages:

  • Fatal Error with scssphp 2.0:

    Fatal error: Uncaught Error: Call to undefined method ScssPhp\ScssPhp\Compiler::getParsedFiles() in /app/vendor/mrclay/minify/lib/Minify/ScssCssSource.php:161
    Stack trace:
    #0 /app/vendor/mrclay/minify/lib/Minify/ScssCssSource.php(101): Minify_ScssCssSource->compile('/app/include/sc...')
    #1 /app/vendor/mrclay/minify/lib/Minify/ScssCssSource.php(41): Minify_ScssCssSource->getCache()
    #2 /app/vendor/mrclay/minify/lib/Minify/HTML/Helper.php(155): Minify_ScssCssSource->getLastModified()
    #3 /app/vendor/mrclay/minify/lib/Minify/HTML/Helper.php(96): Minify_HTML_Helper::getLastModified(Array)
    #4 /app/vendor/mrclay/minify/lib/Minify/HTML/Helper.php(49): Minify_HTML_Helper->setFiles(Array, true)
    #5 /app/vendor/mrclay/minify/utils.php(40): Minify_HTML_Helper::getUri(Array, Array)
    #6 /app/core/html-head.php(54): Minify_getUri(Array)
    #7 /app/include/login.php(466): include_once('/app/core/html-...')
    #8 /app/core/site.php(423): include_once('/app/include/lo...')
    #9 /app/index.php(62): include_once('/app/core/site....')
    #10 {main}
    thrown in /app/vendor/mrclay/minify/lib/Minify/ScssCssSource.php on line 161
    
  • Deprecation Warnings with scssphp 1.12:

    Deprecated: ScssPhp\ScssPhp\Compiler::multiplyMedia(): Implicitly marking parameter $env as nullable is deprecated, the explicit nullable type must be used instead in /app/vendor/scssphp/scssphp/src/Compiler.php on line 5039
    
    Deprecated: ScssPhp\ScssPhp\Compiler::pushEnv(): Implicitly marking parameter $block as nullable is deprecated, the explicit nullable type must be used instead in /app/vendor/scssphp/scssphp/src/Compiler.php on line 5131
    
    Deprecated: ScssPhp\ScssPhp\Compiler::set(): Implicitly marking parameter $env as nullable is deprecated, the explicit nullable type must be used instead in /app/vendor/scssphp/scssphp/src/Compiler.php on line 5195
    
    Deprecated: ScssPhp\ScssPhp\Compiler::get(): Implicitly marking parameter $env as nullable is deprecated, the explicit nullable type must be used instead in /app/vendor/scssphp/scssphp/src/Compiler.php on line 5301
    
    Deprecated: ScssPhp\ScssPhp\Compiler::has(): Implicitly marking parameter $env as nullable is deprecated, the explicit nullable type must be used instead in /app/vendor/scssphp/scssphp/src/Compiler.php on line 5366
    
    Deprecated: ScssPhp\ScssPhp\Parser::__construct(): Implicitly marking parameter $cache as nullable is deprecated, the explicit nullable type must be used instead in /app/vendor/scssphp/scssphp/src/Parser.php on line 143
    
    Deprecated: ScssPhp\ScssPhp\Parser::__construct(): Implicitly marking parameter $logger as nullable is deprecated, the explicit nullable type must be used instead in /app/vendor/scssphp/scssphp/src/Parser.php on line 143
    
    Deprecated: ScssPhp\ScssPhp\Node\Number::output(): Implicitly marking parameter $compiler as nullable is deprecated, the explicit nullable type must be used instead in /app/vendor/scssphp/scssphp/src/Node/Number.php on line 571
    
    Deprecated: ScssPhp\ScssPhp\Formatter::format(): Implicitly marking parameter $sourceMapGenerator as nullable is deprecated, the explicit nullable type must be used instead in /app/vendor/scssphp/scssphp/src/Formatter.php on line 275
    
    Deprecated: ScssPhp\ScssPhp\Warn::setCallback(): Implicitly marking parameter $callback as nullable is deprecated, the explicit nullable type must be used instead in /app/vendor/scssphp/scssphp/src/Warn.php on line 62
    

Steps to Reproduce:

  1. Install mrclay/minify in your project.
  2. Install scssphp/scssphp version 2.0.
  3. Trigger SCSS processing (e.g., by accessing the compiled CSS).
  4. Observe the fatal error caused by the call to getParsedFiles().

Expected Behavior:
mrclay/minify should be updated to be compatible with scssphp 2.0. Either the call to getParsedFiles() must be removed or replaced with equivalent functionality provided by scssphp 2.0, ensuring that the SCSS compilation and caching mechanism works correctly.


Temporary Workaround:
Using scssphp version 1.12 avoids the fatal error (since the method exists) but produces deprecation warnings, which may become problematic with future PHP versions. This workaround is only viable until a permanent fix is implemented.


Possible Solutions:

  • Investigate the New API:
    Review the scssphp 2.0 documentation to determine if there is an alternative method or mechanism that can replace getParsedFiles() for tracking parsed files or handling caching.

  • Conditional Method Call:
    Implement a conditional check in Minify/ScssCssSource.php to verify if the method getParsedFiles() exists before calling it. If not available, fallback to an alternative approach or simply bypass that caching step.

  • Alternative Caching Mechanism:
    Consider refactoring the caching mechanism in mrclay/minify to use a different strategy that does not rely on the removed method, possibly by leveraging features directly available in scssphp 2.0.


Additional Context:

  • scssphp 2.0 includes several breaking changes compared to the 1.x versions.
  • The removal of getParsedFiles() is one of these breaking changes, directly affecting mrclay/minify’s SCSS processing functionality.
  • Ensuring compatibility with the latest dependencies is important for long-term maintenance, security, and performance.

Thank you for your time and consideration in updating mrclay/minify for compatibility with scssphp 2.0. Any guidance or contributions to resolve this issue would be greatly appreciated!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions