Skip to content

Conversation

@martin-georgiev
Copy link
Owner

@martin-georgiev martin-georgiev commented Apr 11, 2025

Summary by CodeRabbit

  • Tests
    • Enhanced testing capabilities to provide more detailed feedback during test runs.
    • Updated test methods for improved accessibility and robustness, including renaming for clarity.
    • Added new tests to verify advanced array transformations and query functionalities, including exception handling for invalid data.
    • Introduced new data providers and methods to improve coverage for invalid data scenarios in various data types.
  • Chores
    • Refined the testing configuration to deliver comprehensive output on notifications and warnings.

@coderabbitai
Copy link

coderabbitai bot commented Apr 11, 2025

Caution

Review failed

The head commit changed during the review from d56f1f0 to 0403aed.

Walkthrough

This pull request updates the PHPUnit configuration and modifies several test classes. In the configuration file, one attribute is removed and five attributes are added to enhance test output details. Multiple test cases in the Doctrine DBAL/ORM suite have updated method visibilities or signatures (e.g., changing methods to public static or adding optional parameters), along with a key renaming in one data provider. Additionally, two new test classes for the InArray and RowToJson functions have been introduced, and several transformation tests have been simplified.

Changes

File(s) Change Summary
ci/phpunit/config.xml Removed attribute beStrictAboutTodoAnnotatedTests; added attributes: displayDetailsOnTestsThatTriggerDeprecations, displayDetailsOnTestsThatTriggerErrors, displayDetailsOnTestsThatTriggerNotices, displayDetailsOnTestsThatTriggerWarnings, and displayDetailsOnPhpunitDeprecations.
tests/.../Doctrine/DBAL/Types/{BaseIntegerArrayTestCase.php, BigIntArrayTest.php, IntegerArrayTest.php, SmallIntArrayTest.php, BooleanArrayTest.php, JsonbArrayTest.php, CidrArrayTest.php, CidrTest.php, DoublePrecisionArrayTest.php, InetArrayTest.php, InetTest.php, MacaddrArrayTest.php, MacaddrTest.php, RealArrayTest.php} Modified provideOutOfRangeValues method visibility from protected (or abstract protected) to public static and renamed provideInvalidTransformations to provideInvalidPHPValuesForDatabaseTransformation.
tests/.../Doctrine/ORM/Query/AST/Functions/{InArrayTest.php, RowToJsonTest.php} Added new test classes to validate the InArray and RowToJson functions respectively.
tests/.../Utils/PHPArrayToPostgresValueTransformerTest.php Changed the return type and structure of provideInvalidTransformations, removing the postgresValue field from the returned array.

Sequence Diagram(s)

InArray Function Test

sequenceDiagram
    participant T as InArrayTest
    participant F as InArray Function
    participant S as SQL Translator
    participant DB as Database

    T->>F: Map "IN_ARRAY" function via getStringFunctions
    F->>S: Convert DQL "IN_ARRAY" to SQL query
    S->>DB: Execute generated SQL
    DB-->>S: Return query result
    S-->>F: Provide SQL statement
    F-->>T: Deliver expected SQL and DQL outputs
Loading

RowToJson Function Test

sequenceDiagram
    participant T as RowToJsonTest
    participant F as RowToJson Function
    participant S as SQL Translator
    participant DB as Database

    T->>F: Map "ROW_TO_JSON" function via getStringFunctions
    F->>S: Convert DQL "ROW_TO_JSON" to SQL query
    S->>DB: Execute SQL query for JSON conversion
    DB-->>S: Return transformation result
    S-->>F: Provide SQL statement
    F-->>T: Deliver expected outputs for SQL and DQL
Loading

Poem

In the code garden I hop with delight,
Changes bloom in the soft moonlight.
Attributes dance in the PHPUnit air,
Methods open wide with a cheerful flair.
New tests arrive, bold and bright,
A rabbit sings: "Code change feels just right!" 🐇


🪧 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 plan to trigger planning for file edits and PR creation.
  • @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: 2

