Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect behavior of ReturnTypeFromStrictScalarReturnExprRector #7978

Closed
mvhirsch opened this issue Jun 9, 2023 · 1 comment · Fixed by rectorphp/rector-src#4132
Closed
Labels

Comments

@mvhirsch
Copy link

mvhirsch commented Jun 9, 2023

Bug Report

I love ❤️ rector. It saves me from heart attacks while refactoring code!

Subject Details
Rector version v0.17
Installed as composer dependency

Minimal PHP Code Causing Issue

See https://getrector.com/demo/b04a9224-2e56-4de9-b568-fff214079a16

<?php

final class DemoFile
{
    private function isConnected()
    {
        return is_array(ftp_nlist($this->connection, '.'));
    }
}

Responsible rules

  • ReturnTypeFromStrictScalarReturnExprRector

Expected Behavior

Usually is_array returns a boolean. I expected something like this:

private function isConnected(): bool
{
// ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant