Skip to content

False positive when converting to native enums  #355

@atymic

Description

@atymic

For some reason the rector rule is catching random bits of unrelated code, for example the below sample.
It seems to be a bit random, will attempt to debug further to figure out why, by have narrowed it down to \BenSampo\Enum\Rector\ToNativeRector::inConfiguredClasses returning true when it should not.

    ---------- begin diff ----------
@@ @@
     {
         $jwtHeader = explode(' ', $request->header('authorization', ''));

-        abort_if(empty($jwtHeader) || count($jwtHeader) !== 2, 400);
+        abort_if((empty($jwtHeader))->value || count($jwtHeader) !== 2, 400);

         $jwt = $jwtHeader[1];
    ----------- end diff -----------

Applied rules:
 * ToNativeUsagesRector

Screen Shot 2024-02-18 at 18 09 00@2x

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions