Automated native_function_invocation fixes

This commit is contained in:
drowe authored and Adrien Loison committed 2019-11-18 12:17:27 +01:00
1 parent 94b654175c
commit eb88bb4c3a
62 files changed
+237 -237

No files matched your search

@@ -98,7 +98,7 @@ class WriterEntityFactory
*/
public static function createRowFromArray(array $cellValues = [], Style $rowStyle = null)
{
$cells = array_map(function ($cellValue) {
$cells = \array_map(function ($cellValue) {
return new Cell($cellValue);
}, $cellValues);
@@ -35,7 +35,7 @@ class WriterFactory
*/
public static function createFromFile(string $path)
{
$extension = strtolower(pathinfo($path, PATHINFO_EXTENSION));
$extension = \strtolower(\pathinfo($path, PATHINFO_EXTENSION));
return self::createFromType($extension);
}
+1 -1
View File
@@ -19,7 +19,7 @@ class Workbook
*/
public function __construct()
{
$this->internalId = uniqid();
$this->internalId = \uniqid();
}
/**
@@ -28,11 +28,11 @@ class CellHelper
// Using isset here because it is way faster than array_key_exists...
if (!isset(self::$columnIndexToColumnLettersCache[$originalColumnIndex])) {
$columnLetters = '';
$capitalAAsciiValue = ord('A');
$capitalAAsciiValue = \ord('A');
do {
$modulus = $columnIndexZeroBased % 26;
$columnLetters = chr($capitalAAsciiValue + $modulus) . $columnLetters;
$columnLetters = \chr($capitalAAsciiValue + $modulus) . $columnLetters;
// substracting 1 because it's zero-based
$columnIndexZeroBased = (int) ($columnIndexZeroBased / 26) - 1;
+7 -7
View File
@@ -135,7 +135,7 @@ class ZipHelper
public static function canChooseCompressionMethod()
{
// setCompressionName() is a PHP7+ method...
return (method_exists(new \ZipArchive(), 'setCompressionName'));
return (\method_exists(new \ZipArchive(), 'setCompressionName'));
}
/**
@@ -151,7 +151,7 @@ class ZipHelper
foreach ($itemIterator as $itemInfo) {
$itemRealPath = $this->getNormalizedRealPath($itemInfo->getPathname());
$itemLocalPath = str_replace($folderRealPath, '', $itemRealPath);
$itemLocalPath = \str_replace($folderRealPath, '', $itemRealPath);
if ($itemInfo->isFile() && !$this->shouldSkipFile($zip, $itemLocalPath, $existingFileMode)) {
$zip->addFile($itemRealPath, $itemLocalPath);
@@ -181,9 +181,9 @@ class ZipHelper
*/
protected function getNormalizedRealPath($path)
{
$realPath = realpath($path);
$realPath = \realpath($path);
return str_replace(DIRECTORY_SEPARATOR, '/', $realPath);
return \str_replace(DIRECTORY_SEPARATOR, '/', $realPath);
}
/**
@@ -210,8 +210,8 @@ class ZipHelper
*/
protected function copyZipToStream($zipFilePath, $pointer)
{
$zipFilePointer = fopen($zipFilePath, 'r');
stream_copy_to_stream($zipFilePointer, $pointer);
fclose($zipFilePointer);
$zipFilePointer = \fopen($zipFilePath, 'r');
\stream_copy_to_stream($zipFilePointer, $pointer);
\fclose($zipFilePointer);
}
}
@@ -45,8 +45,8 @@ class SheetManager
*/
public function throwIfNameIsInvalid($name, Sheet $sheet)
{
if (!is_string($name)) {
$actualType = gettype($name);
if (!\is_string($name)) {
$actualType = \gettype($name);
$errorMessage = "The sheet's name is invalid. It must be a string ($actualType given).";
throw new InvalidSheetNameException($errorMessage);
}
@@ -74,9 +74,9 @@ class SheetManager
}
}
if (count($failedRequirements) !== 0) {
if (\count($failedRequirements) !== 0) {
$errorMessage = "The sheet's name (\"$name\") is invalid. It did not respect these rules:\n - ";
$errorMessage .= implode("\n - ", $failedRequirements);
$errorMessage .= \implode("\n - ", $failedRequirements);
throw new InvalidSheetNameException($errorMessage);
}
}
@@ -90,7 +90,7 @@ class SheetManager
*/
private function doesContainInvalidCharacters($name)
{
return (str_replace(self::$INVALID_CHARACTERS_IN_SHEET_NAME, '', $name) !== $name);
return (\str_replace(self::$INVALID_CHARACTERS_IN_SHEET_NAME, '', $name) !== $name);
}
/**
@@ -80,7 +80,7 @@ class StyleManager implements StyleManagerInterface
return $cellStyle;
}
if ($cell->isString() && strpos($cell->getValue(), "\n") !== false) {
if ($cell->isString() && \strpos($cell->getValue(), "\n") !== false) {
$cellStyle->setShouldWrapText();
}
@@ -37,7 +37,7 @@ class StyleRegistry
$serializedStyle = $this->serialize($style);
if (!$this->hasStyleAlreadyBeenRegistered($style)) {
$nextStyleId = count($this->serializedStyleToStyleIdMappingTable);
$nextStyleId = \count($this->serializedStyleToStyleIdMappingTable);
$style->setId($nextStyleId);
$this->serializedStyleToStyleIdMappingTable[$serializedStyle] = $nextStyleId;
@@ -79,7 +79,7 @@ class StyleRegistry
*/
public function getRegisteredStyles()
{
return array_values($this->styleIdToStyleMappingTable);
return \array_values($this->styleIdToStyleMappingTable);
}
/**
@@ -105,7 +105,7 @@ class StyleRegistry
$currentId = $style->getId();
$style->setId(0);
$serializedStyle = serialize($style);
$serializedStyle = \serialize($style);
$style->setId($currentId);
@@ -124,7 +124,7 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
{
$worksheets = $this->getWorksheets();
$newSheetIndex = count($worksheets);
$newSheetIndex = \count($worksheets);
$sheetManager = $this->managerFactory->createSheetManager();
$sheet = $this->entityFactory->createSheet($newSheetIndex, $this->workbook->getInternalId(), $sheetManager);
@@ -260,7 +260,7 @@ abstract class WorkbookManagerAbstract implements WorkbookManagerInterface
// update max num columns for the worksheet
$currentMaxNumColumns = $worksheet->getMaxNumColumns();
$cellsCount = $row->getNumCells();
$worksheet->setMaxNumColumns(max($currentMaxNumColumns, $cellsCount));
$worksheet->setMaxNumColumns(\max($currentMaxNumColumns, $cellsCount));
}
/**