fix: #3611854 Use Drupal\Component\Serialization\Yaml::decode() instead of Symfony Yaml::parse()

This fixes the PHPStan drupal.symfonyYamlParse rule failures in src/EventSubscriber/ActiveThemeChangeSubscriber.php, which currently block every new pipeline on the 4.0.x branch — including MR !46 on issue #3611182, which does not touch this file.

What changed

  • The two Symfony\Component\Yaml\Yaml::parse() calls (in processConfigWithPatterns() and themeHasFlag()) now use \Drupal\Component\Serialization\Yaml::decode(), per the PHPStan rule.
  • Their Symfony\Component\Yaml\Exception\ParseException catch clauses now catch \Drupal\Component\Serialization\Exception\InvalidDataTypeException (the exception Yaml::decode() throws).
  • The unrelated Yaml::dump($data) call in processConfigWithPatterns() is untouched in behavior — since Drupal core's Yaml::decode()/encode() wrapper has no dump() method, that call now goes through Symfony\Component\Yaml\Yaml under an explicit SymfonyYaml alias, so its output format is unchanged.

No other behavior, logging text, or logic changes.

Issue: https://www.drupal.org/project/varbase_components/issues/3611854

AI-Generated: Yes (Used Claude Code to identify the two drupal.symfonyYamlParse PHPStan failures and rewrite the calls/catch clauses; reviewed by Natshah.)

Checkpoints

  • File an issue about this project
  • Addition/Change/Update/Fix to this project
  • Testing to ensure no regression
  • Automated unit/functional testing coverage
  • Developer Documentation support on feature change/addition
  • User Guide Documentation support on feature change/addition
  • UX/UI designer responsibilities
  • Accessibility and Readability
  • Reviewed by a human
  • Code review by maintainers
  • Full testing and approval
  • Credit contributors
  • Review with the product owner
  • Update Release Notes
  • Release
Edited by Rajab Natshah

Merge request reports

Loading
Loading