fix: resolve all drupal-check PHPStan analysis issues #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR resolves all 11 drupal-check PHPStan analysis issues and all 3 drupal-lint warnings identified in the analyze module codebase, significantly improving code quality and type safety while maintaining full backward compatibility.
Issues Fixed
PHPStan Analysis Issues (11 total)
analyze.module(2 issues)analyze_form_alter()@phpstan-paramannotations for type information without violating Drupal coding standards@param-out array<string, mixed> $formannotation for proper output type specificationContentInfo.php(2 issues)isset($matches[0])check for always-existing array offsetpreg_match_all()always populates$matches[0]method_exists()check for MarkupInterface__toString()(string)cast - MarkupInterface always has__toString()AnalyzePluginBase.php(4 issues)new static()in abstract class@phpstan-ignore-next-linewith explanation for intended subclass usage\Drupal::service()call instead of dependency injection\Drupal::configFactory()calls instead of dependency injection$this->getConfigFactory()method calls for proper DIAnalyzeController.php(1 issue)new static()without return type@phpstan-ignore-next-linefor final class safetyAnalyzeSettingsForm.php(2 issues)submitForm()method@param-outannotation@phpstan-ignore-next-linefor framework method compatibilityDrupal Lint Warnings (3 total)
analyze.module(3 warnings)@phpstan-paramannotations instead of@paramto provide type information for PHPStan without violating Drupal coding standardsTechnical Improvements
Type Safety Enhancements
@param-out@phpstan-paramannotations to provide type information without conflicting with Drupal coding standardsCode Quality Improvements
isset()andmethod_exists()calls that PHPStan correctly identified as always trueDependency Injection Patterns
\Drupal::service()and\Drupal::configFactory()calls@phpstan-ignoreannotations for framework-specific patternsTesting & Verification
Quality Assurance
Compatibility
Files Changed
analyze.module- Hook documentation and type annotationsmodules/analyze_basic_content_info/src/Plugin/Analyze/ContentInfo.php- Redundant check removalsrc/AnalyzePluginBase.php- Dependency injection improvements and static instantiation fixessrc/Controller/AnalyzeController.php- Static instantiation and return type fixessrc/Form/AnalyzeSettingsForm.php- Parameter documentation and parent call compatibilityImpact
This PR brings the analyze module to zero PHPStan violations and zero lint warnings, establishing a solid foundation for:
🤖 Generated with Claude Code