Handle newly added deprecation skip of "%Method "[^"]+" might add "[^"]+" as a native return type declaration in the future. Do the same in (child class|implementation) "Drupal\\[^"]+" now to avoid errors or add an explicit @return annotation to suppress"

Created on 29 January 2023, almost 2 years ago

Problem/Motivation

In πŸ“Œ Use PHP attributes instead of doctrine annotations Fixed we added a new deprecation skip:

%Method "[^"]+" might add "[^"]+" as a native return type declaration in the future. Do the same in (child class|implementation) "Drupal\\[^"]+" now to avoid errors or add an explicit @return annotation to suppress this message%

The comments at the time of addition were:

@longwave:

Why is this required? The previous line explicitly excludes Drupal classes from the deprecation skip - but we own the Drupal namespace so we should be able to fix all cases?
Edited by Dave Long 1 week ago

@mondrake:

Yes, I was getting errors like

PHPUnit 9.5.26 by Sebastian Bergmann and contributors.

Testing Drupal\Tests\Core\Plugin\Context\ContextDefinitionIsSatisfiedTest
.........                                                           9 / 9 (100%)

Time: 00:00.139, Memory: 6.00 MB

OK (9 tests, 9 assertions)

Remaining self deprecation notices (10)

  1x: Method "Symfony\Component\Validator\Constraint::getDefaultOption()" might add "?string" as a native return type declaration in the future. Do the same in child class "Drupal\Core\Validation\Plugin\Validation\Constraint\ValidKeysConstraint" now to avoid errors or add an explicit @return annotation to suppress this message.
    1x in ContextDefinitionIsSatisfiedTest::testIsSatisfiedBy from Drupal\Tests\Core\Plugin\Context

  1x: Method "Symfony\Component\Validator\Constraint::getRequiredOptions()" might add "array" as a native return type declaration in the future. Do the same in child class "Drupal\Core\Validation\Plugin\Validation\Constraint\ValidKeysConstraint" now to avoid errors or add an explicit @return annotation to suppress this message.
    1x in ContextDefinitionIsSatisfiedTest::testIsSatisfiedBy from Drupal\Tests\Core\Plugin\Context

  1x: Method "Symfony\Component\Validator\Constraint::validatedBy()" might add "string" as a native return type declaration in the future. Do the same in child class "Drupal\Core\Validation\Plugin\Validation\Constraint\UuidConstraint" now to avoid errors or add an explicit @return annotation to suppress this message.
    1x in ContextDefinitionIsSatisfiedTest::testIsSatisfiedBy from Drupal\Tests\Core\Plugin\Context

and did not want to start changing typehint signatures in Drupal methods, but of course we might. Not sure why this was not showing up earlier.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ“Œ Task
Status

Postponed

Version

10.1 ✨

Component
BaseΒ  β†’

Last updated about 20 hours ago

Created by

πŸ‡³πŸ‡±Netherlands spokje

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024