protected function getSupportedOptions()

in src/__Private/MigrationCLI.hack [54:235]


  protected function getSupportedOptions(): vec<CLIOptions\CLIOption> {
    $options = vec[
      CLIOptions\with_required_string(
        ($class) ==> {
          try {
            $this->migrations[] = TypeAssert\classname_of(
              BaseMigration::class,
              $class,
            );
          } catch (TypeAssert\IncorrectTypeException $_) {
            throw new ExitException(1, Str\format(
              "'%s' is not a subclass of %s",
              $class,
              BaseMigration::class,
            ));
          }
        },
        'Run the migration with the specified fully-qualified classname',
        '--migration-classname',
      ),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = HSLMigration::class;
        },
        'Convert PHP standard library calls to HSL',
        '--hsl',
      ),
      self::removed('--assert-to-expect', '4.11.* or below'),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = ImplicitShapeSubtypesMigration::class;
        },
        'Allow implicit structural subtyping of all shapes',
        '--implicit-shape-subtypes',
      ),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = OptionalShapeFieldsMigration::class;
        },
        'Migrate nullable shape fields to be both nullable and optional',
        '--optional-shape-fields',
      ),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = DollarBraceEmbeddedVariableMigration::class;
        },
        'Migrate instances of "${foo}" to "{$foo}"',
        '--dollar-brace-variable-interpolation',
      ),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = OptionalShapeFieldsMigration::class;
          $this->migrations[] = ImplicitShapeSubtypesMigration::class;
        },
        'Apply all migrations for moving from 3.22 to 3.23',
        '--hhvm-3.22-to-3.23',
      ),
      self::removed('--ctpbr', '4.8.* or below'),
      self::removed('--hhvm-3.23-to-3.24', '4.8.* or below'),
      self::removed('--hhvm-4.2-to-4.3', '4.2.* or below'),
      self::removed('--ltgt-to-ne', '4.2.* or below'),
      self::removed('--hhvm-3.28-to-3.29', '4.2.* or below'),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = IsRefinementMigration::class;
        },
        'Replace is_foo() with is expressions',
        '--is-refinement',
      ),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = IsRefinementMigration::class;
        },
        'Apply all migrations for moving from 3.29 to 3.30',
        '--hhvm-3.29-to-3.30',
      ),
      self::removed('--no-namespace-fallback', '4.11.* or below'),
      self::removed('--phpunit-to-hacktest', '4.11.* or below'),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = ExplicitPartialModeMigration::class;
        },
        "Add `// partial` to files that don't specify a mode",
        '--explicit-partial-mode',
      ),
      self::removed('--hhvm-4.0-to-4.1', '4.11.* or below'),
      self::removed('--hhast-4.5-linter-to-4.6', '4.11'),
      self::removed('--await-precedence', '4.5.2'),
      self::removed('--hhvm-4.5-to-4.6', '4.5.2'),
      self::removed('--empty-expression', '4.6.1'),
      self::removed('--hhvm-4.6-to-4.7', '4.6.1'),
      self::removed('--instanceof-is', '4.14.*'),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = TopLevelRequiresMigration::class;
        },
        'Migrate top-level require()s to <<__EntryPoint>> functions',
        '--top-level-requires',
      ),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = AddFixmesMigration::class;
        },
        'Add /* HH_FIXME[] */ comments where needed',
        '--add-fixmes',
      ),
      self::removed('--php-arrays', '4.33.6 to 4.41.2'),
      self::removed('--php-array-typehints-soft', '4.64.4 to 4.64.6'),
      self::removed('--php-array-typehints-hard', '4.64.4 to 4.64.6'),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] =
            HHAST\HardenVarrayOrDarrayTypehintsMigration::class;
        },
        'Remove <<__Soft>> from varray_or_darray typehints (recommended after '.
        'migrating to HHVM 4.68+)',
        '--harden-varray-or-darray-typehints',
      ),
      self::removed('--php-array-typehints-best-guess', '4.64.4 to 4.64.6'),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = AddXHPChildrenDeclarationMethodMigration::class;
        },
        'Add getChildrenDeclaration() method to XHP classes with a children declaration',
        '--add-xhp-children-declaration-method',
      ),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = DemangleXHPMigration::class;
        },
        'Replace "-" in XHP class names with "_"',
        '--demangle-xhp-class-names',
      ),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = RemoveXHPChildDeclarationsMigration::class;
        },
        'Remove `children` declarations from XHP classes, and update validation traits',
        '--remove-xhp-child-declarations',
      ),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = XHPClassModifierMigration::class;
        },
        'Migrate `class :foo:bar` to `xhp class foo:bar`',
        '--xhp-class-modifier',
      ),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = HHAST\XHPLibV3ToV4Migration::class;
        },
        'Migrate class/function names changed in xhp-lib v4, add necessary '.
        '`use` clauses (incl. HTML tags)',
        '--xhp-lib-v3-to-v4',
      ),
      CLIOptions\flag(
        () ==> {
          $this->migrations[] = Fixme4110Migration::class;
        },
        'Migrate /* HH_FIXME[4110] */ to the equivalent new error codes',
        '--migrate-fixme-4110',
      ),
      self::removed('--ref-to-inout', '>=4.21.7 <4.29'),
      CLIOptions\flag(
        () ==> {
          $this->includeVendor = true;
        },
        'Also migrate files in vendor/ subdirectories',
        '--include-vendor',
      ),
      CLIOptions\flag(
        () ==> {
          $this->xhprof = true;
        },
        'Enable XHProf profiling',
        '--xhprof',
      ),
    ];

    $options[] = $this->getVerbosityOption();
    return $options;
  }