public function interact(QuestionsSet $questions) { $questions->communicate('php_cs_preset', Question::choice('PHP-CS Preset', ['none', 'psr1', 'psr2', 'symfony', 'laravel', 'recommended'], 'symfony')); $questions->communicate('php_cs_enabled_fixers', Question::ask('PHP-CS Fixers', 'none', function ($value) { if ('none' === $value) { return $value; } $fixers = $this->splitValues($value); $fixers = array_unique($fixers); foreach ($fixers as $fixer) { $fixer = trim($fixer); if (!in_array($fixer, Fixers::$valid, true)) { throw new \InvalidArgumentException(sprintf('Fixer "%s" is not supported.', $fixer)); } if (isset(Fixers::$conflicts[$fixer]) && ($conflicts = array_intersect((array) Fixers::$conflicts[$fixer], $fixers))) { throw new \InvalidArgumentException(sprintf('Fixer "%s" conflicts with fixers "%s".', $fixer, implode('", "', $conflicts))); } // XXX Need to validate 'here' if the enabled fixers conflict with the preset. } return $value; })->markOptional('none')); $questions->communicate('php_cs_disabled_fixers', Question::ask('PHP-CS Disabled fixers', 'none', function ($value) { if ('none' === $value) { return $value; } $fixers = $this->splitValues($value); $fixers = array_unique($fixers); foreach ($fixers as $fixer) { $fixer = trim($fixer); if (!in_array($fixer, Fixers::$valid, true)) { throw new \InvalidArgumentException(sprintf('Fixer "%s" is not supported.', $fixer)); } } return $value; })->markOptional('none')); $questions->communicate('php_cs_linting', Question::confirm('Enable PHP-CS linting?', false)); if ($questions->communicate('styleci_enabled', Question::confirm('Enable StyleCI (local configuration)?', true))) { $questions->set('php_cs_version_1_bc', false); $questions->communicate('php_cs_styleci_bridge', Question::confirm('Enable StyleCI bridge', true)); } else { $questions->set('php_cs_styleci_bridge', false); $questions->communicate('php_cs_version_1_bc', Question::confirm('Enable PHP-CS v1 compatibility?', true)); } // Finder questions. $questions->communicate('php_cs_finder_path', Question::ask('PHP-CS Finder {path}', 'src', false)->markOptional()); $questions->communicate('php_cs_finder_not_path', Question::ask('PHP-CS Finder {not path}', '!*', false)->markOptional('!*')); $questions->communicate('php_cs_finder_exclude', Question::ask('PHP-CS Finder {exclude dirs}', '!*', false)->markOptional('!*')); $questions->communicate('php_cs_finder_name', Question::ask('PHP-CS Finder {name}', '*', false)->markOptional('*')); $questions->communicate('php_cs_finder_not_name', Question::ask('PHP-CS Finder {not name}', '!*', false)->markOptional('!*')); $questions->communicate('php_cs_finder_contains', Question::ask('PHP-CS Finder {contains}', '*', false)->markOptional('*')); $questions->communicate('php_cs_finder_not_contains', Question::ask('PHP-CS Finder {not contains}', '!*', false)->markOptional('!*')); $questions->communicate('php_cs_finder_depth', Question::ask('PHP-CS Finder {depth}', '*', false)->markOptional('*')); }
public function interact(QuestionsSet $questions) { if ('MPL-2.0' === $questions->communicate('license', Question::choice('License', self::getLicenses(), 'MIT')->setHelp('Labeled with "+" means higher inclusive'))) { $questions->communicate('license_secondary_incompatibility', Question::confirm('Incompatible With Secondary Licenses?', false)); } else { $questions->set('license_secondary_incompatibility', false); } }
public function interact(QuestionsSet $questions) { $questions->communicate('composer_type', Question::ask('Composer package type', 'library')); if ('stable' !== $questions->communicate('composer_minimum_stability', Question::choice('Minimum stability', ['dev', 'alpha', 'beta', 'RC', 'stable'], 'stable')->markOptional())) { $questions->communicate('composer_prefer_stable', Question::confirm('Prefer stable?', true)->markOptional()); } else { $questions->set('composer_prefer_stable', false); } }
public function interact(QuestionsSet $questions) { $questions->communicate('enable_phpunit', Question::confirm('Enable PHPUnit?', true)); if ($questions->communicate('enable_phpspec', Question::confirm('Enable PHPSpec?', false))) { $questions->communicate('phpspec_suite_name', Question::confirm('PHPSpec suite-name', function (array $values) { return isset($values['name']) ? StringUtil::shortProductName($values['name']) : null; })); } else { $questions->set('phpspec_shortname', null); } if ($questions->communicate('enable_behat', Question::confirm('Enable Behat?', false))) { $questions->communicate('behat_suite_name', Question::ask('Behat suite-name', function (array $values) { return isset($values['name']) ? StringUtil::shortProductName($values['name']) : null; })); } else { $questions->set('behat_shortname', null); } $questions->communicate('enable_mink', Question::confirm('Enable Mink?', false)); }