Php Inspections (EA Extended): minor code tweaks (#579)

This commit is contained in:
Vladimir Reznichenko 2018-07-04 16:55:33 +02:00 committed by Adrien Crivelli
parent 9fdcaabe3c
commit e0ed25d6b2
4 changed files with 7 additions and 7 deletions

View File

@ -2395,10 +2395,10 @@ class Calculation
if (self::$functionReplaceToLocale === null) { if (self::$functionReplaceToLocale === null) {
self::$functionReplaceToLocale = []; self::$functionReplaceToLocale = [];
foreach (array_values(self::$localeFunctions) as $localeFunctionName) { foreach (self::$localeFunctions as $localeFunctionName) {
self::$functionReplaceToLocale[] = '$1' . trim($localeFunctionName) . '$2'; self::$functionReplaceToLocale[] = '$1' . trim($localeFunctionName) . '$2';
} }
foreach (array_values(self::$localeBoolean) as $localeBoolean) { foreach (self::$localeBoolean as $localeBoolean) {
self::$functionReplaceToLocale[] = '$1' . trim($localeBoolean) . '$2'; self::$functionReplaceToLocale[] = '$1' . trim($localeBoolean) . '$2';
} }
} }
@ -2414,10 +2414,10 @@ class Calculation
{ {
if (self::$functionReplaceFromLocale === null) { if (self::$functionReplaceFromLocale === null) {
self::$functionReplaceFromLocale = []; self::$functionReplaceFromLocale = [];
foreach (array_values(self::$localeFunctions) as $localeFunctionName) { foreach (self::$localeFunctions as $localeFunctionName) {
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($localeFunctionName, '/') . '([\s]*\()/Ui'; 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'; self::$functionReplaceFromLocale[] = '/(@?[^\w\.])' . preg_quote($excelBoolean, '/') . '([^\w\.])/Ui';
} }
} }

View File

@ -355,7 +355,7 @@ class Functions
return false; return false;
} }
return in_array($value, array_values(self::$errorCodes)); return in_array($value, self::$errorCodes);
} }
/** /**

View File

@ -1090,7 +1090,7 @@ class MathTrig
if ($cellReference->getWorksheet()->cellExists($column . $row)) { if ($cellReference->getWorksheet()->cellExists($column . $row)) {
//take this cell out if it contains the SUBTOTAL formula //take this cell out if it contains the SUBTOTAL formula
$isFormula = $cellReference->getWorksheet()->getCell($column . $row)->isFormula(); $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; return !$isFormula || $cellFormula;
} }

View File

@ -76,7 +76,7 @@ class Xml extends BaseReader
// Read sample data (first 2 KB will do) // Read sample data (first 2 KB will do)
$data = fread($fileHandle, 2048); $data = fread($fileHandle, 2048);
fclose($fileHandle); fclose($fileHandle);
$data = strtr($data, "'", '"'); // fix headers with single quote $data = str_replace("'", '"', $data); // fix headers with single quote
$valid = true; $valid = true;
foreach ($signature as $match) { foreach ($signature as $match) {