Missing Return Type Declarations in Functions Causing Errors in Submodule openai_devel

Created on 13 May 2024, about 1 month ago
Updated 27 May 2024, 30 days ago

Dear maintainers,
I encountered an issue with the OpenAI module. When attempting to access the route admin/config/development/generate/content-gpt, I encountered fatal errors due to missing return type declarations in several functions. Below are the errors I encountered

1.Fatal error: Declaration of Drupal\openai_devel\Plugin\DevelGenerate\ContentGPTDevelGenerate::create(Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) must be compatible with Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::create(Symfony\Component\DependencyInjection\ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition): static in /var/www/html/web/modules/contrib/openai/modules/openai_devel/src/Plugin/DevelGenerate/ContentGPTDevelGenerate.php on line 48

2.Fatal error: Declaration of Drupal\openai_devel\Plugin\DevelGenerate\ContentGPTDevelGenerate::settingsForm(array $form, Drupal\Core\Form\FormStateInterface $form_state) must be compatible with Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::settingsForm(array $form, Drupal\Core\Form\FormStateInterface $form_state): array in /var/www/html/web/modules/contrib/openai/modules/openai_devel/src/Plugin/DevelGenerate/ContentGPTDevelGenerate.php on line 57

3.Fatal error: Declaration of Drupal\openai_devel\Plugin\DevelGenerate\ContentGPTDevelGenerate::settingsForm(array $form, Drupal\Core\Form\FormStateInterface $form_state) must be compatible with Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::settingsForm(array $form, Drupal\Core\Form\FormStateInterface $form_state): array in /var/www/html/web/modules/contrib/openai/modules/openai_devel/src/Plugin/DevelGenerate/ContentGPTDevelGenerate.php on line 57

4.Fatal error: Declaration of Drupal\openai_devel\Plugin\DevelGenerate\ContentGPTDevelGenerate::validateDrushParams(array $args, array $options = []) must be compatible with Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::validateDrushParams(array $args, array $options = []): array in /var/www/html/web/modules/contrib/openai/modules/openai_devel/src/Plugin/DevelGenerate/ContentGPTDevelGenerate.php on line 162

5.Fatal error: Declaration of Drupal\openai_devel\Plugin\DevelGenerate\ContentGPTDevelGenerate::isBatch($content_count, $comment_count) must be compatible with Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::isBatch(int $content_count, int $comment_count): bool in /var/www/html/web/modules/contrib/openai/modules/openai_devel/src/Plugin/DevelGenerate/ContentGPTDevelGenerate.php on line 202

6.Fatal error: Declaration of Drupal\openai_devel\Plugin\DevelGenerate\ContentGPTDevelGenerate::isBatch($content_count, $comment_count) must be compatible with Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::isBatch(int $content_count, int $comment_count): bool in /var/www/html/web/modules/contrib/openai/modules/openai_devel/src/Plugin/DevelGenerate/ContentGPTDevelGenerate.php on line 202

7.Fatal error: Declaration of Drupal\openai_devel\Plugin\DevelGenerate\ContentGPTDevelGenerate::develGenerateContentAddNode(array &$results) must be compatible with Drupal\devel_generate\Plugin\DevelGenerate\ContentDevelGenerate::develGenerateContentAddNode(array &$results): void in /var/www/html/web/modules/contrib/openai/modules/openai_devel/src/Plugin/DevelGenerate/ContentGPTDevelGenerate.php on line 212

By adding the required return type declarations, I was able to resolve the issue and access the route successfully.

I have created a merge request to address this issue. Please review it at your earliest convenience.

Thank you.

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.69.0 2024