Skip to content

Doctrine and float and string #71

Closed
@danielspk

Description

@danielspk

Hi, is it feasible for the plugin to detect Doctrine's behavior with respect to floats being handled as a string? Example:

/**
 * @Entity
 */
class Demo
{
    /** @Column(type="decimal", precision=10, scale=2) */
    private $price;

    /**
     * Set price.
     *
     * @param string $number
     *
     * @return Demo
     */
    public function setPrice($number)
    {
        $this->price = $number;

        return $this;
    }
}

$demo = new Demo();
$demo->setPrice(0.0);

Error output: Parameter #1 $number of method Demo::setPrice() expects string, float given

Note: The Doctrine orm: generate-entities console command generates the method with its parameter as string.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions