fixes UselessVariable and UnusedVariable from slevomat/coding-standard

This commit is contained in:
Diego Souza 2019-09-22 21:42:49 -03:00 committed by Adrien Crivelli
parent 75dfcb5a36
commit d2cb2a0d1a
No known key found for this signature in database
GPG Key ID: B182FD79DC6DE92E
11 changed files with 19 additions and 58 deletions

View File

@ -4786,8 +4786,6 @@ class Calculation
return $value; return $value;
}, $tokens); }, $tokens);
$str = '[ ' . implode(' | ', $tokensStr) . ' ]'; return '[ ' . implode(' | ', $tokensStr) . ' ]';
return $str;
} }
} }

View File

@ -16,8 +16,6 @@ abstract class CellsFactory
* */ * */
public static function getInstance(Worksheet $parent) public static function getInstance(Worksheet $parent)
{ {
$instance = new Cells($parent, Settings::getCache()); return new Cells($parent, Settings::getCache());
return $instance;
} }
} }

View File

@ -52,9 +52,7 @@ abstract class IOFactory
// Instantiate writer // Instantiate writer
$className = self::$writers[$writerType]; $className = self::$writers[$writerType];
$writer = new $className($spreadsheet); return new $className($spreadsheet);
return $writer;
} }
/** /**
@ -74,9 +72,7 @@ abstract class IOFactory
// Instantiate reader // Instantiate reader
$className = self::$readers[$readerType]; $className = self::$readers[$readerType];
$reader = new $className(); return new $className();
return $reader;
} }
/** /**

View File

@ -5279,12 +5279,10 @@ class Xls extends BaseReader
$nextIdentifier = self::getUInt2d($this->data, $this->pos); $nextIdentifier = self::getUInt2d($this->data, $this->pos);
} while ($nextIdentifier == self::XLS_TYPE_CONTINUE); } while ($nextIdentifier == self::XLS_TYPE_CONTINUE);
$splicedData = [ return [
'recordData' => $data, 'recordData' => $data,
'spliceOffsets' => $spliceOffsets, 'spliceOffsets' => $spliceOffsets,
]; ];
return $splicedData;
} }
/** /**

View File

@ -285,9 +285,7 @@ class Xml extends BaseReader
{ {
$pixels = ($widthUnits / 256) * 7; $pixels = ($widthUnits / 256) * 7;
$offsetWidthUnits = $widthUnits % 256; $offsetWidthUnits = $widthUnits % 256;
$pixels += round($offsetWidthUnits / (256 / 7)); return $pixels + round($offsetWidthUnits / (256 / 7));
return $pixels;
} }
protected static function hex2str($hex) protected static function hex2str($hex)

View File

@ -298,9 +298,7 @@ class Font
$upperLeftCornerX = $textBox[6]; $upperLeftCornerX = $textBox[6];
// Consider the rotation when calculating the width // Consider the rotation when calculating the width
$textWidth = max($lowerRightCornerX - $upperLeftCornerX, $upperRightCornerX - $lowerLeftCornerX); return max($lowerRightCornerX - $upperLeftCornerX, $upperRightCornerX - $lowerLeftCornerX);
return $textWidth;
} }
/** /**

View File

@ -430,9 +430,7 @@ class StringHelper
// characters // characters
$chars = self::convertEncoding($value, 'UTF-16LE', 'UTF-8'); $chars = self::convertEncoding($value, 'UTF-16LE', 'UTF-8');
$data = pack('vC', $ln, 0x0001) . $chars; return pack('vC', $ln, 0x0001) . $chars;
return $data;
} }
/** /**

View File

@ -269,7 +269,7 @@ class Xls
$startCoordinates = Coordinate::stringFromColumnIndex($col_start) . ($row_start + 1); $startCoordinates = Coordinate::stringFromColumnIndex($col_start) . ($row_start + 1);
$endCoordinates = Coordinate::stringFromColumnIndex($col_end) . ($row_end + 1); $endCoordinates = Coordinate::stringFromColumnIndex($col_end) . ($row_end + 1);
$twoAnchor = [ return [
'startCoordinates' => $startCoordinates, 'startCoordinates' => $startCoordinates,
'startOffsetX' => $x1, 'startOffsetX' => $x1,
'startOffsetY' => $y1, 'startOffsetY' => $y1,
@ -277,7 +277,5 @@ class Xls
'endOffsetX' => $x2, 'endOffsetX' => $x2,
'endOffsetY' => $y2, 'endOffsetY' => $y2,
]; ];
return $twoAnchor;
} }
} }

View File

@ -2912,9 +2912,7 @@ class Worksheet implements IComparable
$rangeSet = $rangeBoundaries[0][0] . $rangeBoundaries[0][1] . ':' . $rangeBoundaries[1][0] . $rangeBoundaries[1][1]; $rangeSet = $rangeBoundaries[0][0] . $rangeBoundaries[0][1] . ':' . $rangeBoundaries[1][0] . $rangeBoundaries[1][1];
} }
unset($rangeSet); unset($rangeSet);
$stRange = implode(' ', $rangeBlocks); return implode(' ', $rangeBlocks);
return $stRange;
} }
/** /**
@ -2961,9 +2959,7 @@ class Worksheet implements IComparable
*/ */
public function copy() public function copy()
{ {
$copied = clone $this; return clone $this;
return $copied;
} }
/** /**

View File

@ -960,15 +960,12 @@ class Html extends BaseWriter
private function createCSSStyle(Style $pStyle) private function createCSSStyle(Style $pStyle)
{ {
// Create CSS // Create CSS
$css = array_merge( return array_merge(
$this->createCSSStyleAlignment($pStyle->getAlignment()), $this->createCSSStyleAlignment($pStyle->getAlignment()),
$this->createCSSStyleBorders($pStyle->getBorders()), $this->createCSSStyleBorders($pStyle->getBorders()),
$this->createCSSStyleFont($pStyle->getFont()), $this->createCSSStyleFont($pStyle->getFont()),
$this->createCSSStyleFill($pStyle->getFill()) $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 // Create CSS - add !important to non-none border styles for merged cells
$borderStyle = $this->mapBorderStyle($pStyle->getBorderStyle()); $borderStyle = $this->mapBorderStyle($pStyle->getBorderStyle());
$css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important'); return $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important');
return $css;
} }
/** /**
@ -1153,9 +1148,7 @@ class Html extends BaseWriter
*/ */
private function generateTableFooter() private function generateTableFooter()
{ {
$html = ' </table>' . PHP_EOL; return ' </table>' . PHP_EOL;
return $html;
} }
/** /**

View File

@ -1161,17 +1161,13 @@ class Parser
// catch "-" Term // catch "-" Term
$this->advance(); $this->advance();
$result2 = $this->expression(); $result2 = $this->expression();
$result = $this->createTree('ptgUminus', $result2, ''); return $this->createTree('ptgUminus', $result2, '');
return $result;
// If it's a positive value // If it's a positive value
} elseif ($this->currentToken == '+') { } elseif ($this->currentToken == '+') {
// catch "+" Term // catch "+" Term
$this->advance(); $this->advance();
$result2 = $this->expression(); $result2 = $this->expression();
$result = $this->createTree('ptgUplus', $result2, ''); return $this->createTree('ptgUplus', $result2, '');
return $result;
} }
$result = $this->term(); $result = $this->term();
while (($this->currentToken == '+') or while (($this->currentToken == '+') or
@ -1205,9 +1201,7 @@ class Parser
*/ */
private function parenthesizedExpression() private function parenthesizedExpression()
{ {
$result = $this->createTree('ptgParen', $this->expression(), ''); return $this->createTree('ptgParen', $this->expression(), '');
return $result;
} }
/** /**
@ -1309,9 +1303,7 @@ class Parser
return $result; return $result;
} elseif (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/i", $this->currentToken)) { } elseif (preg_match("/^[A-Z0-9\xc0-\xdc\\.]+$/i", $this->currentToken)) {
// if it's a function call // if it's a function call
$result = $this->func(); return $this->func();
return $result;
} }
throw new WriterException('Syntax error: ' . $this->currentToken . ', lookahead: ' . $this->lookAhead . ', current char: ' . $this->currentCharacter); 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']); $converted_tree = $this->convert($tree['value']);
$polish .= $converted_tree; return $polish . $converted_tree;
return $polish;
} }
} }