Follow-up to #2829328: Clean up Drupal\jsonapi\Access\CustomParameterNames and make it follow the spec more closely.
Reduced duplication, improved maintainability
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | interdiff-2846659.txt | 1.01 KB | dawehner |
| #11 | 2846659-11.patch | 5.73 KB | dawehner |
| #10 | 2846659-10.patch | 6.1 KB | wim leers |
Comments
Comment #2
wim leersThis:
JsonApiSpec@internalfieldsandinclude.RequestCacheabilityDependency::getQueryParamCacheContextList(), because that can now be read fromJsonApiSpec::getReservedQueryParameters()Comment #3
wim leersNote that #2 passes tests, so
RequestCacheabilityDependencyTestpasses. But that test really is pretty pointless. So, removing it.Comment #4
wim leersIn fact, we can remove
RequestCacheabilityDependencyaltogether. It was only being used in one place:\Drupal\jsonapi\Normalizer\Value\JsonApiDocumentTopLevelNormalizerValue::__construct().I'm not convinced that's entirely the correct place, but that's a problem for later. What matters most right now, is that we have less duplication, and also one less class that is rather strange-looking.
Comment #6
wim leers#2829328: Clean up Drupal\jsonapi\Access\CustomParameterNames and make it follow the spec more closely is in, we can continue here.
Comment #7
dawehnerAn array_map got replaced by a foreach :(
Comment #8
wim leers#4 causes
\Drupal\Core\Cache\RefinableCacheableDependencyTrait::addCacheContexts()to be called, which callsCache::mergeContexts(), which uses the cache contexts manager. That's what's causing this to fail.Comment #9
wim leers#7: let's convert this to an
array_map()then :)Comment #10
wim leersDone.
Comment #11
dawehnerLet's go back to using no side effects inside the
array_map.Comment #12
wim leersLOL of course. Thanks.
Wim--
Comment #14
e0ipsoThis was merged.