Skip to content

Refactor ColumnDefinitionParser - #466

Open
vjik wants to merge 4 commits into
masterfrom
improve-parse
Open

Refactor ColumnDefinitionParser#466
vjik wants to merge 4 commits into
masterfrom
improve-parse

Conversation

@vjik

@vjikvjik commented Nov 25, 2025

Copy link
Copy Markdown
Member
QA
Is bugfix?
New feature?
Breaks BC?✔️

Related to yiisoft/db#1108

@codecov

codecovBot commented Nov 25, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.71%. Comparing base (9f0ec01) to head (69ca702).
⚠️ Report is 22 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@## master #466 +/- ##
============================================
+ Coverage 96.64% 96.71% +0.06% + Complexity 409 407 -2 
============================================
Files 66 66 Lines 1192 1216 +24 ============================================
+ Hits 1152 1176 +24 
Misses 40 40 

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samdark
samdark requested a review from CopilotNovember 25, 2025 21:17

CopilotAI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the ColumnDefinitionParser class to extend from AbstractColumnDefinitionParser instead of directly implementing the parsing logic. The refactoring delegates core parsing logic to the parent class while maintaining PostgreSQL-specific type handling through the new parseTypeParams() method.

  • Simplified parseDefinition() method to return raw parsed components instead of fully processed info
  • Introduced parseTypeParams() using match expressions to handle PostgreSQL-specific type parameter parsing
  • Removed unnecessary imports and psalm-suppress annotation

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

FileDescription
src/Column/ColumnDefinitionParser.phpRefactored to extend AbstractColumnDefinitionParser, simplified parsing methods, and added PostgreSQL-specific type parameter handling via match expression
tests/ArrayParserTest.phpRemoved unnecessary @psalm-suppress PropertyNotSetInConstructor annotation
CHANGELOG.mdAdded entry documenting the breaking change refactor

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vjik
vjik requested a review from a teamNovember 25, 2025 21:37
@vjikvjik added the status:code review The pull request needs review. label Nov 25, 2025
@vjik
vjik requested a review from samdarkNovember 25, 2025 21:37
$typeDetails = $matches[4] ?? $matches[2] ?? '';

if ($typeDetails !== '') {
if ($type === 'enum') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

'enum' here and in other drivers should be an abstract type and must be parsable.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Enum couldn't use in column definition directly.

'varbit',
'varchar' => $this->parseSizeInfo($params),
default => [],
};

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Abstract, pseudo, or user-defined types must also be parsable.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Why need to parse abstract and pseudo type? What case when this is needed?

Isn't custom types are support parameters?

@vjikvjik added status:under development Someone is working on a pull request. and removed status:code review The pull request needs review. labels Nov 29, 2025
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:under developmentSomeone is working on a pull request.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@vjik@samdark@Tigrov