Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
When using bundle classes, if creating an object with MyCustomLibary::createFromParagraph
, type returned will be the interface, instead of the the called class.
Steps to reproduce
w PHPStan
$entity = MyCustomLibary::createFromParagraph();
\PHPStan\dumpType($libraryItem);
Outputs:
phpstan: Dumped type: Drupal\paragraphs_library\LibraryItemInterface
With changes, output is:
phpstan: Dumped type: Drupal\mymodule\MyCustomLibary
Issue fork paragraphs-3345127
Show commands
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
dpiComment #4
acbramley CreditAttribution: acbramley at PreviousNext for Service NSW commentedThanks @dpi!
Comment #7
BerdirMerged.