Skip to content
Snippets Groups Projects

Issue #3338328: Update to Symfony 6.3

Closed spokje requested to merge issue/drupal-3338328:3338328-update-to-symfony into 10.1.x
3 unresolved threads

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • spokje
  • spokje resolved all threads

    resolved all threads

  • spokje added 1 commit

    added 1 commit

    Compare with previous version

  • spokje added 29 commits

    added 29 commits

    Compare with previous version

  • spokje added 1 commit

    added 1 commit

    Compare with previous version

  • Wim Leers
    Wim Leers @wimleers started a thread on the diff
  • 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 make getSupportedTypes() also abstract?

      Nope, on second thought, this is unfortunate yet accurate. Introducing a new abstract method would be a BC break. All good. :thumbsup:

    • 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.

    • Please register or sign in to reply
  • 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);
    • Is __NAMESPACE__ correct here instead of __CLASS__ and/or __FUNCTION__? It seems like this should read one of those and then ::hasCacheableSupportsMethod appended? Or am I missing something?

    • Please register or sign in to reply
  • 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 ];
  • closed

  • Please register or sign in to reply
    Loading