Skip to content

Numeric casts could emit a warning it they do not make sense #8296

Closed
@mvorisek

Description

@mvorisek

Description

(float) '1';
(float) '1.0';
(float) '';
(float) 'x'; // should always warn

(int) '1';
(int) '1.0';
(int) '';
(int) 'x'; // should always warn

https://3v4l.org/gDLOv

This is a feature request. The casts above are advised by many static analysers, but if added explicitly, there is currently no warning emit. They should at least emit a warning if the input is not numerical and the cast does not make sense.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions