- Issue created by @dtfabio
- π§πͺBelgium dtfabio Ninove
After testing on an existing site and briefly going through the views, I got the following error. This was because the parent execute function did not always return an empty array, it also returned NULL. To prevent this, I made the return type of the modules execute function nullable.
The website encountered an unexpected error. Please try again later. TypeError: Drupal\views_block_override\Plugin\views\display\ViewsBlockOverride::execute(): Return value must be of type array, null returned in Drupal\views_block_override\Plugin\views\display\ViewsBlockOverride->execute() (line 392 of modules/contrib/views_block_override/src/Plugin/views/display/ViewsBlockOverride.php).
- Issue was unassigned.
- Status changed to Needs review
over 1 year ago 11:32am 21 July 2023 - Status changed to Needs work
about 1 year ago 9:11am 12 October 2023 - π§πͺBelgium tim-diels Belgium π§πͺ
Just tested and still has errors on level 9:
------ ------------------------------------------------------------------------------------------------------------- Line src/Plugin/views/display/ViewsBlockOverride.php ------ ------------------------------------------------------------------------------------------------------------- 64 Method Drupal\views_block_override\Plugin\views\display\ViewsBlockOverride::__construct() has parameter $configuration with no value type specified in iterable type array. π‘ See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type 84 Method Drupal\views_block_override\Plugin\views\display\ViewsBlockOverride::create() has parameter $configuration with no value type specified in iterable type array. π‘ See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type 85 Unsafe usage of new static(). π‘ See: https://phpstan.org/blog/solving-phpstan-error-unsafe-usage-of-new-static 99 Method Drupal\views_block_override\Plugin\views\display\ViewsBlockOverride::defineOptions() return type has no value type specified in iterable type array. π‘ See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type 118 Method Drupal\views_block_override\Plugin\views\display\ViewsBlockOverride::blockSettings() has parameter $settings with no value type specified in iterable type array. π‘ See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type 118 Method Drupal\views_block_override\Plugin\views\display\ViewsBlockOverride::blockSettings() return type has no value type specified in iterable type array. π‘ See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type 177 Method Drupal\views_block_override\Plugin\views\display\ViewsBlockOverride::blockForm() has parameter $form with no value type specified in iterable type array. π‘ See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type 177 Method Drupal\views_block_override\Plugin\views\display\ViewsBlockOverride::blockForm() return type has no value type specified in iterable type array. π‘ See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type 302 Method Drupal\views_block_override\Plugin\views\display\ViewsBlockOverride::blockSubmit() has parameter $form with no value type specified in iterable type array. π‘ See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type 365 Method Drupal\views_block_override\Plugin\views\display\ViewsBlockOverride::execute() return type has no value type specified in iterable type array. π‘ See: https://phpstan.org/blog/solving-phpstan-no-value-type-specified-in-iterable-type ------ ------------------------------------------------------------------------------------------------------------- [ERROR] Found 10 errors
- Assigned to dtfabio
- Status changed to Active
11 months ago 8:16am 27 January 2024 - π§πͺBelgium dtfabio Ninove
dtfabio β changed the visibility of the branch 3374860-fix-phpstan-errors to hidden.
- π§πͺBelgium dtfabio Ninove
dtfabio β changed the visibility of the branch 3374860-fix-phpstan-errors to active.
- Issue was unassigned.
- Status changed to Needs work
11 months ago 3:49pm 27 January 2024 - π§πͺBelgium dtfabio Ninove
Hi Tim,
I tried to fix the last issues, but saw there were merge conflicts so wanted to merge the dev branch into my branch.
Had apparently accidentally used the 1.2.x branch where changes happened to it, preventing me from creating a working patch. I then tried to fix this, without success.
I finally decided to just make a new branch with the latest changes, only with this I still can't make a working patch. I don't immediately see what the problem is, so I just provided the code and maybe you know the reason?
Greetings,
Fabio
- πΊπ¦Ukraine Anna D
Added comments to the MR and honestly don't understand why I'm anonymous above.
- πΊπ¦Ukraine Anna D
Added .gitlab-ci for automated GitLab tests. Phpcs and phpstan pipelines still fails.
Hello @anna!!
I have solved the phpcs errors and tried to solve phpstan error but there is a error in code in use of elseif that is causing the another error.
I think that one need to be solved first.- π§πͺBelgium tim-diels Belgium π§πͺ
You should focus on fixing one task at a time to make it easier to follow up. You can create separate tasks to fix other things and I would suggest on doing so. I will then make some time to review tasks when they are split to simpler tasks.
- πΊπ¦Ukraine Anna D
Hello @tim-diels,
I didn't saw that the 1.0.x-dev version was targeted instead of 1.2.x-dev. I created a separate issue for GitLab CI/CD for 1.2.x-dev, and there are only two PHPStan errors:
Line src/Plugin/views/display/ViewsBlockOverride.php
------ ----------------------------------------------------------------------
181 \Drupal calls should be avoided in classes, use dependency injection
instead
198 \Drupal calls should be avoided in classes, use dependency injection
instead
------ ----------------------------------------------------------------------
[ERROR] Found 2 errorsI've created a separate issue specifically to address the dependency injection in the class. I'm not sure if you'd prefer to fix everything separately for 1.0.x-dev or just close this issue.