Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #31395 [Cache] Log a more readable message when trying to cache…
… an unsupported type (Deuchnord) This PR was merged into the 4.3 branch. Discussion ---------- [Cache] Log a more readable message when trying to cache an unsupported type | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes <!-- don't forget to update src/**/CHANGELOG.md files --> | BC breaks? | no <!-- see https://symfony.com/bc --> | Deprecations? | no <!-- don't forget to update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tests pass? | yes <!-- please add some, will be required by reviewers --> | Fixed tickets | #29710 <!-- #-prefixed issue number(s), if any --> | License | MIT | Doc PR | Improved the warning risen when trying to save something that has a non-supported type in the Simple cache. For instance, let's say the following code: ```php class TestCommand extends Command { private $cache; public function __construct(CacheInterface $cache) { parent::__construct(); $this->cache = $cache; } // ... protected function execute(InputInterface $input, OutputInterface $output) { $n = $this->cache->get('n', function () { return function () { return rand(0,10); }; }); dump($n()); } } ``` Running this code will give the following: ``` 14:32:03 WARNING [cache] Could not save key "n" in cache: the Closure type is not supported. 0 ``` Commits ------- 21ba3c0 [Cache] Log a more readable error message when saving into cache fails
- Loading branch information
Showing
3 changed files
with
10 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters