From f7a01a0030b7b9b033ac6946127ec9c5eb0c9e44 Mon Sep 17 00:00:00 2001 From: JeroenG Date: Sun, 10 Oct 2021 19:01:06 +0000 Subject: [PATCH] Apply fixes from StyleCI [ci skip] [skip ci] --- src/ArchiveExtractors/Extractor.php | 5 ++--- src/ArchiveExtractors/Manager.php | 9 ++++----- src/ArchiveExtractors/TarGz.php | 2 +- src/Commands/CheckPackage.php | 2 ++ src/Commands/GetPackage.php | 4 ++++ src/Commands/GitPackage.php | 4 ++++ src/Commands/ListPackages.php | 11 +++++------ src/Commands/NewPackage.php | 4 ++++ src/Commands/PublishPackage.php | 3 +++ src/Commands/RemovePackage.php | 4 ++++ src/Conveyor.php | 10 ++++------ src/FileHandler.php | 18 ++++++++--------- src/PackagerServiceProvider.php | 1 + src/ProgressBar.php | 5 +++-- src/Wrapping.php | 30 +++++++++++++++-------------- tests/TestCase.php | 1 - 16 files changed, 65 insertions(+), 48 deletions(-) diff --git a/src/ArchiveExtractors/Extractor.php b/src/ArchiveExtractors/Extractor.php index 9748af9..0f208c4 100644 --- a/src/ArchiveExtractors/Extractor.php +++ b/src/ArchiveExtractors/Extractor.php @@ -5,9 +5,8 @@ abstract class Extractor { /** - * @param string $pathToArchive - * @param string $pathToDirectory - * + * @param string $pathToArchive + * @param string $pathToDirectory * @return void */ abstract public function extract(string $pathToArchive, string $pathToDirectory): void; diff --git a/src/ArchiveExtractors/Manager.php b/src/ArchiveExtractors/Manager.php index 317b6fa..285c846 100644 --- a/src/ArchiveExtractors/Manager.php +++ b/src/ArchiveExtractors/Manager.php @@ -18,9 +18,9 @@ public function __construct() } /** - * @param string $archiveExtension - * + * @param string $archiveExtension * @return Extractor + * * @throws InvalidArgumentException */ public function getExtractor(string $archiveExtension): Extractor @@ -35,9 +35,8 @@ public function getExtractor(string $archiveExtension): Extractor } /** - * @param string $archiveExtension - * @param Extractor $instance - * + * @param string $archiveExtension + * @param Extractor $instance * @return self */ public function addExtractor(string $archiveExtension, Extractor $instance): self diff --git a/src/ArchiveExtractors/TarGz.php b/src/ArchiveExtractors/TarGz.php index 8c84619..8551db2 100644 --- a/src/ArchiveExtractors/TarGz.php +++ b/src/ArchiveExtractors/TarGz.php @@ -21,7 +21,7 @@ public function extract(string $pathToArchive, string $pathToDirectory): void /** * Get the path to the tar within the gz folder. * - * @param string $pathToArchive + * @param string $pathToArchive * @return string */ private function extractTarPathFromGz(string $pathToArchive): string diff --git a/src/Commands/CheckPackage.php b/src/Commands/CheckPackage.php index 6727dfd..1409697 100644 --- a/src/Commands/CheckPackage.php +++ b/src/Commands/CheckPackage.php @@ -15,12 +15,14 @@ class CheckPackage extends Command { /** * The name and signature of the console command. + * * @var string */ protected $signature = 'packager:check {vendor} {name}'; /** * The console command description. + * * @var string */ protected $description = 'Check the composer.lock for security vulnerabilities.'; diff --git a/src/Commands/GetPackage.php b/src/Commands/GetPackage.php index b5fe191..02eaf37 100644 --- a/src/Commands/GetPackage.php +++ b/src/Commands/GetPackage.php @@ -18,6 +18,7 @@ class GetPackage extends Command /** * The name and signature of the console command. + * * @var string */ protected $signature = 'packager:get @@ -29,18 +30,21 @@ class GetPackage extends Command /** * The console command description. + * * @var string */ protected $description = 'Retrieve an existing package from Github or Bitbucket.'; /** * Packages roll off of the conveyor. + * * @var object \JeroenG\Packager\Conveyor */ protected $conveyor; /** * Packages are packed in wrappings to personalise them. + * * @var object \JeroenG\Packager\Wrapping */ protected $wrapping; diff --git a/src/Commands/GitPackage.php b/src/Commands/GitPackage.php index a8ece15..f99abec 100644 --- a/src/Commands/GitPackage.php +++ b/src/Commands/GitPackage.php @@ -19,6 +19,7 @@ class GitPackage extends Command /** * The name and signature of the console command. + * * @var string */ protected $signature = 'packager:git @@ -28,18 +29,21 @@ class GitPackage extends Command /** * The console command description. + * * @var string */ protected $description = 'Retrieve an existing package with git.'; /** * Packages roll off of the conveyor. + * * @var object \JeroenG\Packager\Conveyor */ protected $conveyor; /** * Packages are packed in wrappings to personalise them. + * * @var object \JeroenG\Packager\Wrapping */ protected $wrapping; diff --git a/src/Commands/ListPackages.php b/src/Commands/ListPackages.php index 3244b06..053603b 100644 --- a/src/Commands/ListPackages.php +++ b/src/Commands/ListPackages.php @@ -15,6 +15,7 @@ class ListPackages extends Command { /** * The name and signature of the console command. + * * @var string */ protected $signature = 'packager:list @@ -22,6 +23,7 @@ class ListPackages extends Command /** * The console command description. + * * @var string */ protected $description = 'List all locally installed packages.'; @@ -67,7 +69,7 @@ private function getPackagesList(): array /** * Render the list as a simple table. * - * @param array $packages + * @param array $packages */ private function renderBasicTable(array $packages): void { @@ -95,8 +97,7 @@ private function renderGitTable($packages): void /** * If a package has a git history, add its status. * - * @param string $path - * + * @param string $path * @return array */ private function getGitStatus(string $path): array @@ -118,8 +119,7 @@ private function getGitStatus(string $path): array * It returns the difference in commits as a positive or negative integer. * A positive number means the local package is behind. Otherwise it is ahead. * - * @param string $path - * + * @param string $path * @return int */ private function getCommitDifference(string $path): int @@ -138,7 +138,6 @@ private function getCommitDifference(string $path): int * Gets the branch name for a package. * * @param $path - * * @return string|null */ private function getCurrentBranchForPackage($path): ?string diff --git a/src/Commands/NewPackage.php b/src/Commands/NewPackage.php index a4ff468..97be3cc 100644 --- a/src/Commands/NewPackage.php +++ b/src/Commands/NewPackage.php @@ -21,24 +21,28 @@ class NewPackage extends Command /** * The name and signature of the console command. + * * @var string */ protected $signature = 'packager:new {vendor?} {name?} {--i} {--skeleton=}'; /** * The console command description. + * * @var string */ protected $description = 'Create a new package.'; /** * Packages roll off of the conveyor. + * * @var object \JeroenG\Packager\Conveyor */ protected $conveyor; /** * Packages are packed in wrappings to personalise them. + * * @var object \JeroenG\Packager\Wrapping */ protected $wrapping; diff --git a/src/Commands/PublishPackage.php b/src/Commands/PublishPackage.php index ec18fee..023a3ff 100644 --- a/src/Commands/PublishPackage.php +++ b/src/Commands/PublishPackage.php @@ -17,6 +17,7 @@ class PublishPackage extends Command /** * The name and signature of the console command. + * * @var string */ protected $signature = 'packager:publish @@ -26,12 +27,14 @@ class PublishPackage extends Command /** * The console command description. + * * @var string */ protected $description = 'Publish your package to Github with git.'; /** * Packages roll off of the conveyor. + * * @var object \JeroenG\Packager\Conveyor */ protected $conveyor; diff --git a/src/Commands/RemovePackage.php b/src/Commands/RemovePackage.php index 8efc7a6..f3fe308 100644 --- a/src/Commands/RemovePackage.php +++ b/src/Commands/RemovePackage.php @@ -18,24 +18,28 @@ class RemovePackage extends Command /** * The name and signature of the console command. + * * @var string */ protected $signature = 'packager:remove {vendor} {name?}'; /** * The console command description. + * * @var string */ protected $description = 'Remove an existing package.'; /** * Packages roll off of the conveyor. + * * @var object \JeroenG\Packager\Conveyor */ protected $conveyor; /** * Packages are packed in wrappings to personalise them. + * * @var object \JeroenG\Packager\Wrapping */ protected $wrapping; diff --git a/src/Conveyor.php b/src/Conveyor.php index e148f6d..8e967d1 100644 --- a/src/Conveyor.php +++ b/src/Conveyor.php @@ -26,8 +26,7 @@ class Conveyor /** * Set or get the package vendor namespace. * - * @param string $vendor - * + * @param string $vendor * @return string|RuntimeException */ public function vendor($vendor = null) @@ -65,8 +64,7 @@ public function vendorKebab() /** * Set or get the package name. * - * @param string $package - * + * @param string $package * @return string|RuntimeException */ public function package($package = null) @@ -125,8 +123,8 @@ public function downloadSkeleton($skeletonArchiveUrl = null) /** * Download the package from Github. * - * @param string $origin The Github URL - * @param string $branch The branch to download + * @param string $origin The Github URL + * @param string $branch The branch to download */ public function downloadFromGithub($origin, $piece, $branch) { diff --git a/src/FileHandler.php b/src/FileHandler.php index 0f31eda..7fa3346 100644 --- a/src/FileHandler.php +++ b/src/FileHandler.php @@ -53,8 +53,7 @@ public function packagePath() /** * Generate a random temporary filename for the package archive file. * - * @param string $extension - * + * @param string $extension * @return string */ public function makeFilename($extension = 'zip') @@ -65,7 +64,7 @@ public function makeFilename($extension = 'zip') /** * Check if the package already exists. * - * @return void Throws error if package exists, aborts process + * @return void Throws error if package exists, aborts process */ public function checkIfPackageExists() { @@ -77,7 +76,7 @@ public function checkIfPackageExists() /** * Create a directory if it doesn't exist. * - * @param string $path Path of the directory to make + * @param string $path Path of the directory to make * @return bool */ public function makeDir($path) @@ -92,7 +91,7 @@ public function makeDir($path) /** * Remove a directory if it exists. * - * @param string $path Path of the directory to remove. + * @param string $path Path of the directory to remove. * @return bool */ public function removeDir($path) @@ -133,8 +132,8 @@ public function download($filePath, $sourceFileUrl) /** * Extract the downloaded archive into the given directory. * - * @param string $archiveFilePath - * @param string $directory + * @param string $archiveFilePath + * @param string $directory * @return $this */ public function extract($archiveFilePath, $directory) @@ -164,7 +163,7 @@ public function cleanUp($pathToArchive) /** * Rename generic files to package-specific ones. * - * @param array|null $manifest + * @param array|null $manifest * @return void **/ public function renameFiles($manifest = null) @@ -204,8 +203,7 @@ public function cleanUpRules() /** * Based on the extension a different archive extractor is used. * - * @param string $archiveFilePath - * + * @param string $archiveFilePath * @return string */ protected function getArchiveExtension($archiveFilePath): string diff --git a/src/PackagerServiceProvider.php b/src/PackagerServiceProvider.php index b56c381..f50e2f1 100644 --- a/src/PackagerServiceProvider.php +++ b/src/PackagerServiceProvider.php @@ -35,6 +35,7 @@ class PackagerServiceProvider extends ServiceProvider /** * Bootstrap the application events. + * * @throws BindingResolutionException */ public function boot() diff --git a/src/ProgressBar.php b/src/ProgressBar.php index 2e3a6e6..94d20cb 100644 --- a/src/ProgressBar.php +++ b/src/ProgressBar.php @@ -6,6 +6,7 @@ trait ProgressBar { /** * Symfony ProgressBar instance. + * * @var object \Symfony\Component\Console\Helper\ProgressBar */ protected $bar; @@ -13,7 +14,7 @@ trait ProgressBar /** * Setting custom formatting for the progress bar. * - * @param int $steps The number of steps the progress bar has. + * @param int $steps The number of steps the progress bar has. * @return void */ public function startProgressBar($steps) @@ -50,7 +51,7 @@ public function makeProgress() /** * Finalise the progress, output the (last) message. * - * @param string $message + * @param string $message * @return void */ public function finishProgress($message) diff --git a/src/Wrapping.php b/src/Wrapping.php index 69d00c5..60e0b0d 100644 --- a/src/Wrapping.php +++ b/src/Wrapping.php @@ -9,12 +9,14 @@ class Wrapping { /** * Placeholders. + * * @var array */ public $placeholders = []; /** * Replacements. + * * @var array */ public $replacements = []; @@ -23,7 +25,7 @@ class Wrapping * Open haystack, find and replace needles, save haystack. * * @param string|array $placeholder String or array to look for (the needles) - * @param string|array $replacement What to replace the needles for? + * @param string|array $replacement What to replace the needles for? * @return $this */ public function replace($placeholder, $replacement) @@ -45,7 +47,7 @@ public function replace($placeholder, $replacement) /** * Fill all placeholders with their replacements. * - * @param string $path The directory of the files containing placeholders + * @param string $path The directory of the files containing placeholders * @return void */ public function fill($path) @@ -63,8 +65,8 @@ public function fill($path) /** * Fill placeholders in a single file. * - * @param string $template The file with the generic placeholders in it - * @param string|null $destiniation Where to save, defaults to $template + * @param string $template The file with the generic placeholders in it + * @param string|null $destiniation Where to save, defaults to $template * @return $this */ public function fillInFile($template, $destination = null) @@ -80,8 +82,8 @@ public function fillInFile($template, $destination = null) /** * Add the package to composer.json. * - * @param string $vendor - * @param string $package + * @param string $vendor + * @param string $package * @return $this */ public function addToComposer($vendor, $package) @@ -96,8 +98,8 @@ public function addToComposer($vendor, $package) /** * Remove the package from composer.json. * - * @param string $vendor - * @param string $package + * @param string $vendor + * @param string $package * @return $this */ public function removeFromComposer($vendor, $package) @@ -109,8 +111,8 @@ public function removeFromComposer($vendor, $package) /** * Add the package to the providers in config/app.php. * - * @param string $vendor - * @param string $package + * @param string $vendor + * @param string $package * @return $this */ public function addToProviders($vendor, $package) @@ -129,8 +131,8 @@ public function addToProviders($vendor, $package) /** * Remove the package from the providers in config/app.php. * - * @param string $vendor - * @param string $package + * @param string $vendor + * @param string $package * @return $this */ public function removeFromProviders($vendor, $package) @@ -142,8 +144,8 @@ public function removeFromProviders($vendor, $package) /** * Format vendor and package strings to camel case. * - * @param string $vendor - * @param string $package + * @param string $vendor + * @param string $package * @return array */ protected function formatVars($vendor, $package) diff --git a/tests/TestCase.php b/tests/TestCase.php index 282e1ab..8c020e6 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -46,7 +46,6 @@ public function tearDown(): void * Tell Testbench to use this package. * * @param $app - * * @return array */ protected function getPackageProviders($app)