Problem/Motivation

PHPStorm finds multiple definitions for drupal_set_message:
- drupal_set_message in ./core/include/bootstrap.inc
- drupal_set_message in ./modules/pathauto/tests/src/Unit/VerboseMessengerTest.php

As a result, the function is not marked as deprecated in PHPStorm.

Proposed resolution

Do not try to (re-)declare the drupal_set_message function in VerboseMessengerTest.

Remaining tasks

  1. Write a patch
  2. Review
  3. Commit

User interface changes

drupal_set_message is flagged as deprecated in PHPStorm

API changes

None.

Data model changes

None.

Comments

idebr created an issue. See original summary.

berdir’s picture

This was necessary in the past, now we can update the service to use the messenger service.

vakulrai’s picture

Status: Active » Needs review
StatusFileSize
new661 bytes

@idebr adding a patch, which will remove drupal_set_message function in VerboseMessengerTest file.

Status: Needs review » Needs work

The last submitted patch, 3: phpstormdrupalsetmessage-2968718-3.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

berdir’s picture

Yes, you can not just remove the function, you need to remove the usage of it in VerboseMessenger and replace it with the service.

idebr’s picture

Status: Needs work » Needs review
StatusFileSize
new5.25 KB

Attached implements the following changes:

  1. Updates \Drupal\pathauto\VerboseMessenger to use the Drupal core messenger service
  2. Removes the duplicate drupal_set_message from \Drupal\Tests\pathauto\Unit\VerboseMessengerTest
  3. Fixes Drupal code styling in \Drupal\Tests\pathauto\Unit\VerboseMessengerTest

No interdiff with #3 since the approach is different from that patch.

Status: Needs review » Needs work

The last submitted patch, 6: pathauto-drupal_set_message_declaration-2968718-6.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

idebr’s picture

Status: Needs work » Needs review
StatusFileSize
new1.32 KB
new5.47 KB

Added CoreMessengerInterface to prevent confusion with \Drupal\pathauto\MessengerInterface

vakulrai’s picture

StatusFileSize
new1.34 KB

I have used use Drupal\Core\Messenger\MessengerInterface service.

The last submitted patch, 9: phpstormdrupalsetmessage-2968718-6.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

berdir’s picture

Status: Needs review » Needs work

Patch in #8 looks good, can we also put an explicit 8.5+ dependency to pathauto.info.yml?

idebr’s picture

Status: Needs work » Needs review
StatusFileSize
new294 bytes
new5.81 KB

#11 Added dependency to drupal:system (>= 8.5) based on a similar implementation in webform: #2885419: Upgrade to Drupal 8.3.x

  • Berdir committed 86f6a1d on 8.x-1.x authored by idebr
    Issue #2968718 by idebr, vakulrai: drupal_set_message function...
berdir’s picture

Status: Needs review » Fixed

Thanks, yeah, like that.

@vakulrai: Before starting to work on something, it makes sense to ask the issue author if he's working on it, especially if it's a very new issue. That said, would have been clearer if @idebr would have assigned the issue to himself to clarify that he is working on it. So I gave you issue credits despite your patches not being used.

idebr’s picture

@Berdir Thanks for your reviews and quick action. I'll make sure to assign an issue to myself in the future.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.