Skip to content

Sql lint fixes: named literal arguments, isset, empty and elvis - #203

Merged
simon-mundy merged 3 commits into
php-db:0.6.xfrom
simon-mundy:qa/mago-sql-lint
Oct 6, 2026
Merged

simon-mundy merged 3 commits into
php-db:0.6.xfrom
simon-mundy:qa/mago-sql-lint

Conversation

@simon-mundy

Copy link
Copy Markdown
Member

Clears the literal-named-argument, no-isset, no-empty, no-shorthand-ternary and no-negated-ternary Mago lint findings in src/Sql, removing 41 lint baseline entries.

Changes

  • Literal arguments to built-in functions (str_replace, array_fill, array_splice, trim, explode, stripos, is_a) are passed by name.
  • isset() checks become explicit null comparisons, (... ?? null) checks or ??=, so null entries behave as before.
  • empty($this->order) in Select::processOrder() becomes [] === $this->order.
  • Sql::delete(), insert(), select() and update() use ?? instead of ?:. Each constructor already treats a falsy table as no table, so the result is the same.
  • AbstractSql::createSqlFromSpecificationAndParameters() records the matching specification instead of unset()-ing the loop variables to detect a miss.
  • Platform::getTypeDecorator() reads the platform's decorator map into a local once, instead of re-indexing it for each check.
  • Lint and analyzer baselines are regenerated; only src/Sql entries change.

Breaking changes

None.

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

isset() checks become explicit null comparisons or ??=, so the
behaviour for null entries is unchanged. Sql's factory methods switch
from ?: to ??, which is equivalent because every constructor already
treats a falsy table as no table.

Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
@codecov

codecov Bot commented Oct 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

…ameters()

Clears the prefer-early-continue lint hint raised by the rewritten loop.

Signed-off-by: Simon Mundy <simon.mundy@peptolab.com>
@simon-mundy simon-mundy mentioned this pull request Oct 4, 2026
@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 4, 2026
@github-project-automation github-project-automation Bot moved this to Todo in @phpdb Oct 4, 2026
@simon-mundy simon-mundy added this to the 0.6.0 milestone Oct 4, 2026
@simon-mundy simon-mundy self-assigned this Oct 4, 2026
@simon-mundy
simon-mundy requested a review from tyrsson October 5, 2026 23:47
@simon-mundy
simon-mundy merged commit 7e34877 into php-db:0.6.x Oct 6, 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.

2 participants