-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 Added PHPStan strict rules and address reported issues (#80)
- Loading branch information
Showing
24 changed files
with
74 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,14 +51,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int | |
|
||
$url = sprintf($options->isHttp ? 'https://git.drupalcode.org/project/%s.git' : '[email protected]:project/%s.git', $options->project); | ||
$params = []; | ||
if (!empty($options->branch)) { | ||
if (null !== $options->branch && strlen($options->branch) > 0) { | ||
$params['-b'] = $options->branch; | ||
} | ||
|
||
// When directory isnt provided then use a directory with the same name as the project, if the directory | ||
// doesn't exist. | ||
$directory = $options->directory; | ||
if (!$directory) { | ||
if (null === $directory) { | ||
$directory = $options->project; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,19 +28,20 @@ public function __invoke(GitApplyPatchesEvent $event): void | |
$patchLevel = $event->options->patchLevel; | ||
$linearMode = $event->linearMode; | ||
|
||
if (0 === count($patches)) { | ||
$output->writeln('No patches found.'); | ||
$event->setFailure(); | ||
|
||
return; | ||
} | ||
|
||
// Resolve hashes. | ||
/** @var array<array{\dogit\DrupalOrg\Objects\DrupalOrgPatch, string}> $hashes */ | ||
$hashes = array_map(fn (DrupalOrgPatch $patch): array => [ | ||
$patch, | ||
(new GitResolver($patch, $gitIo))->getHash(), | ||
], $patches); | ||
|
||
if (0 === count($hashes)) { | ||
$output->writeln('No patches found.'); | ||
$event->setFailure(); | ||
|
||
return; | ||
} | ||
|
||
$firstHash = reset($hashes)[1]; | ||
$gitIo->resetHard($firstHash); | ||
|
||
|
@@ -58,9 +59,8 @@ public function __invoke(GitApplyPatchesEvent $event): void | |
|
||
$patchAllProgressBar->start(); | ||
foreach ($hashes as [$patch, $hash]) { | ||
assert($patch instanceof DrupalOrgPatch); | ||
$patchContents = $patch->getContents(); | ||
if (!$patchContents) { | ||
if (null === $patchContents || 0 === strlen($patchContents)) { | ||
// This should have been filtered by \dogit\Listeners\PatchToBranch\FilterByResponse\ByBody. | ||
$io->warning(sprintf('Patch for comment %s is empty. Skipping.', $patch->getParent()->getSequence())); | ||
|
||
|
@@ -79,7 +79,7 @@ public function __invoke(GitApplyPatchesEvent $event): void | |
]; | ||
|
||
// Merge and reset state to without the changes from last patch. | ||
if ($patchCommitHash) { | ||
if (null !== $patchCommitHash && strlen($patchCommitHash) > 0) { | ||
if (!$linearMode) { | ||
$patchSingleProgressBar->setProgress(10); | ||
$logger->info(sprintf('Merging into commit #%s before patch', substr($patchCommitHash, 0, 8)), $contextArgs); | ||
|
@@ -93,7 +93,7 @@ public function __invoke(GitApplyPatchesEvent $event): void | |
$gitIo->commit([ | ||
'--amend', | ||
'--allow-empty', | ||
['--reuse-message', (string) $gitIo->getLastCommitId()], | ||
['--reuse-message', $gitIo->getLastCommitId()], | ||
['--date', $patch->getCreated()->getTimestamp()], | ||
['--author', 'dogit <[email protected]>'], | ||
]); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.