Skip to content

Bug unintentional type cast from float to int  #1163

Description

@Selion05

@prettier/plugin-php v0.11.2
Playground link

Input:

<?php

$check = 1. === 1.0;

if ($check) {
    echo 'true';
} else {
    echo 'false';
}
echo PHP_EOL;

Output:

<?php

$check = 1 === 1.0;

if ($check) {
    echo 'true';
} else {
    echo 'false';
}
echo PHP_EOL;

A number 1. should be formatted as 1.0 not 1

Btw nice issue reporter :D

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions