Pronovix / swagger_ui_formatter

Swagger UI Field Formatter for Drupal
GNU General Public License v2.0
3 stars 12 forks source link

Declaration must be compatible with SwaggerUIFormatterTrait #70

Closed Mint1700 closed 3 years ago

Mint1700 commented 3 years ago

Hello,

I've got this error using thig module :

Fatal error: Declaration of Drupal\swagger_ui_formatter\Plugin\Field\FieldFormatter\SwaggerUIFileFormatter::getSwaggerFileUrlFromField(Drupal\Core\Field\FieldItemInterface $field_item, array $context = []) must be compatible with Drupal\swagger_ui_formatter\Plugin\Field\FieldFormatter\SwaggerUIFormatterTrait::getSwaggerFileUrlFromField(Drupal\Core\Field\FieldItemInterface $field_item, array $context = []): ?string in ..../web/modules/contrib/swagger_ui_formatter/src/Plugin/Field/FieldFormatter/SwaggerUIFileFormatter.php on line 128

I added :?string on line 128 of SwaggerUIFileFormatter.php after the declaration of the function and everything works fine now.

mxr576 commented 3 years ago

Thanks for the report @Mint1700 , I have already created a PR with the proposed fix which makes sense.