Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/grumphp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,14 @@ jobs:
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies (highest)
if: matrix.composer-deps == 'highest'
run: composer update --prefer-dist --no-progress --no-suggest
run: |
composer config platform.php ${{ matrix.php-versions }}
composer update --prefer-dist --no-progress --no-suggest --ignore-platform-req=php+
- name: Install dependencies (lowest)
if: matrix.composer-deps == 'lowest'
run: composer update --prefer-dist --no-progress --no-suggest --prefer-lowest
run: |
composer config platform.php ${{ matrix.php-versions }}
composer update --prefer-dist --no-progress --no-suggest --prefer-lowest --ignore-platform-req=php+
- name: Install dependencies (lock)
if: matrix.composer-deps == 'lock'
run: |
Expand Down
14 changes: 10 additions & 4 deletions src/Configuration/LoaderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,22 @@ final class LoaderFactory
public static function createLoader(ContainerBuilder $container, array $paths = []): DelegatingLoader
{
$locator = new FileLocator($paths);
$resolver = new LoaderResolver([
$xmlLoader = new XmlFileLoader($container, $locator, self::ENV),

/** @Deprecated - Remove in a future version of PHP where SF > 7.4 */
$xmlLoader = class_exists(XmlFileLoader::class)
? new XmlFileLoader($container, $locator, self::ENV)
: null;

$resolver = new LoaderResolver(array_filter([
$xmlLoader,
$yamlLoader = new YamlFileLoader($container, $locator, self::ENV),
$iniLoader = new IniFileLoader($container, $locator, self::ENV),
new GlobFileLoader($container, $locator, self::ENV),
new DirectoryLoader($container, $locator, self::ENV),
new DistFileLoader($xmlLoader),
$xmlLoader ? new DistFileLoader($xmlLoader) : null,
new DistFileLoader($yamlLoader),
new DistFileLoader($iniLoader),
]);
]));

return new DelegatingLoader($resolver);
}
Expand Down
9 changes: 2 additions & 7 deletions src/Console/Command/ConfigureCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use GrumPHP\Configuration\Resolver\TaskConfigResolver;
use GrumPHP\Util\Filesystem;
use GrumPHP\Util\Paths;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\QuestionHelper;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -17,10 +18,9 @@
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\Yaml\Yaml;

