Repository navigation
Conversation
Replace hardcoded class strings and fully qualified names with ::class syntax and add missing use statements. This improves maintainability and enables better static analysis and IDE support.
Replace the manual isset check and assignment with the null coalescing assignment operator. This change simplifies the logic and improves code readability by using modern PHP syntax.
Update the array_map call to use the first-class callable syntax introduced in PHP 8.1. This improves code readability and allows for better static analysis compared to using string-based callbacks.
Implement the Stringable interface and add a string return type hint to the __toString method. This ensures compatibility with PHP 8.0+ and explicitly defines the class's string representation behavior.
Update catch statements to use non-capturing catches. This removes unused variables where the exception object is not required for the error handling logic, following PHP 8.0+ syntax.
Replace traditional anonymous functions with arrow functions in the UsesRoles trait and auth helper. This modernization reduces code verbosity and improves readability for simple return statements.
Simplify the return statement in the subscription method by using the shorthand ternary operator (?:). This change removes the redundant reference to the subscription property, making the code cleaner and more concise.
Update the table creation logic to use a match expression instead of a switch statement. This modernizes the code using PHP 8 features and improves readability by removing redundant break statements.
Remove setAccessible(true) calls from ReflectionProperty instances in google.test.php and roles.test.php. These calls are no longer required in modern PHP versions, and removing them simplifies the test code.
…ions Add the dead-code rule set to alchemy configuration to improve code quality and maintainability. Remove explicit null assignments from class properties in Auth and UsesSubscriptions because they are redundant in PHP and flagged as dead code.
Remove the explicit count check before iterating over hidden fields. PHP's foreach handles empty arrays natively, making the check unnecessary. This simplifies the logic and reduces nesting levels.
Remove the try-catch block that only re-throws exceptions to simplify the code and allow the test runner to handle errors naturally.
Remove the empty __construct method from the FakeBillingDriver class to clean up the test mock as it performs no initialization logic.
Remove the try-catch block in the beforeAll hook that was simply rethrowing exceptions. This simplifies the database initialization logic for tests without changing the error handling behavior.
Remove the unused $testUser variable from the logout closure in tests/user.test.php to clean up the test code and avoid unnecessary variable capturing.
Delete the phpstan-baseline.neon file to enforce stricter static analysis. This ensures that type errors in Auth.php and User.php are no longer ignored, promoting better code quality and type safety.
Ensure consistent formatting by adding a space after the fn keyword in arrow functions. This aligns the code with PSR-12 standards and improves overall code style consistency.
Create phpstan-baseline.neon to ignore existing static analysis errors. This ensures that future static analysis runs only report new issues.
This file contains hidden or 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
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.
What kind of change does this PR introduce? (pls check at least one)
Description
All refactors were tested in interactive shell.
Does this PR introduce a breaking change? (check one)