-
Notifications
You must be signed in to change notification settings - Fork 1
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 integration for static analysis #7
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Introduce PHPStan with configuration for code analysis. Updated `composer.json` to include PHPStan as a dependency and added an "analyse" script. Also removed `phpstan.neon` from `.gitignore` to track the configuration file.
Added the `getCreateOrderValidationRules` method to multiple providers and the `ShippingProviderContract` interface for consistency. Deprecated the `cancelOrder` method across the codebase by commenting it out. These changes improve validation handling and prepare for further updates.
Include a new step in the GitHub Actions workflow to run PHPStan analysis, ensuring code quality checks. This enhances the CI process by identifying potential issues early.
Previously, the request body was being passed as a PHP array. This update ensures the body is properly JSON-encoded with unescaped Unicode characters, improving compatibility with the API.
Replaced detailed metadata docblocks with @inheritdoc across multiple shipping providers and related interfaces. This ensures consistency and reduces redundancy by relying on inherited documentation. Updated return type in ShippingProviderContract for improved type clarity."
Updated method parameter and return type annotations for clarity and stricter type safety. These changes ensure better code validation, reduce potential runtime errors, and improve maintainability.
Updated method parameter and return type definitions with stricter types. Enhanced PHPDoc comments for clarity, ensuring accurate descriptions of methods and their usage.
Updated the `@param` and `@return` tags in the PHPDoc to enhance clarity and ensure accurate type definitions. These changes improve code readability and maintainability for developers interacting with the validation logic.
Enhanced type safety with explicit type annotations for arrays. Simplified method documentation by replacing detailed comments with `@inheritdoc` to reduce redundancy and improve maintainability.
Updated PHPDoc type annotations to specify stricter array type constraints for `$credentials` and `providers` return values. This ensures improved type safety and self-documentation for the codebase.
Increased static analysis strictness from level 2 to level 6 for improved code quality. Added an excludePaths rule to ignore specific file errors during analysis. This balances stricter checks with flexibility for known issues.
Add a check for JSON encoding failures when creating orders. Throw a `CreateOrderException` with a descriptive message if encoding fails, preventing invalid requests from being sent to the API.
Updated label handling to validate non-empty responses and ensure proper base64 encoding. Added JSON encoding error checks in multiple provider integrations to handle invalid data gracefully. Updated return type annotations for better accuracy and clarity across the ShippingService and related contracts.
Enhanced the return type for order validation rules to support nested arrays, improving flexibility in validation. Added a safeguard to handle potential failures in fetching provider files, ensuring robustness in the provider listing mechanism.
Updated the PHPStan configuration to raise the analysis level from 6 to 7, enabling stricter checks. Additionally, uncommented the `treatPhpDocTypesAsCertain` setting to ensure better type safety handling based on PHPDoc annotations. These changes aim to improve code quality and catch more potential issues early.
Raised the PHPStan strictness from level 7 to 8 for improved static code analysis and error detection. This change aims to enhance code quality by identifying more potential issues during development.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Introduce PHPStan with configuration for code analysis. Updated
composer.json
to include PHPStan as a dependency and added an "analyse" script.