Skip to content

Incorrect union type report in try catch #660

@kaliberx

Description

@kaliberx
$ cat error.php
<?php

try {
    // nothing
} catch (Exception|RuntimeException) {
}

 ./phpcs.phar --standard=PSR12 error.php

FILE: .../error.php
---------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
---------------------------------------------------------------------------
 5 | ERROR | [x] Expected at least 1 space before "|"; 0 found
 5 | ERROR | [x] Expected at least 1 space after "|"; 0 found
---------------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
---------------------------------------------------------------------------

Expected behavior

No error reported.

Please confirm

Sorry, tested on 3.10.3, not on the master.

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