#[AsCommand(name: 'configure', description: 'Create a grumphp configuration file')]
class ConfigureCommand extends Command
{
const COMMAND_NAME = 'configure';

/**
* @var TaskConfigResolver
*/
Expand Down Expand Up @@ -51,11 +51,6 @@ public function __construct(TaskConfigResolver $taskConfigResolver, Filesystem $
$this->paths = $paths;
}

public static function getDefaultName(): string
{
return self::COMMAND_NAME;
}

protected function configure(): void
{
$this->addOption(
Expand Down
10 changes: 2 additions & 8 deletions src/Console/Command/Git/CommitMsgCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use GrumPHP\Collection\FilesCollection;
use GrumPHP\Collection\TestSuiteCollection;
use GrumPHP\IO\IOFactory;
use GrumPHP\IO\IOInterface;
use GrumPHP\Locator\ChangedFiles;
use GrumPHP\Locator\StdInFiles;
Expand All @@ -16,6 +15,7 @@
use GrumPHP\Util\Filesystem;
use GrumPHP\Util\Paths;
use SplFileInfo;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
Expand All @@ -25,9 +25,9 @@
/**
* This command runs the git commit-msg hook.
*/
#[AsCommand(name: 'git:commit-msg', description: 'Executed by the commit-msg commit hook')]
class CommitMsgCommand extends Command
{
const COMMAND_NAME = 'git:commit-msg';
const EXIT_CODE_OK = 0;
const EXIT_CODE_NOK = 1;

Expand Down Expand Up @@ -83,14 +83,8 @@ public function __construct(
$this->io = $io;
}

public static function getDefaultName(): string
{
return self::COMMAND_NAME;
}

protected function configure(): void
{
$this->setDescription('Executed by the commit-msg commit hook');
$this->addOption('git-user', null, InputOption::VALUE_REQUIRED, 'The configured git user name.', '');
$this->addOption('git-email', null, InputOption::VALUE_REQUIRED, 'The configured git email.', '');
$this->addArgument('commit-msg-file', InputArgument::REQUIRED, 'The configured commit message file.');
Expand Down
13 changes: 2 additions & 11 deletions src/Console/Command/Git/DeInitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@

use GrumPHP\Util\Filesystem;
use GrumPHP\Util\Paths;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* This command is responsible for removing all the configured hooks.
*/
#[AsCommand(name: 'git:deinit', description: 'Removes the commit hooks')]
class DeInitCommand extends Command
{
const COMMAND_NAME = 'git:deinit';

/**
* @var array
*/
Expand All @@ -35,11 +35,6 @@ class DeInitCommand extends Command
*/
private $paths;

public static function getDefaultName(): string
{
return self::COMMAND_NAME;
}

public function __construct(
Filesystem $filesystem,
Paths $paths
Expand All @@ -50,10 +45,6 @@ public function __construct(
$this->paths = $paths;
}

protected function configure(): void
{
$this->setDescription('Removes the commit hooks');
}

public function execute(InputInterface $input, OutputInterface $output): int
{
Expand Down
14 changes: 2 additions & 12 deletions src/Console/Command/Git/InitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
use GrumPHP\Util\Filesystem;
use GrumPHP\Util\Paths;
use RuntimeException;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

/**
* This command is responsible for enabling all the configured hooks.
*/
#[AsCommand(name: 'git:init', description: 'Registers the Git hooks')]
class InitCommand extends Command
{
const COMMAND_NAME = 'git:init';

/**
* @var array
*/
Expand Down Expand Up @@ -70,16 +70,6 @@ public function __construct(
$this->paths = $paths;
}

public static function getDefaultName(): string
{
return self::COMMAND_NAME;
}

protected function configure(): void
{
$this->setDescription('Registers the Git hooks');
}

public function execute(InputInterface $input, OutputInterface $output): int
{
$this->input = $input;
Expand Down
10 changes: 2 additions & 8 deletions src/Console/Command/Git/PreCommitCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

use GrumPHP\Collection\FilesCollection;
use GrumPHP\Collection\TestSuiteCollection;
use GrumPHP\IO\IOFactory;
use GrumPHP\IO\IOInterface;
use GrumPHP\Locator\ChangedFiles;
use GrumPHP\Locator\StdInFiles;
use GrumPHP\Runner\TaskRunner;
use GrumPHP\Runner\TaskRunnerContext;
use GrumPHP\Task\Context\GitPreCommitContext;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand All @@ -21,9 +21,9 @@
/**
* This command runs the git pre-commit hook.
*/
#[AsCommand(name: 'git:pre-commit', description: 'Executed by the pre-commit hook')]
class PreCommitCommand extends Command
{
const COMMAND_NAME = 'git:pre-commit';
const EXIT_CODE_OK = 0;
const EXIT_CODE_NOK = 1;

Expand Down Expand Up @@ -65,14 +65,8 @@ public function __construct(
$this->io = $io;
}

public static function getDefaultName(): string
{
return self::COMMAND_NAME;
}

protected function configure(): void
{
$this->setDescription('Executed by the pre-commit hook');
$this->addOption(
'skip-success-output',
null,
Expand Down
9 changes: 2 additions & 7 deletions src/Console/Command/RunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@

use GrumPHP\Collection\FilesCollection;
use GrumPHP\Collection\TestSuiteCollection;
use GrumPHP\IO\IOFactory;
use GrumPHP\IO\IOInterface;
use GrumPHP\Locator\RegisteredFiles;
use GrumPHP\Locator\StdInFiles;
use GrumPHP\Runner\TaskRunner;
use GrumPHP\Runner\TaskRunnerContext;
use GrumPHP\Task\Context\RunContext;
use GrumPHP\Util\Str;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

#[AsCommand(name: 'run', description: 'Run configured tasks')]
class RunCommand extends Command
{
const COMMAND_NAME = 'run';
const EXIT_CODE_OK = 0;
const EXIT_CODE_NOK = 1;

Expand Down Expand Up @@ -63,11 +63,6 @@ public function __construct(
$this->io = $io;
}

public static function getDefaultName(): string
{
return self::COMMAND_NAME;
}

protected function configure(): void
{
$this->addOption(
Expand Down
Loading