Skip to content

SlevomatCodingStandard.Variables.UnusedVariable false positive with compact #1819

@arxeiss

Description

@arxeiss

Hi,

the sniff SlevomatCodingStandard.Variables.UnusedVariable is reporting all variables as unused, if they are used only in compact function.

Here variable $students is reported as unused. Strange is, it worked well for 8.20.0 and now after upgrade to 8.25.1 it reports those variables.

public function index(): View
    {
        $this->authorize('parentList', Student::class);
        $students = $this->studentService->getListForParent(Auth::user())->get();

        return \view('students.list', \compact('students'));
    }

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