Closed (fixed)
Project:
Scheduler
Version:
2.x-dev
Component:
Coding Standards
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
1 Aug 2024 at 11:55 UTC
Updated:
27 Aug 2024 at 13:14 UTC
Jump to comment: Most recent
PHPunit tests at Next Major give the following error:
Method "Symfony\Component\EventDispatcher\EventSubscriberInterface::getSubscribedEvents()" might add "array" as a native return type declaration in the future. Do the same in implementation "Drupal\scheduler_api_test\EventSubscriber" now to avoid errors or add an explicit @return annotation to suppress this message.
Triggered by: Drupal\Tests\scheduler\Functional\SchedulerEventsTest::testNodeEvents
Next Major (D11) composer shows symfony/event-dispatcher (v7.1.1)
Current and Next Minor (D10) composer jobs show symfony/event-dispatcher (v6.4.8)
Add return type hint array to the EventSubscriber definition
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
jonathan1055 commentedWithout this fix, group 'scheduler' has this error 24 x for "Drupal\entity\EventSubscriber\EntityDuplicateSubscriber"
'scheduler_api' has 7 (4 for Drupal\entity\EventSubscriber\EntityDuplicateSubscriber, 3 for Drupal\scheduler_api_test\EventSubscriber)
javascript tests has 2 x Drupal\entity\EventSubscriber\EntityDuplicateSubscriber
rules tests shows none, but that could be because the module can't be installed.
kernel has none.
With the correction, the scheduler_api test no longer has the 3 errors for scheduler_api_test\EventSubscriber, but still just has the 4 that are for Drupal\entity\EventSubscriber\EntityDuplicateSubscriber. The main scheduler group still has the 24 errors for Drupal\entity\EventSubscriber. This is the core module, so why has that not been fixed?
Comment #4
jonathan1055 commentedThe "entity" module is contrib not core - known as Entity API
This is the line which is causing the deprecation warnings in the tests
https://git.drupalcode.org/project/entity/-/blob/8.x-1.x/src/EventSubscr...
I have raised #3465393: Add 'array' return type in Drupal\entity\EventSubscriber\EntityDuplicateSubscriber
Comment #5
jonathan1055 commentedIn the last commit, using the repo from Entity API mr35, the deprecation errors have all been removed. Composer Next Major has
drupal/entity (dev-3465393-EntityDuplicateSubscriber-array-return 4aef0ed)which shows that the MR repo is being used.Comment #7
jonathan1055 commentedI decided to commit this as-is. There is no need to wait until #3465393: Add 'array' return type in Drupal\entity\EventSubscriber\EntityDuplicateSubscriber is committed. When that does happen, the composer_next_major.json may cause a problem, in which case it can be modified to use the dev branch of Entity instead of the MR.
But for now, this fixes lots of errors in the Next Major test, and is a big step forward in getting clean PHPUnit tests, and hence readable and usable logs (not filled with error messages)
Comment #10
jonathan1055 commentedBackported to 8.x-1.x
Drupal 11 PHPUnit and PHPstan jobs are now all green for 8.x-1.x