| @@ -176,9 +176,9 @@ | ||
| 176 | 176 | |
| 177 | 177 | try { |
| 178 | 178 | // Treat all cell values as strings, except for formulas (due to recognition of quoted/escaped formulas like `'=A2`). |
| 179 | 179 | \TablePress\PhpOffice\PhpSpreadsheet\Cell\Cell::setValueBinder( new \TablePress\PhpOffice\PhpSpreadsheet\Cell\StringValueBinder() ); |
| 180 | - \TablePress\PhpOffice\PhpSpreadsheet\Cell\Cell::getValueBinder()->setFormulaConversion( false ); // @phpstan-ignore-line | |
| 180 | + \TablePress\PhpOffice\PhpSpreadsheet\Cell\Cell::getValueBinder()->setFormulaConversion( false ); // @phpstan-ignore method.notFound | |
| 181 | 181 | |
| 182 | 182 | /* |
| 183 | 183 | * Try to detect a reader from the file extension and MIME type. |
| 184 | 184 | * Fall back to CSV if no reader could be determined. |
| @@ -207,10 +207,10 @@ | ||
| 207 | 207 | $class_type = explode( '\\', $class_name ); |
| 208 | 208 | $detected_format = strtolower( array_pop( $class_type ) ); |
| 209 | 209 | |
| 210 | 210 | if ( 'csv' === $detected_format ) { |
| 211 | - $reader->setInputEncoding( \TablePress\PhpOffice\PhpSpreadsheet\Reader\Csv::GUESS_ENCODING ); // @phpstan-ignore-line | |
| 212 | - // @phpstan-ignore-next-line | |
| 211 | + $reader->setInputEncoding( \TablePress\PhpOffice\PhpSpreadsheet\Reader\Csv::GUESS_ENCODING ); // @phpstan-ignore method.notFound | |
| 212 | + // @phpstan-ignore method.notFound | |
| 213 | 213 | $reader->setEscapeCharacter( ( PHP_VERSION_ID < 70400 ) ? "\x0" : '' ); // Disable the proprietary escape mechanism of PHP's fgetcsv() in PHP >= 7.4. |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | $reader->setIncludeCharts( false ); |
| @@ -222,9 +222,9 @@ | ||
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | // For formats where it's supported, import only the first sheet. |
| 225 | 225 | if ( in_array( $detected_format, array( 'csv', 'html', 'slk' ), true ) ) { |
| 226 | - $reader->setSheetIndex( 0 ); // @phpstan-ignore-line | |
| 226 | + $reader->setSheetIndex( 0 ); // @phpstan-ignore method.notFound | |
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | $spreadsheet = $reader->load( $file->location ); |
| 230 | 230 | $worksheet = $spreadsheet->getActiveSheet(); |
| @@ -285,13 +285,13 @@ | ||
| 285 | 285 | } |
| 286 | 286 | $cell_data = \TablePress\PhpOffice\PhpSpreadsheet\Style\NumberFormat::toFormattedString( |
| 287 | 287 | $cell_data, |
| 288 | 288 | $format, |
| 289 | - array( $this, 'format_color' ) | |
| 289 | + array( $this, 'format_color' ), | |
| 290 | 290 | ); |
| 291 | 291 | |
| 292 | 292 | if ( strlen( $cell_data ) > 1 && '=' === $cell_data[0] ) { |
| 293 | - if ( $style->getQuotePrefix() ) { | |
| 293 | + if ( 'xlsx' === $detected_format && $style->getQuotePrefix() ) { | |
| 294 | 294 | // Prepend a ' to quoted/escaped formulas (so that they are shown as text). This is currently not supported (at least) for the XLS format. |
| 295 | 295 | $cell_data = "'{$cell_data}"; |
| 296 | 296 | } else { |
| 297 | 297 | // Bail early, to not add inline HTML styling around formulas, as they won't work anymore then. |