Skip to content

(binary) not tokenized as T_BINARY_CAST #1574

@jrfnl

Description

@jrfnl

There are two ways to cast to binary as introduced in PHP 5.2.1:

  • $binary = b"binary string";
  • $binary = (binary) $string;

The first one is identified by PHPCS as T_BINARY_CAST, while the second is not.

By the looks of it, PHP itself incorrectly tokenizes this as T_STRING_CAST. See: https://3v4l.org/n0DJj

Ref: http://php.net/manual/en/language.types.type-juggling.php#language.types.typecasting

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions