rector: The "--set" option does not exist.

I’m trying to move from the library to phpexcel on phpspreadsheet. vendor/bin/rector process /src/ --set phpexcel-to-phpspreadsheet Gives an error message ‘The “–set” option does not exist.’ I understood that you turned off the option “–set”. But I did not find which option should be added in $rectorConfig->sets([ SetList::CODE_QUALITY ]);

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

I created PR https://github.com/rectorphp/rector-phpoffice/pull/18 to ensure show “Applied rules” only when changed for

  • AddRemovedDefaultValuesRector
  • ChangePdfWriterRecto

Yeah I think I’m going to set up a limit to only process the files that contain a reference to PHPExcel, because this codebase is an absolute mess with embedded dependencies, thanks again for the pointers!

@linaori Thanks! I’ve send update PR and updated the issue: https://github.com/PHPOffice/PhpSpreadsheet/pull/2861/files

I came here following directions from the spreadsheet repository, I don’t think I’ve found any guides that reference it incorrectly, just differently: https://github.com/PHPOffice/PhpSpreadsheet/issues/1445 https://phpspreadsheet.readthedocs.io/en/latest/topics/migration-from-PHPExcel/

The “–set” option does not exist.

This is expected. This option does now exist anymore. It was removed ~1,5 year ago, when we moved to config sets() method.

I’m running into the same issue. I’ve got that specific config in rector.php:

<?php

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\PHPOffice\Set\PHPOfficeSetList;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->sets([
        PHPOfficeSetList::PHPEXCEL_TO_PHPSPREADSHEET
    ]);
};

When I then run vendor/rector/rector/bin/rector process src --set phpexcel-to-phpspreadsheet I get: The “–set” option does not exist. This is a fresh rector install, and I’ve done the init.

In addition to that it seems to process rules I don’t want it to process. I only want it to process the phpexcel -> spreadsheet changes, but it’s touching things like unused arguments. Yes I need to fix them, but another time.

You can define:

use Rector\PHPOffice\Set\PHPOfficeSetList;
use Rector\Config\RectorConfig;

return static function (RectorConfig $rectorConfig): void {
    $rectorConfig->sets([
        PHPOfficeSetList::PHPEXCEL_TO_PHPSPREADSHEET
    ]);
};

ref https://github.com/rectorphp/rector-phpoffice#use-sets