Skip to content

Commit

Permalink
Php Inspections (EA Extended): minor code tweaks (PHPOffice#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
kalessil authored and PowerKiKi committed Jul 4, 2018
1 parent 9fdcaab commit e0ed25d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/PhpSpreadsheet/Calculation/Calculation.php
Original file line number Diff line number Diff line change
Expand Up @@ -2395,10 +2395,10 @@ public function _translateFormulaToLocale($formula)

if (self::$functionReplaceToLocale === null) {
self::$functionReplaceToLocale = [];
foreach (array_values(self::$localeFunctions) as $localeFunctionName) {
foreach (self::$localeFunctions as $localeFunctionName) {
self::$functionReplaceToLocale[] = '$1' . trim($localeFunctionName) . '$2';
}
foreach (array_values(self::$localeBoolean) as $localeBoolean) {
foreach (self::$localeBoolean as $localeBoolean) {
self::$functionReplaceToLocale[] = '$1' . trim($localeBoolean) . '$2';
}
}
Expand All @@ -2414,10 +2414,10 @@ public function _translateFormulaToEnglish($formula)
{
if (self::$functionReplaceFromLocale === null) {
self::$functionReplaceFromLocale = [];
foreach (array_values(self::$localeFunctions) as $localeFunctionName) {
foreach (self::$localeFunctions as $localeFunctionName) {
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($localeFunctionName, '/') . '([\s]*\()/Ui';
}
foreach (array_values(self::$localeBoolean) as $excelBoolean) {
foreach (self::$localeBoolean as $excelBoolean) {
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($excelBoolean, '/') . '([^\w\.])/Ui';
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/PhpSpreadsheet/Calculation/Functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ public static function isError($value = '')
return false;
}

return in_array($value, array_values(self::$errorCodes));
return in_array($value, self::$errorCodes);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/PhpSpreadsheet/Calculation/MathTrig.php
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ function ($index) use ($cellReference) {
if ($cellReference->getWorksheet()->cellExists($column . $row)) {
//take this cell out if it contains the SUBTOTAL formula
$isFormula = $cellReference->getWorksheet()->getCell($column . $row)->isFormula();
$cellFormula = !preg_match('/^=.*\bSUBTOTAL\s*\(/', strtoupper($cellReference->getWorksheet()->getCell($column . $row)->getValue()));
$cellFormula = !preg_match('/^=.*\bSUBTOTAL\s*\(/i', $cellReference->getWorksheet()->getCell($column . $row)->getValue());

return !$isFormula || $cellFormula;
}
Expand Down
2 changes: 1 addition & 1 deletion src/PhpSpreadsheet/Reader/Xml.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public function canRead($pFilename)
// Read sample data (first 2 KB will do)
$data = fread($fileHandle, 2048);
fclose($fileHandle);
$data = strtr($data, "'", '"'); // fix headers with single quote
$data = str_replace("'", '"', $data); // fix headers with single quote

$valid = true;
foreach ($signature as $match) {
Expand Down

0 comments on commit e0ed25d

Please sign in to comment.