Skip to content

Commit

Permalink
Pre-push has its own context
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiu-cristea committed May 26, 2024
1 parent 028c6d3 commit 0c1245e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Console/Command/Git/PrePushCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use GrumPHP\Git\GitRepository;
use GrumPHP\Runner\TaskRunner;
use GrumPHP\Runner\TaskRunnerContext;
use GrumPHP\Task\Context\GitPreCommitContext;
use GrumPHP\Task\Context\GitPrePushContext;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
Expand Down Expand Up @@ -55,7 +55,7 @@ public function execute(InputInterface $input, OutputInterface $output): int

$context = (
new TaskRunnerContext(
new GitPreCommitContext($files),
new GitPrePushContext($files),
$this->testSuites->getOptional('git_pre_push')
)
)->withSkippedSuccessOutput((bool) $input->getOption('skip-success-output'));
Expand Down
22 changes: 22 additions & 0 deletions src/Task/Context/GitPrePushContext.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

declare(strict_types=1);

namespace GrumPHP\Task\Context;

use GrumPHP\Collection\FilesCollection;

class GitPrePushContext implements ContextInterface
{
private $files;

public function __construct(FilesCollection $files)
{
$this->files = $files;
}

public function getFiles(): FilesCollection
{
return $this->files;
}
}

0 comments on commit 0c1245e

Please sign in to comment.