-
-
Notifications
You must be signed in to change notification settings - Fork 56
style: update some of the QA tools configurations and enforce more modern code style (e.g. use of native annotations in fixtures) #283
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
Conversation
…dern code style (e.g. use of native annotations for fixtures)
|
Caution Review failedThe pull request is closed. WalkthroughThe changes update CI configurations by enhancing PHPStan, PHPUnit, and Rector settings with added includes, parameters, and stricter rules. Dependencies in composer.json were revised to include new dev tools and adjust version constraints. Several Doctrine entity files now use DBAL Types constants instead of string literals for type declarations. Additionally, DBAL and ORM source files received validation improvements, new properties, and method visibility tweaks. Tests were updated with refined expectations, reflective invocations, and standardized string formatting alongside minor whitespace adjustments. Changes
Sequence Diagram(s)sequenceDiagram
participant Dev as Developer
participant CI as CI Pipeline
participant PHPStan as PHPStan Analyzer
Dev->>CI: Trigger PHPStan Analysis
CI->>PHPStan: Load config (includes, tmpDir, parallel processes)
PHPStan->>PHPStan: Run analysis in parallel (max 4 processes)
PHPStan-->>CI: Return error report (table format)
CI-->>Dev: Display analysis results
sequenceDiagram
participant Dev as Developer
participant CI as CI Runner
participant PHPUnit as Test Runner
Dev->>CI: Start Test Execution
CI->>PHPUnit: Load config (random order, stricter test attributes)
PHPUnit->>PHPUnit: Execute tests and generate coverage reports
PHPUnit-->>CI: Return test results
CI-->>Dev: Report test outcomes
sequenceDiagram
participant Dev as Developer
participant Rector as Rector Tool
Dev->>Rector: Initiate Refactoring
Rector->>Config: Load configuration (sets, cache directory)
Rector->>Files: Process code adjustments per defined rules
Rector-->>Dev: Output refactored code
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
src/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArray.php (1)
49-63: 💡 Verification agent🧩 Analysis chain
Consider changing method visibility as suggested by Rector
The pipeline indicates that Rector would change the visibility of the
transformArrayItemForPHPmethod from public to protected. If this method is not intended to be part of the public API, consider changing its visibility to protected to better encapsulate implementation details.
🏁 Script executed:
#!/bin/bash # Check if the method is used outside of the class hierarchy echo "Checking for external usage of transformArrayItemForPHP method..." rg --type php "\->transformArrayItemForPHP\b" --glob "!src/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArray.php" -A 2 -B 2Length of output: 1269
Revisit the visibility change for
transformArrayItemForPHPThe pipeline suggests changing its visibility from public to protected. However, our search confirms that this method is being invoked outside its defining file—in particular, it’s used in:
- src/MartinGeorgiev/Doctrine/DBAL/Types/BaseArray.php
- tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php
Before applying the change, please verify whether this method is truly meant to be an internal helper. If you decide it should be protected, the external call sites (including those in tests) will need to be updated accordingly. Otherwise, you may choose to keep its public visibility as part of your API.
🧹 Nitpick comments (1)
src/MartinGeorgiev/Doctrine/DBAL/Types/TextArray.php (1)
44-44: Minor Formatting Update Observed.
The additional blank line in thetransformToPostgresTextArraymethod creates a clearer visual separation before checking for an empty array. Please ensure this style is consistent with the rest of the codebase.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (27)
ci/phpstan/config.neon(2 hunks)ci/phpunit/config.xml(1 hunks)ci/rector/config.php(1 hunks)composer.json(1 hunks)fixtures/MartinGeorgiev/Doctrine/Entity/ContainsArrays.php(1 hunks)fixtures/MartinGeorgiev/Doctrine/Entity/ContainsDates.php(1 hunks)fixtures/MartinGeorgiev/Doctrine/Entity/ContainsDecimals.php(1 hunks)fixtures/MartinGeorgiev/Doctrine/Entity/ContainsIntegers.php(1 hunks)fixtures/MartinGeorgiev/Doctrine/Entity/ContainsJsons.php(1 hunks)fixtures/MartinGeorgiev/Doctrine/Entity/ContainsTexts.php(1 hunks)fixtures/MartinGeorgiev/Doctrine/Entity/Entity.php(1 hunks)src/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArray.php(1 hunks)src/MartinGeorgiev/Doctrine/DBAL/Types/JsonTransformer.php(1 hunks)src/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArray.php(1 hunks)src/MartinGeorgiev/Doctrine/DBAL/Types/TextArray.php(1 hunks)src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseOrderableFunction.php(1 hunks)src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunction.php(2 hunks)src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/Cast.php(3 hunks)src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/StringAgg.php(1 hunks)tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php(1 hunks)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseComparisonFunctionTestCase.php(1 hunks)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonBuildObjectTest.php(1 hunks)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbBuildObjectTest.php(1 hunks)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php(2 hunks)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsqueryTest.php(3 hunks)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsvectorTest.php(3 hunks)tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UnaccentTest.php(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/**/*....
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/**/*.php: Use the PostgreSQL official documentation to verify that tests include comprehensive use cases and example SQL queries for the tested SQL functions and operators.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.phptests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsvectorTest.phptests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonBuildObjectTest.phptests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsqueryTest.phptests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbBuildObjectTest.phptests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseComparisonFunctionTestCase.phptests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UnaccentTest.php
🪛 GitHub Actions: CI
src/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArray.php
[warning] 45-45: Rector would change visibility of method 'transformArrayItemForPHP' from public to protected.
src/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArray.php
[warning] 20-20: Rector would change visibility of method 'isValidArrayItemForDatabase' from public to protected.
🔇 Additional comments (46)
src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseOrderableFunction.php (1)
17-19: Property type declaration improves code clarity and type safetyThis change adds a proper type declaration for the
$orderByClauseproperty that was previously used in the class but not explicitly declared. Using nullable type annotations (?OrderByClause) aligns with modern PHP practices and makes the code more maintainable.src/MartinGeorgiev/Doctrine/DBAL/Types/JsonTransformer.php (1)
28-28: String quote style standardizationChanged from single quotes to double quotes for consistency in string formatting across the codebase. This is a good stylistic improvement that aligns with the PR objective of enforcing more modern code style.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/TestCase.php (2)
46-47: Improved code readability with consistent spacingAdding a blank line after the early return statement improves readability by clearly separating logical blocks of code. This is a good practice that aligns with modern code style guidelines.
99-100: Better separation between validation and executionAdding a blank line between the validation check and the loop improves code readability by clearly separating the validation logic from the execution block. This is a good formatting practice.
src/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArray.php (1)
36-37: Improved code readability with consistent spacingAdding a blank line after the early return statement improves readability by clearly separating logical blocks of code. This is a good practice that aligns with modern code style guidelines.
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonBuildObjectTest.php (1)
45-45: Standardized String Delimiter in SQL Query.
The conversion of the SQL query string in the exception test to use double quotes viasprintfaligns with the overall effort to modernize string formatting. This change improves consistency without affecting functionality.tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsvectorTest.php (3)
25-25: Consistent SQL Expected Statement Formatting.
Updating the SQL statement to use double quotes for the literal (e.g."SELECT to_tsvector('english', c0_.text1) AS sclr_0 FROM ContainsTexts c0_") ensures consistency with other test cases.
34-34: Uniform DQL Query String.
The change in the DQL statement to use double quotes in
\sprintf("SELECT TO_TSVECTOR('english', e.text1) FROM %s e", ContainsTexts::class)
improves consistency and clarity.
45-45: Refined Exception Query for TO_TSVECTOR.
The updated exception-triggering query now uses standardized double quotes, which aligns with the overall code style improvements in the test suite.tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsqueryTest.php (3)
25-25: Standardized SQL Expected Query.
The change to use double quotes in the SQL expected statement improves consistency across the tests.
34-34: Uniform DQL Statement Formatting.
As with other test cases, changing the DQL statement to use double quotes enhances consistency, here seen in:
\sprintf("SELECT TO_TSQUERY('english', e.text1) FROM %s e", ContainsTexts::class)
45-45: Consistent Exception Query in TO_TSQUERY Test.
The updated query that triggers an exception now follows a uniform use of string delimiters, improving the overall readability and style consistency.tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php (1)
103-103: Standardized PHPUnit Expectation Method.
Changing the expectation call from$this->once()toself::once()standardizes the usage of PHPUnit’s expectation methods across the test suite. This aligns with recommended best practices in PHPUnit testing.composer.json (2)
51-52: Good addition of PHPStan extensions for improved static analysisAdding
phpstan/phpstan-deprecation-rulesandphpstan/phpstan-doctrinewill help catch deprecation issues and improve Doctrine-specific static analysis, which aligns well with the PR objective of updating QA tools.
55-55:❓ Verification inconclusive
Version constraint relaxation for rector
The version constraint for rector has been relaxed from
^1.2.10to^1.2. This allows for a wider range of compatible versions, but please ensure this doesn't introduce compatibility issues.
🏁 Script executed:
#!/bin/bash # Check if there are any breaking changes between rector 1.2.0 and 1.2.10 composer show rector/rector --all | grep -A 10 "versions"Length of output: 4600
Rector Version Constraint Relaxation Verification
The version constraint in
composer.jsonhas been changed from^1.2.10to^1.2, which now allows any patch release starting from 1.2.0 (i.e., 1.2.0–1.2.10). The executed shell script confirms that all these versions are available and there’s no immediately obvious indicator of breaking changes within the 1.2 series. However, please verify that using any rector patch earlier than 1.2.10 won't introduce unintended side effects in our codebase.
- Action needed: Double-check the rector release notes (or test critical paths) to ensure compatibility when versions lower than 1.2.10 are used.
fixtures/MartinGeorgiev/Doctrine/Entity/Entity.php (1)
7-7: Improved type safety with constants instead of string literalsGreat improvement! Using
Types::STRINGconstant instead of the string literal'string'provides better type safety, IDE autocompletion support, and prevents typos. This follows Doctrine's best practices and aligns with the PR goal of enforcing more modern code style.Also applies to: 13-13
src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/Cast.php (1)
44-50: Enhanced error handling with proper type checkingGood defensive programming! The added type checks for
$tokenand$token->valueprevent potential type errors at runtime. These checks improve robustness by gracefully handling edge cases.tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbBuildObjectTest.php (1)
45-45:❓ Verification inconclusive
Standardized string formatting in SQL query
The change from single quotes to double quotes for the SQL string simplifies the readability of SQL statements containing quotes. This standardization is consistent with modern PHP coding style.
Verify SQL function documentation
Since this is a PostgreSQL function test, please ensure test cases cover the examples from PostgreSQL documentation.
🌐 Web query:
PostgreSQL jsonb_build_object function examples and syntax💡 Result:
The PostgreSQL
jsonb_build_object()function constructs JSONB objects from key-value pairs, providing flexibility in handling diverse data types. Here's a detailed breakdown:Syntax
jsonb_build_object(VARIADIC any_value) → JSONB
- Parameters: Alternating keys (converted to text) and values (converted via
to_jsonb())- Requirement: Even number of arguments (key-value pairs) [1][2][4]
Key Features
- Automatic type conversion: Values are converted to JSONB using
to_jsonb():
- Arrays become JSON arrays [1]
- Composite types (e.g., PostGIS geometries) convert to JSON objects [1]
- Timestamps format as ISO 8601 strings [6]
- Nesting support: Can create complex nested structures [1][8]
- JSONB benefits: Binary storage format enables indexing and efficient querying [1][10]
Basic Examples
-- Simple object SELECT jsonb_build_object('a', 123); -- { "a": 123 } [1] -- Multiple pairs SELECT jsonb_build_object('name', 'Alex', 'age', 30); -- { "name": "Alex", "age": 30 } [1][4] -- Array value SELECT jsonb_build_object('phones', ARRAY['111-222-3333', '444-555-6666']); -- { "phones": ["111-222-3333", "444-555-6666"] } [1]Advanced Usage
Nested objects:
SELECT jsonb_build_object( 'contact', jsonb_build_object( 'email', 'alex@example.com', 'address', jsonb_build_object( 'street', '123 Main St', 'zip', 90210 ) ) ); -- { "contact": { "email": "alex@example.com", "address": { "street": "123 Main St", "zip": 90210 } } } [1][8]PostGIS integration:
SELECT jsonb_build_object('coords', ST_GeomFromText('POINT(-71.064544 42.28787)')); -- { "coords": { "type": "Point", "coordinates": [-71.064544, 42.28787] } } [1]Table data integration:
SELECT jsonb_build_object('title', title, 'length', length) FROM film LIMIT 1; -- { "title": "Academy Dinosaur", "length": 86 } [4]Common Errors
-- Odd number of arguments SELECT jsonb_build_object('key1', 'val1', 'key2'); -- ERROR: argument list must have even number of elements [4][6]Comparison: jsonb_build_object vs jsonb_object
Feature jsonb_build_object jsonb_object Value Types Any SQL type Only strings [3][7] Syntax Variadic key-value pairs Text arrays [3][7] Nested Structures Direct support Requires array nesting [3] Data Type Preservation Maintains original types All values become strings Best Practices
- Prefer
jsonboverjsonfor better performance and indexing [1][10]- Use with
jsonb_set()for partial updates [9]- Combine with
jsonb_aggfor array aggregation [10]- Handle dynamic structures using helper functions in PL/pgSQL [8]
For most use cases requiring type preservation and complex structures,
jsonb_build_object()is preferable tojsonb_object(), despite its slightly more verbose syntax. When working with table data or external type conversions (like PostGIS), it provides seamless JSONB generation while maintaining data integrity [1][4][6].Citations:
- 1: https://mitchellgritts.com/snippets/postgres-json-build-object/
- 2: https://www.sqliz.com/postgresql-ref/jsonb_build_object/
- 3: https://docs.yugabyte.com/preview/api/ysql/datatypes/type_json/functions-operators/jsonb-object/
- 4: https://neon.tech/postgresql/postgresql-json-functions/postgresql-jsonb_build_object
- 5: https://www.commandprompt.com/education/how-does-the-json_build_object-function-work-in-postgresql/
- 6: https://www.commandprompt.com/education/how-to-use-jsonb_build_object-function-in-postgresql/
- 7: https://neon.tech/postgresql/postgresql-json-functions/postgresql-jsonb_object
- 8: https://docs.yugabyte.com/preview/api/ysql/datatypes/type_json/functions-operators/jsonb-build-object/
- 9: https://www.postgresql.org/docs/current/functions-json.html
- 10: https://neon.tech/docs/functions/json_build_object
- 11: https://www.freecodecamp.org/news/postgresql-and-json-use-json-data-in-postgresql/
- 12: https://www.postgresql.org/docs/9.5/functions-json.html
Standardized SQL Query and JSON Function Documentation Verification
The updated SQL query now consistently uses double quotes, which enhances readability and aligns with modern PHP coding standards. Since the query calls PostgreSQL’s
jsonb_build_object()—a function that requires an even number of arguments and supports complex nested structures—please ensure the test cases comprehensively cover examples as outlined in the PostgreSQL documentation (including key-value pairing, nested objects, and type conversion scenarios).
- File:
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbBuildObjectTest.php- Line: 45
- Code Snippet:
$dql = sprintf("SELECT JSONB_BUILD_OBJECT('key1', e.object1, 'key2') FROM %s e", ContainsJsons::class);tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseComparisonFunctionTestCase.php (1)
36-40: Good adaptation to protected method accessibility.This change properly handles the testing of a protected method by using reflection, which is the appropriate approach when the visibility of a method has been restricted. The implementation correctly creates a ReflectionMethod, makes it accessible, and then invokes it with the necessary parameters.
src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/StringAgg.php (1)
26-26: Proper type declaration for class property.Adding the type declaration for the
$delimiterproperty improves code clarity and enables better static analysis. This change aligns with modern PHP practices and the PR's objective of enforcing more modern code style.fixtures/MartinGeorgiev/Doctrine/Entity/ContainsDecimals.php (1)
7-7: Good implementation of constants instead of string literals.Using
Types::DECIMALconstants instead of string literals for type declarations is a best practice that:
- Provides better type safety
- Enables IDE autocompletion
- Prevents typos in strings
- Makes the code more maintainable
This change aligns with the PR objective of enforcing modern code style.
Also applies to: 13-13, 16-16, 19-19
tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/UnaccentTest.php (2)
24-24: Improved string formatting.Using double quotes for strings containing single quotes eliminates the need for escaping, making the code more readable. This is a good stylistic improvement that maintains functionality while enhancing readability.
Also applies to: 32-32, 43-43
20-26: Test cases match PostgreSQL documentation for unaccent function.The test comprehensively covers the two main ways
unaccentcan be used according to PostgreSQL documentation:
unaccent(text)- Removes accents from the input stringunaccent(regdictionary, text)- Removes accents using a specific dictionaryIt also properly tests the error case when too many arguments are provided. This ensures the function behaves correctly according to the PostgreSQL specification.
Also applies to: 28-34, 36-45
src/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArray.php (3)
29-32: Enhanced validation with regex pattern checkThe addition of this regex validation is a good improvement that ensures the string representation of the item matches a valid integer pattern (including optional negative sign). This prevents incorrectly formatted strings from being accepted.
34-36: Additional minimum value validationGood addition of the minimum value check. This complements the existing maximum value check on line 38, ensuring that integer values are within the expected range.
24-39:❓ Verification inconclusive
Consider changing method visibility as suggested by Rector
The pipeline indicates Rector would change the visibility of
isValidArrayItemForDatabasefrom public to protected. This would better encapsulate the functionality if the method is only intended for internal use within the class hierarchy.
🏁 Script executed:
#!/bin/bash # Check if the method is used outside of the class hierarchy rg "->isValidArrayItemForDatabase\(" --type php | grep -v "BaseIntegerArray\|BaseArray"Length of output: 494
ACTION: Confirm Method Usage and Update Visibility
There was an issue with the initial verification command, which returned an error. To ensure that
isValidArrayItemForDatabaseis used only within its class hierarchy and can safely have its visibility changed from public to protected (per Rector’s suggestion), please run the following script manually:#!/bin/bash # Re-run verification: search for usage of isValidArrayItemForDatabase outside of BaseIntegerArray/BaseArray contexts rg 'isValidArrayItemForDatabase\(' --type php | grep -v 'BaseIntegerArray\|BaseArray'
- If no output is produced, the method is exclusively used internally, and changing its visibility to protected is advisable.
- If any unexpected usage is found, please review those instances before applying the change.
src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseVariadicFunction.php (2)
26-26: Improved encapsulation with visibility changeGood change from
publictoprotectedvisibility for thefeedParserWithNodesmethod. This properly restricts access to this method to only the class itself and its subclasses, which aligns with better encapsulation practices.
43-44: Improved code formattingThe addition of a blank line improves readability by separating logical code blocks.
fixtures/MartinGeorgiev/Doctrine/Entity/ContainsTexts.php (1)
7-7: Improved type definition using DBAL Types constantsGood modernization by replacing string literals with
Typesconstants for column type definitions. This approach:
- Provides type safety through IDE autocompletion
- Prevents typos in string literals
- Makes the code more maintainable
- Shows clear dependencies on the Doctrine Types class
Also applies to: 13-14, 16-17
fixtures/MartinGeorgiev/Doctrine/Entity/ContainsArrays.php (1)
7-7: Improved type definition using DBAL Types constantsGood modernization by replacing string literals with
Typesconstants for column type definitions. This approach:
- Provides type safety through IDE autocompletion
- Prevents typos in string literals
- Makes the code more maintainable
- Shows clear dependencies on the Doctrine Types class
Also applies to: 13-14, 16-17
fixtures/MartinGeorgiev/Doctrine/Entity/ContainsJsons.php (2)
7-7: Good addition of the Types importAdding the
Doctrine\DBAL\Types\Typesimport is a good practice for using type constants rather than string literals.
13-14: Excellent type safety improvementReplacing string literals with
Types::JSONconstants enhances type safety, improves maintainability, and makes refactoring easier. This change aligns with modern Doctrine best practices.Also applies to: 16-17
ci/phpunit/config.xml (2)
2-12: Good enhancements to PHPUnit configurationThe updated configuration adds several quality-focused settings that will help catch potential issues:
- Random execution order helps identify test interdependencies
- Failing on risky and warning tests increases reliability
- Strict output checking prevents unwanted output
- The cache directory change organizes test artifacts better
These changes align with modern PHPUnit best practices.
18-23: Well-structured coverage reportingAdding explicit coverage configuration with designated output directories for HTML and Clover reports improves visibility into test coverage and enables better CI integration.
ci/phpstan/config.neon (4)
3-4: Good addition of advanced PHPStan rule setsAdding deprecation rules and Doctrine-specific extensions will enhance static analysis by:
- Detecting usage of deprecated code
- Adding Doctrine-specific validation rules
- Improving type checking for Doctrine-specific patterns
These additions align with the PR objective of enforcing modern code style.
14-14: Proper cache configurationSetting a dedicated cache directory for PHPStan improves performance across multiple runs and keeps temporary files organized.
16-18: Performance optimization with parallel processingConfiguring parallel analysis with 4 processes will significantly speed up PHPStan runs, especially on larger codebases.
19-19: Improved error reporting formatUsing the table format for error reporting provides clearer and more readable output when issues are found.
fixtures/MartinGeorgiev/Doctrine/Entity/ContainsIntegers.php (2)
7-7: Good addition of the Types importAdding the
Doctrine\DBAL\Types\Typesimport is a good practice for using type constants.
13-14: Excellent type safety improvementReplacing string literals with
Types::INTEGERconstants improves type safety and maintainability. This systematic approach across integer fields makes the code more consistent and less prone to typos.Also applies to: 16-17, 19-20
ci/rector/config.php (4)
15-15: Good addition to include fixtures in Rector analysisAdding fixtures to the paths array ensures consistent code style across test fixtures, which is valuable for maintaining overall code quality.
21-21: Appropriate cache directory configurationSetting up a dedicated cache directory for Rector will improve performance on subsequent runs.
26-39: Well-organized sets configurationConverting individual imports to a consolidated
sets()method call improves readability and maintainability. The selection of sets is comprehensive, covering code quality, PHP 8.0/8.1 features, and Doctrine-specific rules.
45-46: Consistent import configuration settingsKeeping the import configuration settings unchanged maintains consistency in how external classes are referenced in the codebase.
fixtures/MartinGeorgiev/Doctrine/Entity/ContainsDates.php (2)
7-7: Good practice to import Types classAdding the explicit import for
Doctrine\DBAL\Types\Typesfollows best practices and makes the code dependencies clear.
13-13: Improved type safety with constants instead of string literalsReplacing string literals with type constants (
Types::DATE_IMMUTABLE, etc.) is an excellent improvement that:
- Provides better type safety
- Enables IDE autocompletion
- Reduces the risk of typos
- Makes the code more resilient to future Doctrine changes
This aligns well with modern PHP coding standards.
Also applies to: 16-16, 19-19, 22-22, 25-25, 28-28
Summary by CodeRabbit
Chores
Refactor
Tests
Style