Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
@internal
fields
andinclude
.RequestCacheabilityDependency::getQueryParamCacheContextList()
, because that can now be read fromJsonApiSpec::getReservedQueryParameters()
Comment #3
Wim LeersNote that #2 passes tests, so
RequestCacheabilityDependencyTest
passes. But that test really is pretty pointless. So, removing it.Comment #4
Wim LeersIn fact, we can remove
RequestCacheabilityDependency
altogether. 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.