/*
* This file is part of Psy Shell.
*
- * (c) 2012-2017 Justin Hileman
+ * (c) 2012-2018 Justin Hileman
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
namespace Psy\Input;
+use Psy\Exception\ErrorException;
use Psy\Exception\RuntimeException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
*/
public static function getOptions()
{
- return array(
+ return [
new InputOption('grep', 'G', InputOption::VALUE_REQUIRED, 'Limit to items matching the given pattern (string or regex).'),
new InputOption('insensitive', 'i', InputOption::VALUE_NONE, 'Case-insensitive search (requires --grep).'),
new InputOption('invert', 'v', InputOption::VALUE_NONE, 'Inverted search (requires --grep).'),
- );
+ ];
}
/**
private function validateInput(InputInterface $input)
{
if (!$input->getOption('grep')) {
- foreach (array('invert', 'insensitive') as $option) {
+ foreach (['invert', 'insensitive'] as $option) {
if ($input->getOption($option)) {
throw new RuntimeException('--' . $option . ' does not make sense without --grep');
}
*/
private function validateRegex($pattern)
{
- set_error_handler(array('Psy\Exception\ErrorException', 'throwException'));
+ set_error_handler(['Psy\Exception\ErrorException', 'throwException']);
try {
preg_match($pattern, '');
} catch (ErrorException $e) {