Loading
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 (inprocessConfigWithPatterns()andthemeHasFlag()) now use\Drupal\Component\Serialization\Yaml::decode(), per the PHPStan rule. - Their
Symfony\Component\Yaml\Exception\ParseExceptioncatch clauses now catch\Drupal\Component\Serialization\Exception\InvalidDataTypeException(the exceptionYaml::decode()throws). - The unrelated
Yaml::dump($data)call inprocessConfigWithPatterns()is untouched in behavior — since Drupal core'sYaml::decode()/encode()wrapper has nodump()method, that call now goes throughSymfony\Component\Yaml\Yamlunder an explicitSymfonyYamlalias, 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