Skip to content
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

Add PHPStan #765

Merged
merged 4 commits into from
Jan 21, 2025
Merged

Add PHPStan #765

merged 4 commits into from
Jan 21, 2025

Conversation

paul121
Copy link
Collaborator

@paul121 paul121 commented Jan 8, 2025

WIP

Done! This is a start. Can continue improving PHPStan levels overtime

@paul121 paul121 added this to the 2.25.0 milestone Jan 21, 2025
@paul121 paul121 marked this pull request as ready for review January 21, 2025 21:20
@paul121
Copy link
Collaborator Author

paul121 commented Jan 21, 2025

Aghh. I forgot that the strict types are causing some runtime errors on quick forms:

The website encountered an unexpected error. Try again later.

TypeError: Drupal\farm_rothamsted_quick\Plugin\QuickForm\QuickExperimentFormBase::getTermTreeOptions(): Argument #2 ($parent) must be of type int, string given, called in /var/www/html/web/modules/farm_rothamsted/modules/farm_rothamsted_quick/src/Traits/QuickTaxonomyOptionsTrait.php on line 47 in Drupal\farm_rothamsted_quick\Plugin\QuickForm\QuickExperimentFormBase->getTermTreeOptions() (line 75 of modules/farm_rothamsted/modules/farm_rothamsted_quick/src/Traits/QuickTaxonomyOptionsTrait.php).
Drupal\farm_rothamsted_quick\Plugin\QuickForm\QuickExperimentFormBase->getChildTermOptionsByName('log_category', 'Drilling categories') (Line: 380)
Drupal\farm_rothamsted_quick\Plugin\QuickForm\QuickExperimentFormBase->buildForm(Array, Object) (Line: 55)
Drupal\farm_rothamsted_quick\Plugin\QuickForm\QuickDrilling->buildForm(Array, Object) (Line: 114)
Drupal\farm_quick\Form\QuickForm->buildForm(Array, Object, 'drilling')

This one in particular might be an easy fix, but I'm a little worried about other cases that strict types might bite us...

@paul121
Copy link
Collaborator Author

paul121 commented Jan 21, 2025

Moving strict types to a separate PR #767

@paul121 paul121 changed the title Add strict types and PHP stan Add PHPStan Jan 21, 2025
@paul121 paul121 merged commit 4f65be1 into 2.x Jan 21, 2025
2 checks passed
@paul121 paul121 deleted the 2.x-phpstan branch January 21, 2025 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant