Skip to content

Commit

Permalink
ENH Do not emit deprecation notices for supported modules by default
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Oct 17, 2024
1 parent 9c9b743 commit cd93a15
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"symfony/finder": "^6.1",
"symfony/yaml": "^6.1",
"marcj/topsort": "^2.0.0",
"psr/simple-cache": "^3.0.0"
"psr/simple-cache": "^3.0.0",
"silverstripe/framework": "^5.4.0"
},
"require-dev": {
"phpunit/phpunit": "^9.6",
Expand Down
8 changes: 7 additions & 1 deletion src/Transformer/YamlTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Exception;
use Closure;
use SilverStripe\Config\Collections\MemoryConfigCollection;
use SilverStripe\Dev\Deprecation;

class YamlTransformer implements TransformerInterface
{
Expand Down Expand Up @@ -135,6 +136,9 @@ private function checkForDeprecatedConfig(array $document, MutableConfigCollecti
if (!($collection instanceof MemoryConfigCollection)) {
return;
}
if ($document['inSupportedModule'] && !Deprecation::getShowNoticesCalledFromSupportedCode()) {
return;
}
foreach ($document['content'] as $key => $value) {
if (!is_array($value)) {
continue;
Expand Down Expand Up @@ -240,8 +244,10 @@ protected function getNamedYamlDocuments()
);
}

$filename = $document['filename'];
$documents[$header['name']] = [
'filename' => $document['filename'],
'filename' => $filename,
'inSupportedModule' => Deprecation::fileIsInSupportedModule($filename),
'header' => $header,
'content' => $content,
];
Expand Down

0 comments on commit cd93a15

Please sign in to comment.