Skip to content

System error: "Return value of RectorPrefix202305\Nette\Utils\Reflection::getUseStatements() must be of the type array, null returned" #7942

@mega

Description

@mega

Got this error by running rector with --debug on an Entity class using ApiPlatform resource class

<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
use Rector\Symfony\Set\SymfonySetList;
use Rector\Doctrine\Set\DoctrineSetList;
use Rector\Core\ValueObject\PhpVersion;

return static function (RectorConfig $rectorConfig): void {
    // define sets of rules
    $rectorConfig->sets([
        LevelSetList::UP_TO_PHP_82,
    ]);

    $rectorConfig->importNames();
    $rectorConfig->importShortClasses(false);
    $rectorConfig->phpVersion(PhpVersion::PHP_82);

    $rectorConfig->paths([
        __DIR__ . '/src',
    ]);

};

error.txt

entity-service:/srv/api$ php vendor/bin/rector --version
Rector 0.16.0

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