Skip to content

Commit

Permalink
Merge pull request #1163 from veewee/bump-deps
Browse files Browse the repository at this point in the history
Bump deps
  • Loading branch information
veewee authored Nov 26, 2024
2 parents d1a72f4 + 19b9aea commit d8107de
Show file tree
Hide file tree
Showing 12 changed files with 240 additions and 210 deletions.
394 changes: 200 additions & 194 deletions composer.lock

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions spec/Process/ProcessBuilderSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,17 @@ public function getMatchers(): array
{
return [
'beQuoted' => function ($subject, $string) {
if ('\\' === DIRECTORY_SEPARATOR) {
if ($subject !== $string) {
throw new FailureException(sprintf(
'Expected %s, got %s.',
$string,
$subject
));
}
return true;
}

$regex = sprintf('{^([\'"])%s\1$}', preg_quote($string));
if (!preg_match($regex, $subject)) {
throw new FailureException(sprintf(
Expand Down
11 changes: 11 additions & 0 deletions spec/Process/ProcessFactorySpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ public function getMatchers(): array
{
return [
'beQuoted' => function ($subject, $string) {
if ('\\' === DIRECTORY_SEPARATOR) {
if ($subject !== $string) {
throw new FailureException(sprintf(
'Expected %s, got %s.',
$string,
$subject
));
}
return true;
}

$regex = sprintf('{^([\'"])%s\1$}', preg_quote($string));
if (!preg_match($regex, $subject)) {
throw new FailureException(sprintf(
Expand Down
4 changes: 2 additions & 2 deletions src/Configuration/Loader/DistFileLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public function __construct(LoaderInterface $loader)
$this->loader = $loader;
}

public function load(mixed $resource, string $type = null): mixed
public function load(mixed $resource, ?string $type = null): mixed
{
return $this->loader->load($resource, $type);
}

public function supports(mixed $resource, string $type = null): bool
public function supports(mixed $resource, ?string $type = null): bool
{
if (!\is_string($resource)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Command/ConfigureCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ protected function buildConfiguration(InputInterface $input, OutputInterface $ou
];
}

protected function createQuestionString(string $question, string $default = null, string $separator = ':'): string
protected function createQuestionString(string $question, ?string $default = null, string $separator = ':'): string
{
return null !== $default ?
sprintf('<fg=green>%s</fg=green> [<fg=yellow>%s</fg=yellow>]%s ', $question, $default, $separator) :
Expand Down
2 changes: 1 addition & 1 deletion src/Event/Dispatcher/Bridge/SymfonyEventDispatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function __construct($eventDispatcher)
$this->dispatcher = $eventDispatcher;
}

public function dispatch(Event $event, string $name = null): void
public function dispatch(Event $event, ?string $name = null): void
{
$interfacesImplemented = class_implements($this->dispatcher);
if (in_array(SymfonyEventDispatcherContract::class, $interfacesImplemented, true)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Event/Dispatcher/EventDispatcherInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

interface EventDispatcherInterface
{
public function dispatch(Event $event, string $name = null): void;
public function dispatch(Event $event, ?string $name = null): void;
}
2 changes: 1 addition & 1 deletion src/Parser/Php/Configurator/TraverserConfigurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function registerVisitorId(string $alias, string $visitorId): void
/**
* @throws \GrumPHP\Exception\RuntimeException
*/
public function registerStandardEnabledVisitor(string $alias, array $visitorOptions = null): void
public function registerStandardEnabledVisitor(string $alias, ?array $visitorOptions = null): void
{
if (array_key_exists($alias, $this->standardEnabledVisitors)) {
throw new RuntimeException(
Expand Down
2 changes: 1 addition & 1 deletion src/Process/ProcessBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function __construct(ExternalCommand $externalCommandLocator, IOInterface
*/
public function createArgumentsForCommand(
string $command,
callable $pathManipulator = null
?callable $pathManipulator = null
): ProcessArgumentsCollection {
$executable = $this->externalCommandLocator->locate($command);
$manipulatedExecutable = $pathManipulator ? $pathManipulator($executable) : $executable;
Expand Down
2 changes: 1 addition & 1 deletion src/Runner/TaskRunnerContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class TaskRunnerContext
*/
public function __construct(
ContextInterface $taskContext,
TestSuiteInterface $testSuite = null,
?TestSuiteInterface $testSuite = null,
array $taskNames = []
) {
$this->taskContext = $taskContext;
Expand Down
16 changes: 9 additions & 7 deletions test/E2E/AbstractE2ETestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ protected function initializeGitSubModule(string $gitPath, string $submodulePath
$process = new Process(
[
$this->executableFinder->find('git'),
'-c',
'protocol.file.allow=always',
'submodule',
'add',
'-f',
Expand Down Expand Up @@ -174,7 +176,7 @@ protected function mergeComposerConfig(string $composerFile, array $config, $rec
$this->dumpFile($composerFile, json_encode($newSource, $flags));
}

protected function ensureHooksExist(string $gitPath = null, string $containsPattern = '{grumphp}')
protected function ensureHooksExist(?string $gitPath = null, string $containsPattern = '{grumphp}')
{
$gitPath = $gitPath ?: $this->rootDir;
$hooks = ['pre-commit', 'commit-msg'];
Expand Down Expand Up @@ -346,7 +348,7 @@ protected function installComposer(string $path, array $arguments = [])
$this->runCommand('install composer', $process);
}

protected function commitAll(string $gitPath = null)
protected function commitAll(?string $gitPath = null)
{
$gitPath = $gitPath ?: $this->rootDir;
$git = $this->executableFinder->find('git');
Expand All @@ -362,7 +364,7 @@ protected function commitAll(string $gitPath = null)
* --all: Tell the command to automatically stage files that have been modified and deleted,
* but new files you have not told Git about are not affected.
*/
protected function commitModifiedAndDeleted(string $gitPath = null)
protected function commitModifiedAndDeleted(?string $gitPath = null)
{
$gitPath = $gitPath ?: $this->rootDir;
$git = $this->executableFinder->find('git');
Expand All @@ -382,7 +384,7 @@ protected function runGrumphp(string $projectPath, string $vendorPath = './vendo
{
$projectPath = $this->relativeRootPath($projectPath);
$process = new Process(
[$vendorPath.'/bin/grumphp', 'run', '-vvv'],
[$this->executableFinder->find('php'), $vendorPath.'/bin/grumphp', 'run', '-vvv'],
$projectPath
);

Expand All @@ -396,7 +398,7 @@ protected function runGrumphpWithConfig(string $projectPath, string $grumphpFile
$projectPath = $this->relativeRootPath($projectPath);
$this->runCommand('grumphp run with config',
new Process(
[$vendorPath.'/bin/grumphp', 'run', '-vvv', '--config='.$grumphpFile],
[$this->executableFinder->find('php'), $vendorPath.'/bin/grumphp', 'run', '-vvv', '--config='.$grumphpFile],
$projectPath
)
);
Expand All @@ -407,7 +409,7 @@ protected function runGrumphpInfo(string $projectPath, $vendorPath = './vendor')
$projectPath = $this->relativeRootPath($projectPath);
$this->runCommand('grumphp info',
new Process(
[$vendorPath.'/bin/grumphp'],
[$this->executableFinder->find('php'), $vendorPath.'/bin/grumphp'],
$projectPath
)
);
Expand All @@ -418,7 +420,7 @@ protected function initializeGrumphpGitHooksWithConfig(string $grumphpFile, $ven
$this->runCommand(
'grumphp git:init',
new Process(
[$vendorPath.'/bin/grumphp', 'git:init', '--config='.$grumphpFile],
[$this->executableFinder->find('php'), $vendorPath.'/bin/grumphp', 'git:init', '--config='.$grumphpFile],
$this->rootDir
)
);
Expand Down
2 changes: 1 addition & 1 deletion test/E2E/GitHookParametersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ function it_can_specify_hook_exec_command_with_additional_arguments()

$this->installComposer($this->rootDir);

$hookPattern = sprintf('{[\'"]%s[\'"] [\'"]-d date\.timezone=Europe/Brussels[\'"]}', preg_quote($php));
$hookPattern = sprintf('{([\'"]?)%s([\'"]?) [\'"]-d date\.timezone=Europe/Brussels[\'"]}', preg_quote($php));
$this->ensureHooksExist($this->rootDir, $hookPattern);

$this->enableValidatePathsTask($grumphpFile, $this->rootDir);
Expand Down

0 comments on commit d8107de

Please sign in to comment.