-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Node::getRevisionAuthor deprecation not detected #210
Comments
thanks for the report, @timwood! Can you provide a failing code sample? I have a feeling that PHPStan doesn't know that an object is actually a NodeInterface object, but if you added type hinting it would. I'd have a better idea after a sample |
Hi @mglaman. Not sure how complete of a code sample you need, but this is the one line I changed within a function in the - $params['nodeRevisionAuthor'] = $node->getRevisionAuthor()->getDisplayName();
+ $params['nodeRevisionUser'] = $node->getRevisionUser()->getDisplayName();
At the top we only had: use Drupal\Core\Entity\EntityInterface; As part of the fix I added: use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\RevisionLogInterface; |
@timwood that works. How is The quick fix whenever you get an entity from storage is to always do |
@mglaman /**
* Do some stuff
*
* @param Drupal\Core\Entity\EntityInterface $node
* The node being passed to the hook.
*/
function _function_name_obscured_to_protect_the_innocent(EntityInterface $node): void { |
I would update your function to replace |
Closing since the type hinting should fix, nothing much can be done in this library |
How is drupal-check installed?
drupal-check is installed as a dependency to my project with composer
Environment:
Describe the bug
Node::getRevisionAuthor
was deprecated in favor ofRevisionLogInterface::getRevisionUser
and removed in Drupal 9.0.0. This was reported in change record https://www.drupal.org/node/3069750 and is also mentioned on https://api.drupal.org/api/drupal/core%21modules%21node%21src%21Entity%21Node.php/function/Node%3A%3AgetRevisionAuthor/8.9.x.I also opened an issue on the Drupal Upgrade Status module on Drupal.org.
The text was updated successfully, but these errors were encountered: