From 3894bb82be48e5fa164ad2ecbaa55d1b5114d0b8 Mon Sep 17 00:00:00 2001 From: Pol Dellaiera Date: Fri, 25 Jan 2019 10:20:48 +0100 Subject: [PATCH] Use strict comparison. --- src/Plugin/Patches.php | 10 +++++----- src/Resolvers/DependencyPatches.php | 2 +- src/Resolvers/PatchesFile.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Plugin/Patches.php b/src/Plugin/Patches.php index 389431ee..4ed72da4 100644 --- a/src/Plugin/Patches.php +++ b/src/Plugin/Patches.php @@ -247,7 +247,7 @@ public function checkPatches(Event $event) $tmp_patches = Util::arrayMergeRecursiveDistinct($tmp_patches, $patches); } - if ($tmp_patches == false) { + if ($tmp_patches === false) { $this->io->write('No patches supplied.'); return; } @@ -404,7 +404,7 @@ protected function getAndApplyPatch(RemoteFilesystem $downloader, $install_path, $filename ); $output = $this->executor->getErrorOutput(); - if (substr($output, 0, 7) == 'Skipped') { + if (substr($output, 0, 7) === 'Skipped') { // Git will indicate success but silently skip patches in some scenarios. // // @see https://github.com/cweagans/composer-patches/pull/165 @@ -462,7 +462,7 @@ protected function isPatchingEnabled() $enabled = true; $has_no_patches = empty($extra['patches']); - $has_no_patches_file = ($this->getConfig('patches-file') == ''); + $has_no_patches_file = ($this->getConfig('patches-file') === ''); $patching_disabled = $this->getConfig('disable-patching'); if ($patching_disabled || !($has_no_patches && $has_no_patches_file)) { @@ -495,13 +495,13 @@ protected function executeCommand($cmd) $this->io->write('' . $command . ''); $io = $this->io; $output = function ($type, $data) use ($io) { - if ($type == Process::ERR) { + if ($type === Process::ERR) { $io->write('' . $data . ''); } else { $io->write('' . $data . ''); } }; } - return ($this->executor->execute($command, $output) == 0); + return ($this->executor->execute($command, $output) === 0); } } diff --git a/src/Resolvers/DependencyPatches.php b/src/Resolvers/DependencyPatches.php index 9ee63496..0e640e15 100644 --- a/src/Resolvers/DependencyPatches.php +++ b/src/Resolvers/DependencyPatches.php @@ -27,7 +27,7 @@ public function resolve(PatchCollection $collection, PackageEvent $event) $operations = $event->getOperations(); foreach ($operations as $operation) { - if ($operation->getJobType() == 'install' || $operation->getJobType() == 'update') { + if ($operation->getJobType() === 'install' || $operation->getJobType() === 'update') { // @TODO handle exception. $package = $this->getPackageFromOperation($operation); /** @var PackageInterface $extra */ diff --git a/src/Resolvers/PatchesFile.php b/src/Resolvers/PatchesFile.php index 4e4de17d..15864d58 100644 --- a/src/Resolvers/PatchesFile.php +++ b/src/Resolvers/PatchesFile.php @@ -57,7 +57,7 @@ protected function readPatchesFile($patches_file) // First, check for JSON syntax issues. $json_error = json_last_error_msg(); - if ($json_error != "No error") { + if ($json_error !== "No error") { throw new \InvalidArgumentException($json_error); }