Skip to content

Commit

Permalink
Merge pull request #249 from drupol/use-strict-comparison
Browse files Browse the repository at this point in the history
Use strict comparison.
  • Loading branch information
cweagans committed Feb 14, 2019
2 parents d8a38a5 + 7efcf96 commit 17fe176
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/Plugin/Patches.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function resolvePatches(PackageEvent $event)
// Let each resolver discover patches and add them to the PatchCollection.
/** @var ResolverInterface $resolver */
foreach ($this->getPatchResolvers() as $resolver) {
if (!in_array(get_class($resolver), $this->getConfig('disable-resolvers'))) {
if (!in_array(get_class($resolver), $this->getConfig('disable-resolvers'), true)) {
$resolver->resolve($this->patchCollection, $event);
} else {
if ($this->io->isVerbose()) {
Expand Down Expand Up @@ -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('<info>No patches supplied.</info>');
return;
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)) {
Expand Down Expand Up @@ -495,13 +495,13 @@ protected function executeCommand($cmd)
$this->io->write('<comment>' . $command . '</comment>');
$io = $this->io;
$output = function ($type, $data) use ($io) {
if ($type == Process::ERR) {
if ($type === Process::ERR) {
$io->write('<error>' . $data . '</error>');
} else {
$io->write('<comment>' . $data . '</comment>');
}
};
}
return ($this->executor->execute($command, $output) == 0);
return ($this->executor->execute($command, $output) === 0);
}
}
2 changes: 1 addition & 1 deletion src/Resolvers/DependencyPatches.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion src/Resolvers/PatchesFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 17fe176

Please sign in to comment.