yiisoft / yiisoft/db

Pass to `ColumnInterface::dbTypecast()` non-null and non-expression values only

Open
#960 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status:ready for adoption
Dominant language
PHP
Stars
216
Forks
51
Avg merge
3d 10h
Merged PRs (30d)
2

Description

Seems, all implementations of ColumnInterface::dbTypecast() checks value on null and ExpressionInterface and return it as is for those values:

if ($value === null || $value instanceof ExpressionInterface) {
    return $value;
}

We can check it before call dbTypecast() and simplify simplify both existing implementations and the creation of custom ones.

⚠️ Don't implement it before start version 3.0 development.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating ColumnInterface::dbTypecast(), its implementations, and the callers that pass values to it; inspect how ExpressionInterface and null are currently handled. Confirm the change is appropriate for the 3.0 development window, then run the relevant database test suite and verify that null and expression values remain unchanged while other values are typecast.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
databases
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.