🧹 Nitpick comments (1)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BooleanArrayTest.php (1)

55-55: Unused parameter in the method signature.

You've added an optional parameter ?array $platformValue = null to match the parameter structure of can_transform_from_php_value(), but this parameter is never used in the method implementation.

Since the parameter isn't used, consider either:

  1. Removing it to keep the method signature clean and avoid confusion, or
  2. If it's intended for future use, add a comment explaining its purpose.
-public function can_transform_to_php_value(?array $phpValue, ?string $postgresValue, ?array $platformValue = null): void
+public function can_transform_to_php_value(?array $phpValue, ?string $postgresValue): void
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 725e253 and 36e640b.

📒 Files selected for processing (10)
  • ci/phpunit/config.xml (1 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/BooleanArrayTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (2 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/InArrayTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/RowToJsonTest.php (1 hunks)
  • tests/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/**/*.php`: Use the PostgreSQL official documentation to verify that tests include comprehensive use cases and example SQL que...

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/RowToJsonTest.php
  • tests/MartinGeorgiev/Doctrine/ORM/Query/AST/Functions/InArrayTest.php
🧬 Code Graph Analysis (5)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (3)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
  • provideOutOfRangeValues (84-90)
tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
  • provideOutOfRangeValues (70-76)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
  • provideOutOfRangeValues (70-76)
tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (3)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
  • provideOutOfRangeValues (88-88)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
  • provideOutOfRangeValues (84-90)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
  • provideOutOfRangeValues (70-76)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (3)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
  • provideOutOfRangeValues (88-88)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
  • provideOutOfRangeValues (84-90)
tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
  • provideOutOfRangeValues (70-76)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (3)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
  • provideOutOfRangeValues (88-88)
tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
  • provideOutOfRangeValues (70-76)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
  • provideOutOfRangeValues (70-76)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BooleanArrayTest.php (5)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
  • can_transform_to_php_value (59-62)
tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (1)
  • can_transform_to_php_value (52-55)
tests/MartinGeorgiev/Doctrine/DBAL/Types/TextArrayTest.php (1)
  • can_transform_to_php_value (51-54)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseArrayTest.php (1)
  • can_transform_to_php_value (54-57)
tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbTest.php (1)
  • can_transform_to_php_value (51-54)
⏰ Context from checks skipped due to timeout of 90000ms (20)
  • GitHub Check: PHP 8.3 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.14 + Doctrine Lexer latest
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.14 + Doctrine Lexer 1.2
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.14 + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.4 + Doctrine ORM 3.0 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer latest
  • GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.3 + Doctrine ORM 2.18 + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.18 + Doctrine Lexer latest
  • GitHub Check: PHP 8.3 + Doctrine ORM 3.0 + Doctrine Lexer latest
  • GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: PHP 8.2 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.3 + Doctrine ORM latest + Doctrine Lexer 3.0
  • GitHub Check: PHP 8.1 + Doctrine ORM 3.0 + Doctrine Lexer latest
  • GitHub Check: PHP 8.2 + Doctrine ORM 2.18 + Doctrine Lexer 2.1
  • GitHub Check: sloth
🔇 Additional comments (8)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)

70-70: Good visibility and accessibility change

Changed method from protected to public static to match the abstract method declaration in BaseIntegerArrayTestCase. This improves accessibility and follows PHPUnit best practices for data providers.

tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)

70-70: Appropriate visibility modifier change

Changed method from protected to public static to match the abstract method declaration in BaseIntegerArrayTestCase. This aligns with PHPUnit best practices for data providers and creates consistency across all integer array test implementations.

tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (2)

65-65: Good property key renaming for consistency

Renamed property key from postgresJsonb to postgresValue to match parameter names in the test methods and maintain consistency across test classes.


88-88: Appropriate property key renaming

Renamed property key from postgresJsonb to postgresValue to match parameter names in test methods. This creates consistency with the property naming pattern used throughout the test suite.

tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)

88-88: Good abstract method declaration update

Changed abstract method declaration from protected to public static, enforcing a consistent pattern for data providers across all subclasses. This follows PHPUnit best practices where data providers should be static methods.

tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)

84-84: Good change to align with parent abstract method.

The visibility change from protected to public static correctly aligns with the abstract method declaration in BaseIntegerArrayTestCase.php and makes the method signature consistent with other data providers in the codebase.

ci/phpunit/config.xml (1)

12-16: Excellent improvement to test output visibility!

These new attributes will make test failures much more transparent by showing detailed information about deprecations, errors, notices, and warnings. This is especially valuable for catching subtle issues that might be hidden in the test output.

tests/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php (1)

124-124: Good fix to align PHPDoc with implementation

The updated return type annotation now correctly reflects the actual structure of the returned array, which only contains the phpValue key without a postgresValue key. This improves code documentation accuracy and helps with static analysis.

- more descriptive provider method names
- add missing exception handling tests
coderabbitai[bot]
coderabbitai bot previously requested changes Apr 11, 2025
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: 5

🧹 Nitpick comments (4)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (2)

124-125: Fix the redundant data provider name.

The data provider name provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation contains a redundant "ForPHPTransformation" suffix.

-     * @dataProvider provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation
+     * @dataProvider provideInvalidDatabaseValuesForPHPTransformation

136-145: Fix the redundant method name.

The method name provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation contains a redundant "ForPHPTransformation" suffix.

-    public static function provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation(): array
+    public static function provideInvalidDatabaseValuesForPHPTransformation(): array

The test data cases themselves look comprehensive, covering various invalid MAC address scenarios.

tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (2)

118-119: Fix the redundant data provider name.

The data provider name provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation contains a redundant "ForPHPTransformation" suffix.

-     * @dataProvider provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation
+     * @dataProvider provideInvalidDatabaseValuesForPHPTransformation

129-140: Fix the redundant method name.

The method name provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation contains a redundant "ForPHPTransformation" suffix.

-    public static function provideInvalidDatabaseValuesForPHPTransformationForPHPTransformation(): array
+    public static function provideInvalidDatabaseValuesForPHPTransformation(): array

The test data cases themselves are comprehensive, covering various invalid CIDR notation scenarios.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 36e640b and 1d559f3.

📒 Files selected for processing (16)
  • .github/workflows/ci.yml (2 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (2 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (3 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (2 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (3 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php (4 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (3 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (4 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (2 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (3 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (3 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php (4 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1 hunks)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (2 hunks)
  • tests/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php
  • tests/MartinGeorgiev/Utils/PHPArrayToPostgresValueTransformerTest.php
  • tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php
🧰 Additional context used
🧬 Code Graph Analysis (8)
tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (13)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (28-41)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-33)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (28-42)
tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (116-134)
tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (99-113)
tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (124-143)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (119-138)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (103-119)
tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (109-115)
tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (115-129)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php (13)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (28-41)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-33)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (28-42)
tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php (2)
  • provideInvalidPHPValuesForDatabaseTransformation (116-134)
  • provideInvalidDatabaseValuesForPHPTransformation (150-156)
tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (99-113)
tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (2)
  • provideInvalidPHPValuesForDatabaseTransformation (124-143)
  • provideInvalidDatabaseValuesForPHPTransformation (159-177)
tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (26-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (119-138)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (103-119)
tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (109-115)
tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (12)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-33)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (28-42)
tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (116-134)
tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (99-113)
tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (124-143)
tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (26-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (119-138)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (103-119)
tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (115-129)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (7)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-33)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (28-42)
tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (99-113)
tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (26-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (109-115)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php (13)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (28-41)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-33)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (28-42)
tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (99-113)
tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (2)
  • provideInvalidPHPValuesForDatabaseTransformation (124-143)
  • provideInvalidDatabaseValuesForPHPTransformation (159-177)
tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (26-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (119-138)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (103-119)
tests/MartinGeorgiev/Doctrine/DBAL/Types/JsonbArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (109-115)
tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php (2)
  • provideInvalidPHPValuesForDatabaseTransformation (115-129)
  • provideInvalidDatabaseValuesForPHPTransformation (145-151)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (7)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-33)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (28-42)
tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (26-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
src/MartinGeorgiev/Doctrine/DBAL/Types/Exceptions/InvalidMacaddrArrayItemForPHPException.php (1)
  • InvalidMacaddrArrayItemForPHPException (14-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (3)
src/MartinGeorgiev/Doctrine/DBAL/Types/Exceptions/InvalidInetForDatabaseException.php (1)
  • InvalidInetForDatabaseException (14-30)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (2)
  • provideInvalidPHPValuesForDatabaseTransformation (119-138)
  • throws_exception_when_invalid_data_provided_to_convert_to_php_value (145-150)
src/MartinGeorgiev/Doctrine/DBAL/Types/Inet.php (1)
  • convertToPHPValue (43-58)
tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (8)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BigIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-33)
tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseIntegerArrayTestCase.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (28-42)
tests/MartinGeorgiev/Doctrine/DBAL/Types/IntegerArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (26-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (25-35)
tests/MartinGeorgiev/Doctrine/DBAL/Types/SmallIntArrayTest.php (1)
  • provideInvalidPHPValuesForDatabaseTransformation (24-32)
src/MartinGeorgiev/Doctrine/DBAL/Types/Exceptions/InvalidInetArrayItemForPHPException.php (1)
  • InvalidInetArrayItemForPHPException (14-35)
src/MartinGeorgiev/Doctrine/DBAL/Types/Inet.php (1)
  • convertToPHPValue (43-58)
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: PHP 8.1 + Doctrine ORM 2.14 + Doctrine Lexer 1.2
  • GitHub Check: PHP 8.4 + Doctrine ORM 2.18 + Doctrine Lexer latest
  • GitHub Check: PHP 8.4 + Doctrine ORM latest + Doctrine Lexer 2.1
  • GitHub Check: sloth
🔇 Additional comments (31)
.github/workflows/ci.yml (3)

4-8: Good addition of CI trigger for the main branch

Adding a push trigger for the main branch with appropriate path exclusions ensures that CI runs when code is directly pushed to main, which is a good practice for maintaining code quality.


27-27: Improved clarity in the skip message

The new message is more precise about why CI checks are being skipped, clearly stating it's due to the release-please bot's interaction.


30-30: Enhanced clarity in the execution message

The updated message clearly indicates that CI checks will execute because the actor is not the release-please bot, which provides better context for troubleshooting.

tests/MartinGeorgiev/Doctrine/DBAL/Types/BaseFloatArrayTestCase.php (2)

18-18: Improved data provider annotation naming

The renamed data provider is more descriptive and accurately reflects its purpose of providing invalid PHP values specifically for database transformation.


28-28: More descriptive method naming

Renaming to provideInvalidPHPValuesForDatabaseTransformation clearly communicates the method's purpose and follows the pattern used throughout the test suite.

tests/MartinGeorgiev/Doctrine/DBAL/Types/RealArrayTest.php (2)

25-25: Consistent method naming

The method signature has been updated to match the naming convention used in the parent class and other test files, providing better clarity and consistency.


27-27: Updated parent method call

The parent method call has been correctly updated to reflect the renamed method in the parent class, maintaining the inheritance chain.

tests/MartinGeorgiev/Doctrine/DBAL/Types/DoublePrecisionArrayTest.php (2)

26-26: Consistent method naming

The method signature has been updated to match the naming convention used in the parent class and other test files, providing better clarity and consistency.


28-28: Updated parent method call

The parent method call has been correctly updated to reflect the renamed method in the parent class, maintaining the inheritance chain.

tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrTest.php (4)

104-104: Good method name clarification.

Renaming the data provider reference from provideInvalidTransformations to provideInvalidPHPValuesForDatabaseTransformation improves clarity by explicitly indicating what kind of invalid values are being tested.


115-129: Improved method naming.

The method name change from provideInvalidTransformations to provideInvalidPHPValuesForDatabaseTransformation makes the purpose of this data provider much clearer, which helps maintain consistency across test classes and improves readability.


134-135: Good method name clarification.

Renaming the data provider reference from provideInvalidDatabaseValues to provideInvalidDatabaseValuesForPHPTransformation makes the test intention clearer - it's testing database-to-PHP conversions with invalid data.


145-151: Improved method naming.

The method name change from provideInvalidDatabaseValues to provideInvalidDatabaseValuesForPHPTransformation better describes the purpose of this data provider and maintains consistency with the naming pattern used throughout the tests.

tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrTest.php (4)

105-106: Good method name clarification.

Renaming the data provider reference from provideInvalidTransformations to provideInvalidPHPValuesForDatabaseTransformation improves clarity by explicitly indicating what kind of invalid values are being tested.


116-134: Improved method naming.

The method name change from provideInvalidTransformations to provideInvalidPHPValuesForDatabaseTransformation makes the purpose of this data provider much clearer, which helps maintain consistency across test classes and improves readability.


139-140: Good method name clarification.

Renaming the data provider reference from provideInvalidDatabaseValues to provideInvalidDatabaseValuesForPHPTransformation makes the test intention clearer - it's testing database-to-PHP conversions with invalid data.


150-156: Improved method naming.

The method name change from provideInvalidDatabaseValues to provideInvalidDatabaseValuesForPHPTransformation better describes the purpose of this data provider and maintains consistency with the naming pattern used throughout the tests.

tests/MartinGeorgiev/Doctrine/DBAL/Types/MacaddrArrayTest.php (3)

92-93: Good method name clarification.

Renaming the data provider reference from provideInvalidTransformations to provideInvalidPHPValuesForDatabaseTransformation improves clarity by explicitly indicating what kind of invalid values are being tested.


103-119: Improved method naming.

The method name change from provideInvalidTransformations to provideInvalidPHPValuesForDatabaseTransformation makes the purpose of this data provider much clearer, which helps maintain consistency across test classes and improves readability.


121-131: Good addition of PHP conversion test.

Adding this test method enhances test coverage by verifying that invalid database values are properly rejected when converting to PHP types.

tests/MartinGeorgiev/Doctrine/DBAL/Types/CidrArrayTest.php (3)

88-89: Good method name clarification.

Renaming the data provider reference from provideInvalidTransformations to provideInvalidPHPValuesForDatabaseTransformation improves clarity by explicitly indicating what kind of invalid values are being tested.


99-113: Improved method naming.

The method name change from provideInvalidTransformations to provideInvalidPHPValuesForDatabaseTransformation makes the purpose of this data provider much clearer, which helps maintain consistency across test classes and improves readability.


115-124: Good addition of PHP conversion test.

Adding this test method enhances test coverage by verifying that invalid database values are properly rejected when converting to PHP types.

tests/MartinGeorgiev/Doctrine/DBAL/Types/InetTest.php (6)

8-8: Good addition of missing import.

The import for InvalidInetForDatabaseException is correctly added to support the new test method for validating conversions from database to PHP values.


113-113: Improved method reference in docblock.

The data provider reference has been updated from provideInvalidTransformations to provideInvalidPHPValuesForDatabaseTransformation, which provides better naming clarity and aligns with other test classes in the codebase.


124-124: Good conversion to static method.

Changing the data provider to public static follows best practices for PHPUnit data providers, as they don't require instance state and can be more efficiently used across test runs.


127-127: Improved test coverage with non-string value test case.

Adding a test case for non-string values (123) strengthens the test coverage by ensuring the code properly handles numeric inputs.


145-154: Good addition of database-to-PHP conversion test.

This new test method properly verifies that exceptions are thrown when invalid data is provided for conversion from database values to PHP values, complementing the existing PHP-to-database conversion test.


156-177: Comprehensive data provider for invalid database values.

The new data provider includes a thorough set of test cases covering various invalid inputs, enhancing the robustness of the test suite. The test cases align well with the implementation in Inet::convertToPHPValue().

tests/MartinGeorgiev/Doctrine/DBAL/Types/InetArrayTest.php (2)

108-108: Improved method reference in docblock.

The data provider reference has been consistently updated to provideInvalidPHPValuesForDatabaseTransformation, maintaining naming clarity across the test suite.


119-119: Good conversion to static method.

Converting the data provider to public static is a good practice for PHPUnit data providers, improving efficiency and consistency with other test classes.

* @return array<string, array{string}>
*/
public static function provideInvalidDatabaseValuesForPHPTransformationForDatabaseTransformation(): array
{
Copy link

@coderabbitai coderabbitai bot Apr 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Return type annotation should allow for mixed values.

The current return type annotation only allows for string values, but to test non-string inputs, it should allow for mixed values.

- @return array<string, array{string}>
+ @return array<string, array{mixed}>

Committable suggestion skipped: line range outside the PR's diff.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't be correct based on the provider data, and PHPStan will scream at you. Or maybe not?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martin-georgiev You're absolutely right. The suggestion to change to `array

<string, array{mixed}>` would be incorrect and PHPStan would indeed flag it.

Looking at your test method:

public function throws_exception_when_invalid_data_provided_to_convert_to_php_value(string $postgresValue): void

The parameter is typed as string $postgresValue, so the data provider must return string values. Since all your test cases in the provider return strings (like '{"invalid-ip"}'), the current annotation @return array<string, array{string}> is correct.

The mixed type would only be appropriate if your test method parameter was typed as mixed (like in your other test method).

Comment on lines +157 to +168
return [
'invalid format' => ['{"invalid-ip"}'],
'invalid IPv4 in array' => ['{"256.256.256.256"}'],
'invalid IPv6 in array' => ['{"2001:xyz::1"}'],
'malformed array' => ['not-an-array'],
'empty item in array' => ['{"192.168.1.1",""}'],
'invalid item in array' => ['{"192.168.1.1","invalid-ip"}'],
'invalid CIDR in array' => ['{"192.168.1.0/33"}'],
'incomplete IPv4 in array' => ['{"192.168.1"}'],
'incomplete IPv6 in array' => ['{"2001:db8"}'],
];
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add non-string test case to match parameter type change.

To fully test invalid inputs, consider adding a non-string test case similar to the one in InetTest.

 return [
+    'non-string value' => [123],
     'invalid format' => ['{"invalid-ip"}'],
     'invalid IPv4 in array' => ['{"256.256.256.256"}'],
     // ...existing test cases...
 ];
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
return [
'invalid format' => ['{"invalid-ip"}'],
'invalid IPv4 in array' => ['{"256.256.256.256"}'],
'invalid IPv6 in array' => ['{"2001:xyz::1"}'],
'malformed array' => ['not-an-array'],
'empty item in array' => ['{"192.168.1.1",""}'],
'invalid item in array' => ['{"192.168.1.1","invalid-ip"}'],
'invalid CIDR in array' => ['{"192.168.1.0/33"}'],
'incomplete IPv4 in array' => ['{"192.168.1"}'],
'incomplete IPv6 in array' => ['{"2001:db8"}'],
];
}
return [
'non-string value' => [123],
'invalid format' => ['{"invalid-ip"}'],
'invalid IPv4 in array' => ['{"256.256.256.256"}'],
'invalid IPv6 in array' => ['{"2001:xyz::1"}'],
'malformed array' => ['not-an-array'],
'empty item in array' => ['{"192.168.1.1",""}'],
'invalid item in array' => ['{"192.168.1.1","invalid-ip"}'],
'invalid CIDR in array' => ['{"192.168.1.0/33"}'],
'incomplete IPv4 in array' => ['{"192.168.1"}'],
'incomplete IPv6 in array' => ['{"2001:db8"}'],
];
}

@martin-georgiev martin-georgiev dismissed coderabbitai[bot]’s stale review April 11, 2025 13:35

not applicable at this point

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.

2 participants