1
0
Fork 0

Strict type checks of null and bool

pull/5161/head
Andy Waterman 2016-04-06 20:55:53 +01:00
parent 40c14709f7
commit d4207ff49f
4 changed files with 8 additions and 8 deletions

View File

@ -72,7 +72,7 @@ class EventDispatcher
*/ */
public function dispatch($eventName, Event $event = null) public function dispatch($eventName, Event $event = null)
{ {
if (null == $event) { if (null === $event) {
$event = new Event($eventName); $event = new Event($eventName);
} }

View File

@ -108,7 +108,7 @@ class ArtifactRepository extends ArrayRepository implements ConfigurableReposito
} }
$length = strlen($stat['name']); $length = strlen($stat['name']);
if ($indexOfShortestMatch == false || $length < $lengthOfShortestMatch) { if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
//Check it's not a directory. //Check it's not a directory.
$contents = $zip->getFromIndex($i); $contents = $zip->getFromIndex($i);
if ($contents !== false) { if ($contents !== false) {

View File

@ -73,7 +73,7 @@ abstract class BaseChannelReader
// http://components.ez.no/p/packages.xml is malformed. to read it we must ignore parsing errors. // 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); $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)); throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
} }

View File

@ -64,7 +64,7 @@ class Perforce
public function initialize($repoConfig) public function initialize($repoConfig)
{ {
$this->uniquePerforceClientName = $this->generateUniquePerforceClientName(); $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
if (null == $repoConfig) { if (null === $repoConfig) {
return; return;
} }
if (isset($repoConfig['unique_perforce_client_name'])) { if (isset($repoConfig['unique_perforce_client_name'])) {
@ -313,7 +313,7 @@ class Perforce
$prevDir = getcwd(); $prevDir = getcwd();
chdir($this->path); chdir($this->path);
$p4SyncCommand = $this->generateP4Command('sync -f '); $p4SyncCommand = $this->generateP4Command('sync -f ');
if (null != $sourceReference) { if (null !== $sourceReference) {
$p4SyncCommand = $p4SyncCommand . '@' . $sourceReference; $p4SyncCommand = $p4SyncCommand . '@' . $sourceReference;
} }
$this->executeCommand($p4SyncCommand); $this->executeCommand($p4SyncCommand);
@ -362,7 +362,7 @@ class Perforce
return; return;
} }
$line = fgets($pipe); $line = fgets($pipe);
while ($line != false) { while ($line !== false) {
$line = fgets($pipe); $line = fgets($pipe);
} }
@ -549,11 +549,11 @@ class Perforce
public function getCommitLogs($fromReference, $toReference) public function getCommitLogs($fromReference, $toReference)
{ {
$fromChangeList = $this->getChangeList($fromReference); $fromChangeList = $this->getChangeList($fromReference);
if ($fromChangeList == null) { if ($fromChangeList === null) {
return null; return null;
} }
$toChangeList = $this->getChangeList($toReference); $toChangeList = $this->getChangeList($toReference);
if ($toChangeList == null) { if ($toChangeList === null) {
return null; return null;
} }
$index = strpos($fromReference, '@'); $index = strpos($fromReference, '@');