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 integration for static analysis #7

Merged
merged 20 commits into from
Dec 29, 2024
Merged

Conversation

n4ss1m
Copy link
Member

@n4ss1m n4ss1m commented Dec 29, 2024

Introduce PHPStan with configuration for code analysis. Updated composer.json to include PHPStan as a dependency and added an "analyse" script.

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.
@n4ss1m n4ss1m merged commit 904cc51 into PiteurStudio:main Dec 29, 2024
13 checks passed
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