Skip to content

Fix issues in PostgresGrammar#59545

Open
niduranga wants to merge 1 commit intolaravel:13.xfrom
niduranga:13.x
Open

Fix issues in PostgresGrammar#59545
niduranga wants to merge 1 commit intolaravel:13.xfrom
niduranga:13.x

Conversation

@niduranga
Copy link
Copy Markdown
Contributor

This PR improves the code quality of PostgresGrammar.php by resolving several undefined property access issues and ensuring consistent method return types.
Key Improvements:

  1. Refactored Property Access: Updated direct property access on Fluent and ColumnDefinition objects to use the get() method. This ensures more reliable access to dynamic properties like column, autoIncrement, and name.
  2. Standardized Return Paths: Added missing return statements to compileAutoIncrementStartingValues() to ensure the method always provides a return value, even when conditions are not met.
  3. Enhanced Type Safety: Used explicit method calls instead of magic property access to make the codebase more robust and easier for static analysis tools to understand.

Specific Changes:

  • Replaced direct $command->column and $column->autoIncrement / $column->name access with get() method calls (Lines 257, 270, 271, 273, 274, 275, 278).
  • Added a proper return statement for cases where auto-increment starting values are not applicable.

Testing:

  • Verified that all existing database schema tests pass for PostgreSQL using vendor/bin/phpunit tests/Database/DatabasePostgresSchemaGrammarTest.php.
  • Manual code review to ensure no breaking changes in SQL generation.

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.

1 participant