Issue #3338328: Update to Symfony 6.3
3 unresolved threads
Merge request reports
Activity
- Resolved by spokje
- Resolved by spokje
added 29 commits
-
12762970...a0db6dfb - 27 commits from branch
project:10.1.x
- a5048e69 - First stab.
- 5ca9422f - v6.3.0-BETA2
-
12762970...a0db6dfb - 27 commits from branch
103 102 * {@inheritdoc} 104 103 */ 105 104 public function hasCacheableSupportsMethod(): bool { 105 @trigger_error(__NAMESPACE__ . '\hasCacheableSupportsMethod is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Instead, use ' . __NAMESPACE__ . 'getSupportedTypes. See https://www.drupal.org/project/drupal/issues/123', E_USER_DEPRECATED); 106 106 107 return FALSE; 107 108 } 108 109 110 /** 111 * {@inheritdoc} 112 */ 113 public function getSupportedTypes(?string $format): array { 114 return [ 115 '*' => FALSE, 116 ]; Based on https://github.com/symfony/symfony/pull/49291#pullrequestreview-1332553800 and the docs:
* The special type '*' can be used to indicate that the denormalizer might * support any types. A null value means that the denormalizer does not support * the corresponding type.
I believe that this change is wrong/misleading. This is claiming that this class supports any type (which it doesn't) and that the result is not cacheable. Would it not be better to makegetSupportedTypes()
also abstract?Nope, on second thought, this is unfortunate yet accurate. Introducing a new abstract method would be a BC break. All good.
Could we do something like this, and avoid all the boilerplate on the extending classes?
return !empty($this->supportedInterfaceOrClass) ? array_map(fn () => TRUE, array_flip((array) $this->supportedInterfaceOrClass)) : ['*' => FALSE];
(Note I just whipped this up, there might be a more elegant way, not sure if it works, but you get the idea. Use the existing property.
25 25 * {@inheritdoc} 26 26 */ 27 27 public function hasCacheableSupportsMethod(): bool { 28 @trigger_error(__NAMESPACE__ . '\hasCacheableSupportsMethod is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Instead, use ' . __NAMESPACE__ . 'getSupportedTypes. See https://www.drupal.org/project/drupal/issues/123', E_USER_DEPRECATED); 36 36 * {@inheritdoc} 37 37 */ 38 38 public function hasCacheableSupportsMethod(): bool { 39 @trigger_error(__NAMESPACE__ . '\hasCacheableSupportsMethod is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Instead, use ' . __NAMESPACE__ . 'getSupportedTypes. See https://www.drupal.org/project/drupal/issues/123', E_USER_DEPRECATED); 40 39 41 return TRUE; 40 42 } 41 43 44 /** 45 * {@inheritdoc} 46 */ 47 public function getSupportedTypes(?string $format): array { 48 return [ 49 ConfigEntityInterface::class => TRUE, 50 ];
Please register or sign in to reply