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

Set PHPStan to Maximum Level #31

Merged
merged 3 commits into from
Mar 5, 2025
Merged

Conversation

n4ss1m
Copy link
Collaborator

@n4ss1m n4ss1m commented Mar 5, 2025

This PR increases the PHPStan analysis level to max, ensuring stricter static analysis and improved code quality for the.

Changes

  • Set PHPStan level to max in phpstan.neon
  • Added PHPStan baseline for PHP 8.1 to handle known errors
  • Updated method signatures to include explicit return types
  • Refactored models and controllers:
    • Added type hints for method parameters and return types
    • Improved PHPDoc annotations for better static analysis
  • Fixed test cases:
    • Used firstOrFail() instead of first() for stricter data validation
    • Added assertions to ensure consistency with test expectations
  • Introduced compatibility handling:
    • Added ignore-by-php-version.neon.php to manage PHP version-specific errors

Benefits

  • Enforces stricter type safety and code quality
  • Reduces potential runtime errors by catching issues earlier
  • Improves maintainability and consistency of the codebase

@n4ss1m n4ss1m merged commit 8fc13e5 into kossa:master Mar 5, 2025
21 checks passed
@n4ss1m n4ss1m deleted the enhancements_dev branch March 5, 2025 13:54
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