Skip to content

Conversation

@martin-georgiev
Copy link
Owner

@martin-georgiev martin-georgiev commented Mar 13, 2025

Summary by CodeRabbit

  • Chores

    • Updated configuration for static analysis, testing, and code quality with performance optimizations through parallel execution and defined cache directories.
    • Added new development tools for enhanced deprecation handling and improved support.
  • Refactor

    • Standardized data type declarations in object-relation mappings for greater consistency.
    • Consolidated configuration settings for clarity and maintainability.
  • Tests

    • Improved test reliability by refining expectations, formatting, and method accessibility.
  • Style

    • Adjusted string formatting in SQL queries for greater consistency.

…dern code style (e.g. use of native annotations for fixtures)
@coderabbitai
Copy link

coderabbitai bot commented Mar 13, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The 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

File(s) Summary of Changes
ci/phpstan/config.neon, ci/phpunit/config.xml, ci/rector/config.php, composer.json Updated CI configurations with new includes, parameters (parallel processing, cache directories, strict PHPUnit attributes) and dependency/version updates.
fixtures/.../ContainsArrays.php, ContainsDates.php, ContainsDecimals.php, ContainsIntegers.php, ContainsJsons.php, ContainsTexts.php, Entity.php Standardized ORM column definitions by converting type strings to Doctrine DBAL Types constants.
src/MartinGeorgiev/Doctrine/DBAL/Types/*, src/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/* Enhanced validations, added new properties, changed method visibility, and made formatting adjustments in DBAL types and ORM functions.
tests/MartinGeorgiev/Doctrine/DBAL/Types/*, tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/* Updated test expectations, adopted reflective method calls, standardized string delimiters, and introduced minor whitespace changes in tests.
ci/phpstan/baselines/deprecated-methods.neon, ci/phpstan/baselines/lexer-constants.neon, ci/phpstan/baselines/phpstan-identifiers.neon, ci/phpstan/baselines/type-mismatches.neon Added new baseline configuration files for PHPStan to handle deprecated methods and type mismatches.

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
Loading
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
Loading
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
Loading

Poem

I'm a hopping rabbit in the realm of code,
Leaping through configs on my winding road.
With parallel processes and constants that gleam,
I nibble on bugs 'til they vanish, it would seem.
From tests to refactors, my code garden grows,
Carrots and snippets in joyful rows!
🐇🌟 Keep on coding beyond the burrows!


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a20ce0b and 38b4e46.

📒 Files selected for processing (1)
  • ci/phpstan/baselines/lexer-constants.neon (1 hunks)

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a 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 transformArrayItemForPHP method 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 2

Length of output: 1269


Revisit the visibility change for transformArrayItemForPHP

The 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 the transformToPostgresTextArray method 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6bb84e7 and 7b9ea00.

📒 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.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsvectorTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonBuildObjectTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/ToTsqueryTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/JsonbBuildObjectTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/BaseComparisonFunctionTestCase.php
  • tests/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 safety

This change adds a proper type declaration for the $orderByClause property 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 standardization

Changed 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 spacing

Adding 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 execution

Adding 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 spacing

Adding 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 via sprintf aligns 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() to self::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 analysis

Adding phpstan/phpstan-deprecation-rules and phpstan/phpstan-doctrine will 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.10 to ^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.json has been changed from ^1.2.10 to ^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 literals

Great improvement! Using Types::STRING constant 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 checking

Good defensive programming! The added type checks for $token and $token->value prevent 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

  1. Prefer jsonb over json for better performance and indexing [1][10]
  2. Use with jsonb_set() for partial updates [9]
  3. Combine with jsonb_agg for array aggregation [10]
  4. 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 to jsonb_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:


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 $delimiter property 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::DECIMAL constants 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 unaccent can be used according to PostgreSQL documentation:

  1. unaccent(text) - Removes accents from the input string
  2. unaccent(regdictionary, text) - Removes accents using a specific dictionary

It 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 check

The 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 validation

Good 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 isValidArrayItemForDatabase from 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 isValidArrayItemForDatabase is 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 change

Good change from public to protected visibility for the feedParserWithNodes method. 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 formatting

The 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 constants

Good modernization by replacing string literals with Types constants for column type definitions. This approach:

  1. Provides type safety through IDE autocompletion
  2. Prevents typos in string literals
  3. Makes the code more maintainable
  4. 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 constants

Good modernization by replacing string literals with Types constants for column type definitions. This approach:

  1. Provides type safety through IDE autocompletion
  2. Prevents typos in string literals
  3. Makes the code more maintainable
  4. 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 import

Adding the Doctrine\DBAL\Types\Types import is a good practice for using type constants rather than string literals.


13-14: Excellent type safety improvement

Replacing string literals with Types::JSON constants 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 configuration

The 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 reporting

Adding 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 sets

Adding 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 configuration

Setting a dedicated cache directory for PHPStan improves performance across multiple runs and keeps temporary files organized.


16-18: Performance optimization with parallel processing

Configuring parallel analysis with 4 processes will significantly speed up PHPStan runs, especially on larger codebases.


19-19: Improved error reporting format

Using 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 import

Adding the Doctrine\DBAL\Types\Types import is a good practice for using type constants.


13-14: Excellent type safety improvement

Replacing string literals with Types::INTEGER constants 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 analysis

Adding 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 configuration

Setting up a dedicated cache directory for Rector will improve performance on subsequent runs.


26-39: Well-organized sets configuration

Converting 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 settings

Keeping 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 class

Adding the explicit import for Doctrine\DBAL\Types\Types follows best practices and makes the code dependencies clear.


13-13: Improved type safety with constants instead of string literals

Replacing 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

coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 13, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 14, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Mar 14, 2025
@coveralls
Copy link

coveralls commented Mar 14, 2025

Coverage Status

coverage: 95.552%. remained the same
when pulling 38b4e46 on sa-tools
into 6bb84e7 on main.

@martin-georgiev martin-georgiev merged commit e36a2c2 into main Mar 14, 2025
14 of 16 checks passed
@martin-georgiev martin-georgiev deleted the sa-tools branch March 14, 2025 00:40
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.

3 participants