Check types of repository method parameter values

Open
#763 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

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

Research direction

Start by reproducing repository count with a BcMath\Number value for a Types::NUMBER field, then trace the parameter-type checking path in the Doctrine extension. Compare the current diagnostic with Doctrine DBAL's accepted types and verify that the relevant repository-method checks handle the value consistently.

Written by the indexing model from the issue text.

Description

I keep opening the can of worms with BcMath\Number.

Now ran into a problem without any advance warning where one can't do $repository->count(['field' => 0]) on a BcMath\Number / Types::NUMBER field because:

Could not convert PHP value 0 to type Doctrine\DBAL\Types\NumberType. Expected one of the following types: null, BcMath\Number

Unless it's relaxed on Doctrine side, it would be great if those types were checked also.

Related issue: https://github.com/doctrine/dbal/issues/7383

Dominant language
PHP
Stars
678
Forks
122
Avg merge
5d 18h
Merged PRs (30d)
3

Contributor guide

No contributing guide indexed for this repository

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.

More from phpstan/phpstan-doctrine

All issues in phpstan/phpstan-doctrine

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.