Skip to content

Commit 3cf0770

Browse files
committed
Remove unnecessary ternary expressions
1 parent 49eb9d1 commit 3cf0770

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

src/PhpWord/Metadata/DocInfo.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ public static function convertProperty($propertyValue, $propertyType)
507507
case 'date': // Date
508508
return strtotime($propertyValue);
509509
case 'bool': // Boolean
510-
return ($propertyValue == 'true') ? true : false;
510+
return $propertyValue == 'true';
511511
}
512512

513513
return $propertyValue;

src/PhpWord/Reader/MsDoc.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1619,7 +1619,7 @@ private function readPrl($data, $pos, $cbNum)
16191619
break;
16201620
// sprmCFData
16211621
case 0x06:
1622-
$sprmCFData = dechex($operand) == 0x00 ? false : true;
1622+
$sprmCFData = dechex($operand) != 0x00;
16231623
break;
16241624
// sprmCFItalic
16251625
case 0x36:

src/PhpWord/Reader/Word2007/AbstractPart.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ protected function readTable(XMLReader $xmlReader, \DOMElement $domNode, $parent
336336
} elseif ('w:tr' == $tblNode->nodeName) { // Row
337337
$rowHeight = $xmlReader->getAttribute('w:val', $tblNode, 'w:trPr/w:trHeight');
338338
$rowHRule = $xmlReader->getAttribute('w:hRule', $tblNode, 'w:trPr/w:trHeight');
339-
$rowHRule = $rowHRule == 'exact' ? true : false;
339+
$rowHRule = $rowHRule == 'exact';
340340
$rowStyle = array(
341341
'tblHeader' => $xmlReader->elementExists('w:trPr/w:tblHeader', $tblNode),
342342
'cantSplit' => $xmlReader->elementExists('w:trPr/w:cantSplit', $tblNode),

src/PhpWord/Shared/ZipArchive.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ public function pclzipAddFile($filename, $localname = null)
252252
unlink($this->tempDir . DIRECTORY_SEPARATOR . $localnameParts['basename']);
253253
}
254254

255-
return ($res == 0) ? false : true;
255+
return $res != 0;
256256
}
257257

258258
/**
@@ -283,7 +283,7 @@ public function pclzipAddFromString($localname, $contents)
283283
// Remove temp file
284284
@unlink($this->tempDir . DIRECTORY_SEPARATOR . $filenameParts['basename']);
285285

286-
return ($res == 0) ? false : true;
286+
return $res != 0;
287287
}
288288

289289
/**
@@ -303,7 +303,7 @@ public function pclzipExtractTo($destination, $entries = null)
303303
if (is_null($entries)) {
304304
$result = $zip->extract(PCLZIP_OPT_PATH, $destination);
305305

306-
return ($result > 0) ? true : false;
306+
return $result > 0;
307307
}
308308

309309
// Extract by entries

tests/PhpWord/_includes/XmlDocument.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function elementExists($path, $file = 'word/document.xml')
163163
{
164164
$nodeList = $this->getNodeList($path, $file);
165165

166-
return !($nodeList->length == 0);
166+
return $nodeList->length != 0;
167167
}
168168

169169
/**

0 commit comments

Comments
 (0)