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;
}, $tokens);
$str = '[ ' . implode(' | ', $tokensStr) . ' ]';
return $str;
return '[ ' . implode(' | ', $tokensStr) . ' ]';
}
}

View File

@ -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());
}
}

View File

@ -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();
}
/**

View File

@ -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;
}
/**

View File

@ -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)

View File

@ -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);
}
/**

View File

@ -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;
}
/**

View File

@ -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;
}
}

View File

@ -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;
}
/**

View File

@ -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 = ' </table>' . PHP_EOL;
return $html;
return ' </table>' . PHP_EOL;
}
/**

View File

@ -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;
}
}