Skip to content

Describe any kind of table in Sql's foreign-table exception - #226

Merged
simon-mundy merged 5 commits into
php-db:0.6.xfrom
simon-mundy:fix/210-foreign-table-message
Oct 9, 2026
Merged

simon-mundy merged 5 commits into
php-db:0.6.xfrom
simon-mundy:fix/210-foreign-table-message

Conversation

@simon-mundy

Copy link
Copy Markdown
Member

Fixes #210.

Sql::delete(), insert(), select() and update() passed their table to forForeignTable(string), which raised a TypeError when the table was a TableIdentifier or an aliased array.

Changes

  • Sql\Exception\InvalidArgumentException::forForeignTable() accepts string|TableIdentifier|array. It describes a TableIdentifier as schema.table (or table without a schema), and an aliased array as table AS alias.
  • InvalidArgumentExceptionTest and SqlTest cover each kind of table.

Breaking changes

None. The parameter type is widened.

mago format, mago lint, mago analyze and the unit tests pass.

Sql::delete(), insert(), select() and update() passed their table to
forForeignTable(string), which raised a TypeError when the table was a
TableIdentifier or an aliased array. forForeignTable() now accepts all
three and describes a TableIdentifier as schema.table and an aliased
array as "table AS alias".

Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
@simon-mundy simon-mundy added documentation Improvements or additions to documentation qa Improvements in quality assurance of the project Lang Feature Refactor Refactoring to new language features labels Oct 5, 2026
@github-project-automation github-project-automation Bot moved this to Todo in @phpdb Oct 5, 2026
@simon-mundy simon-mundy added this to the 0.6.0 milestone Oct 5, 2026
@simon-mundy simon-mundy self-assigned this Oct 5, 2026
@codecov

codecov Bot commented Oct 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…table-message

# Conflicts:
#	analyzer-baseline.toml
@simon-mundy
simon-mundy requested a review from tyrsson October 6, 2026 02:22
tyrsson
tyrsson previously approved these changes Oct 8, 2026
…ble-message

# Conflicts:
#	analyzer-baseline.toml
#	test/unit/Sql/SqlTest.php

Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
@simon-mundy
simon-mundy merged commit 7d1b659 into php-db:0.6.x Oct 9, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation Lang Feature Refactor Refactoring to new language features qa Improvements in quality assurance of the project

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Sql's foreign-table guard raises TypeError when its table is a TableIdentifier or aliased array

2 participants