diff --git a/src/PhpSpreadsheet/Calculation/Calculation.php b/src/PhpSpreadsheet/Calculation/Calculation.php index 3b0eb39c..737efe7b 100644 --- a/src/PhpSpreadsheet/Calculation/Calculation.php +++ b/src/PhpSpreadsheet/Calculation/Calculation.php @@ -4786,8 +4786,6 @@ class Calculation return $value; }, $tokens); - $str = '[ ' . implode(' | ', $tokensStr) . ' ]'; - - return $str; + return '[ ' . implode(' | ', $tokensStr) . ' ]'; } } diff --git a/src/PhpSpreadsheet/Collection/CellsFactory.php b/src/PhpSpreadsheet/Collection/CellsFactory.php index 46d3cf7e..7f34c231 100644 --- a/src/PhpSpreadsheet/Collection/CellsFactory.php +++ b/src/PhpSpreadsheet/Collection/CellsFactory.php @@ -16,8 +16,6 @@ abstract class CellsFactory * */ public static function getInstance(Worksheet $parent) { - $instance = new Cells($parent, Settings::getCache()); - - return $instance; + return new Cells($parent, Settings::getCache()); } } diff --git a/src/PhpSpreadsheet/IOFactory.php b/src/PhpSpreadsheet/IOFactory.php index a116334a..dcd2716c 100644 --- a/src/PhpSpreadsheet/IOFactory.php +++ b/src/PhpSpreadsheet/IOFactory.php @@ -52,9 +52,7 @@ abstract class IOFactory // Instantiate writer $className = self::$writers[$writerType]; - $writer = new $className($spreadsheet); - - return $writer; + return new $className($spreadsheet); } /** @@ -74,9 +72,7 @@ abstract class IOFactory // Instantiate reader $className = self::$readers[$readerType]; - $reader = new $className(); - - return $reader; + return new $className(); } /** diff --git a/src/PhpSpreadsheet/Reader/Xls.php b/src/PhpSpreadsheet/Reader/Xls.php index 36b50f0a..b10df595 100644 --- a/src/PhpSpreadsheet/Reader/Xls.php +++ b/src/PhpSpreadsheet/Reader/Xls.php @@ -5279,12 +5279,10 @@ class Xls extends BaseReader $nextIdentifier = self::getUInt2d($this->data, $this->pos); } while ($nextIdentifier == self::XLS_TYPE_CONTINUE); - $splicedData = [ + return [ 'recordData' => $data, 'spliceOffsets' => $spliceOffsets, ]; - - return $splicedData; } /** diff --git a/src/PhpSpreadsheet/Reader/Xml.php b/src/PhpSpreadsheet/Reader/Xml.php index 8ab7a9c3..5cddd331 100644 --- a/src/PhpSpreadsheet/Reader/Xml.php +++ b/src/PhpSpreadsheet/Reader/Xml.php @@ -285,9 +285,7 @@ class Xml extends BaseReader { $pixels = ($widthUnits / 256) * 7; $offsetWidthUnits = $widthUnits % 256; - $pixels += round($offsetWidthUnits / (256 / 7)); - - return $pixels; + return $pixels + round($offsetWidthUnits / (256 / 7)); } protected static function hex2str($hex) diff --git a/src/PhpSpreadsheet/Shared/Font.php b/src/PhpSpreadsheet/Shared/Font.php index 8abcef2e..bee13e29 100644 --- a/src/PhpSpreadsheet/Shared/Font.php +++ b/src/PhpSpreadsheet/Shared/Font.php @@ -298,9 +298,7 @@ class Font $upperLeftCornerX = $textBox[6]; // Consider the rotation when calculating the width - $textWidth = max($lowerRightCornerX - $upperLeftCornerX, $upperRightCornerX - $lowerLeftCornerX); - - return $textWidth; + return max($lowerRightCornerX - $upperLeftCornerX, $upperRightCornerX - $lowerLeftCornerX); } /** diff --git a/src/PhpSpreadsheet/Shared/StringHelper.php b/src/PhpSpreadsheet/Shared/StringHelper.php index a5702775..d949203b 100644 --- a/src/PhpSpreadsheet/Shared/StringHelper.php +++ b/src/PhpSpreadsheet/Shared/StringHelper.php @@ -430,9 +430,7 @@ class StringHelper // characters $chars = self::convertEncoding($value, 'UTF-16LE', 'UTF-8'); - $data = pack('vC', $ln, 0x0001) . $chars; - - return $data; + return pack('vC', $ln, 0x0001) . $chars; } /** diff --git a/src/PhpSpreadsheet/Shared/Xls.php b/src/PhpSpreadsheet/Shared/Xls.php index 51407ade..b8ce5e2d 100644 --- a/src/PhpSpreadsheet/Shared/Xls.php +++ b/src/PhpSpreadsheet/Shared/Xls.php @@ -269,7 +269,7 @@ class Xls $startCoordinates = Coordinate::stringFromColumnIndex($col_start) . ($row_start + 1); $endCoordinates = Coordinate::stringFromColumnIndex($col_end) . ($row_end + 1); - $twoAnchor = [ + return [ 'startCoordinates' => $startCoordinates, 'startOffsetX' => $x1, 'startOffsetY' => $y1, @@ -277,7 +277,5 @@ class Xls 'endOffsetX' => $x2, 'endOffsetY' => $y2, ]; - - return $twoAnchor; } } diff --git a/src/PhpSpreadsheet/Worksheet/Worksheet.php b/src/PhpSpreadsheet/Worksheet/Worksheet.php index 7777199c..8d7bdafd 100644 --- a/src/PhpSpreadsheet/Worksheet/Worksheet.php +++ b/src/PhpSpreadsheet/Worksheet/Worksheet.php @@ -2912,9 +2912,7 @@ class Worksheet implements IComparable $rangeSet = $rangeBoundaries[0][0] . $rangeBoundaries[0][1] . ':' . $rangeBoundaries[1][0] . $rangeBoundaries[1][1]; } unset($rangeSet); - $stRange = implode(' ', $rangeBlocks); - - return $stRange; + return implode(' ', $rangeBlocks); } /** @@ -2961,9 +2959,7 @@ class Worksheet implements IComparable */ public function copy() { - $copied = clone $this; - - return $copied; + return clone $this; } /** diff --git a/src/PhpSpreadsheet/Writer/Html.php b/src/PhpSpreadsheet/Writer/Html.php index c075329d..852a246a 100644 --- a/src/PhpSpreadsheet/Writer/Html.php +++ b/src/PhpSpreadsheet/Writer/Html.php @@ -960,15 +960,12 @@ class Html extends BaseWriter private function createCSSStyle(Style $pStyle) { // Create CSS - $css = array_merge( + return array_merge( $this->createCSSStyleAlignment($pStyle->getAlignment()), $this->createCSSStyleBorders($pStyle->getBorders()), $this->createCSSStyleFont($pStyle->getFont()), $this->createCSSStyleFill($pStyle->getFill()) ); - - // Return - return $css; } /** @@ -1061,9 +1058,7 @@ class Html extends BaseWriter { // Create CSS - add !important to non-none border styles for merged cells $borderStyle = $this->mapBorderStyle($pStyle->getBorderStyle()); - $css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important'); - - return $css; + return $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important'); } /** @@ -1153,9 +1148,7 @@ class Html extends BaseWriter */ private function generateTableFooter() { - $html = ' ' . PHP_EOL; - - return $html; + return ' ' . PHP_EOL; } /** diff --git a/src/PhpSpreadsheet/Writer/Xls/Parser.php b/src/PhpSpreadsheet/Writer/Xls/Parser.php index 625a243d..b49b9b9e 100644 --- a/src/PhpSpreadsheet/Writer/Xls/Parser.php +++ b/src/PhpSpreadsheet/Writer/Xls/Parser.php @@ -1161,17 +1161,13 @@ class Parser // catch "-" Term $this->advance(); $result2 = $this->expression(); - $result = $this->createTree('ptgUminus', $result2, ''); - - return $result; + return $this->createTree('ptgUminus', $result2, ''); // If it's a positive value } elseif ($this->currentToken == '+') { // catch "+" Term $this->advance(); $result2 = $this->expression(); - $result = $this->createTree('ptgUplus', $result2, ''); - - return $result; + return $this->createTree('ptgUplus', $result2, ''); } $result = $this->term(); while (($this->currentToken == '+') or @@ -1205,9 +1201,7 @@ class Parser */ private function parenthesizedExpression() { - $result = $this->createTree('ptgParen', $this->expression(), ''); - - return $result; + return $this->createTree('ptgParen', $this->expression(), ''); } /** @@ -1309,9 +1303,7 @@ class Parser return $result; } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/i", $this->currentToken)) { // if it's a function call - $result = $this->func(); - - return $result; + return $this->func(); } throw new WriterException('Syntax error: ' . $this->currentToken . ', lookahead: ' . $this->lookAhead . ', current char: ' . $this->currentCharacter); @@ -1439,8 +1431,6 @@ class Parser } $converted_tree = $this->convert($tree['value']); - $polish .= $converted_tree; - - return $polish; + return $polish . $converted_tree; } }