Skip to content

Parameter type hint rector is trying to add a non supported resource type hint #1663

@tigitz

Description

@tigitz
Subject Details
PHP version the one in docker image
Full Command docker run --rm -it -v $(pwd):/project rector/rector:latest process /project --config /project/rector.yaml --autoload-file /project/vendor/autoload.php -vvv

Current Behaviour

@@ -221,7 +221,7 @@
      *
      * @return mixed A string representing the line or null if beginning of file is reached
      */
-    protected function readLineFromFile($file)
+    protected function readLineFromFile(resource $file)

With Rector\TypeDeclaration\Rector\FunctionLike\ParamTypeDeclarationRector:

Minimal PHP Code Causing Issue

    /**
     * @param resource $file The file resource, with the pointer placed at the end of the line to read
     */
    protected function readLineFromFile($file)
    {
    }

Expected Behaviour

No fix.

Although it might be tricky as the following is valid php code

class resource {}

function test(resource $test) {}

test(new resource);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions