Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use strict comparison. #249

Merged
merged 1 commit into from
Feb 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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