From d4207ff49f000a291189496b5a73e5805481e621 Mon Sep 17 00:00:00 2001 From: Andy Waterman Date: Wed, 6 Apr 2016 20:55:53 +0100 Subject: [PATCH] Strict type checks of null and bool --- src/Composer/EventDispatcher/EventDispatcher.php | 2 +- src/Composer/Repository/ArtifactRepository.php | 2 +- src/Composer/Repository/Pear/BaseChannelReader.php | 2 +- src/Composer/Util/Perforce.php | 10 +++++----- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Composer/EventDispatcher/EventDispatcher.php b/src/Composer/EventDispatcher/EventDispatcher.php index 70a370722..acdf3d9df 100644 --- a/src/Composer/EventDispatcher/EventDispatcher.php +++ b/src/Composer/EventDispatcher/EventDispatcher.php @@ -72,7 +72,7 @@ class EventDispatcher */ public function dispatch($eventName, Event $event = null) { - if (null == $event) { + if (null === $event) { $event = new Event($eventName); } diff --git a/src/Composer/Repository/ArtifactRepository.php b/src/Composer/Repository/ArtifactRepository.php index 21443adcf..50a08241f 100644 --- a/src/Composer/Repository/ArtifactRepository.php +++ b/src/Composer/Repository/ArtifactRepository.php @@ -108,7 +108,7 @@ class ArtifactRepository extends ArrayRepository implements ConfigurableReposito } $length = strlen($stat['name']); - if ($indexOfShortestMatch == false || $length < $lengthOfShortestMatch) { + if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) { //Check it's not a directory. $contents = $zip->getFromIndex($i); if ($contents !== false) { diff --git a/src/Composer/Repository/Pear/BaseChannelReader.php b/src/Composer/Repository/Pear/BaseChannelReader.php index dbb769487..d11a96d7b 100644 --- a/src/Composer/Repository/Pear/BaseChannelReader.php +++ b/src/Composer/Repository/Pear/BaseChannelReader.php @@ -73,7 +73,7 @@ abstract class BaseChannelReader // http://components.ez.no/p/packages.xml is malformed. to read it we must ignore parsing errors. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR); - if (false == $xml) { + if (false === $xml) { throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path)); } diff --git a/src/Composer/Util/Perforce.php b/src/Composer/Util/Perforce.php index a69a10954..860156655 100644 --- a/src/Composer/Util/Perforce.php +++ b/src/Composer/Util/Perforce.php @@ -64,7 +64,7 @@ class Perforce public function initialize($repoConfig) { $this->uniquePerforceClientName = $this->generateUniquePerforceClientName(); - if (null == $repoConfig) { + if (null === $repoConfig) { return; } if (isset($repoConfig['unique_perforce_client_name'])) { @@ -313,7 +313,7 @@ class Perforce $prevDir = getcwd(); chdir($this->path); $p4SyncCommand = $this->generateP4Command('sync -f '); - if (null != $sourceReference) { + if (null !== $sourceReference) { $p4SyncCommand = $p4SyncCommand . '@' . $sourceReference; } $this->executeCommand($p4SyncCommand); @@ -362,7 +362,7 @@ class Perforce return; } $line = fgets($pipe); - while ($line != false) { + while ($line !== false) { $line = fgets($pipe); } @@ -549,11 +549,11 @@ class Perforce public function getCommitLogs($fromReference, $toReference) { $fromChangeList = $this->getChangeList($fromReference); - if ($fromChangeList == null) { + if ($fromChangeList === null) { return null; } $toChangeList = $this->getChangeList($toReference); - if ($toChangeList == null) { + if ($toChangeList === null) { return null; } $index = strpos($fromReference, '@');