Skip to content

Commit

Permalink
Merge branch 'master' into currencies_stored_as_strings
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkBaker authored Nov 25, 2022
2 parents 171d768 + 6a259d9 commit 80e4d3a
Show file tree
Hide file tree
Showing 184 changed files with 2,144 additions and 2,461 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
include:
- php-version: 'nightly'
experimental: true
- php-version: '7.3'
experimental: true

name: PHP ${{ matrix.php-version }}

Expand Down Expand Up @@ -43,7 +45,7 @@ jobs:

- name: Delete composer lock file
id: composer-lock
if: ${{ matrix.php-version == '8.1' || matrix.php-version == '8.2' || matrix.php-version == 'nightly' }}
if: ${{ matrix.php-version == '8.1' || matrix.php-version == '8.2' || matrix.php-version == '7.3' || matrix.php-version == 'nightly' }}
run: |
rm composer.lock
echo "::set-output name=flags::--ignore-platform-reqs"
Expand Down
4 changes: 4 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ file in Excel, the actual width is 0.71 less than it should be.
The short answer is that PhpSpreadsheet uses a measure where padding is
included. See [how to set a column's width](./topics/recipes.md#setting-a-columns-width)
for more details.

## I cannot serialize or json_encode my Spreadsheet

No, you can't. Consider the Spreadsheet object as a PHP resource, which cannot be serialized.
86 changes: 1 addition & 85 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -1,65 +1,5 @@
parameters:
ignoreErrors:
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DMAX\\(\\) should return float but returns float\\|string\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DMIN\\(\\) should return float but returns float\\|string\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DPRODUCT\\(\\) should return float\\|string but returns float\\|string\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DSTDEV\\(\\) should return float\\|string but returns float\\|string\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DSTDEVP\\(\\) should return float\\|string but returns float\\|string\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DSUM\\(\\) should return float\\|string but returns float\\|string\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DVAR\\(\\) should return float\\|string but returns float\\|string\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\:\\:DVARP\\(\\) should return float\\|string but returns float\\|string\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database.php
-
message: "#^Parameter \\#2 \\$field of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\\\DCountA\\:\\:evaluate\\(\\) expects int\\|string, int\\|string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\\\DatabaseAbstract\\:\\:buildCondition\\(\\) has parameter \\$criterion with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\\\DatabaseAbstract\\:\\:evaluate\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\\\DatabaseAbstract\\:\\:evaluate\\(\\) has parameter \\$criteria with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\\\DatabaseAbstract\\:\\:evaluate\\(\\) has parameter \\$database with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\\\DatabaseAbstract\\:\\:evaluate\\(\\) has parameter \\$field with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Database\\\\DatabaseAbstract\\:\\:processCondition\\(\\) has no return type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/Database/DatabaseAbstract.php
-
message: "#^Variable \\$dateValue on left side of \\?\\? always exists and is not nullable\\.$#"
count: 1
Expand Down Expand Up @@ -930,7 +870,7 @@ parameters:
path: src/PhpSpreadsheet/Reader/Xls.php
-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 8
count: 7
path: src/PhpSpreadsheet/Reader/Xls.php

-
Expand Down Expand Up @@ -974,10 +914,6 @@ parameters:
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\RichText\\\\Run\\:\\:\\$font \\(PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\) does not accept PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\Font\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/RichText/Run.php
-
message: "#^Cannot access offset 1 on array\\|false\\.$#"
count: 1
path: src/PhpSpreadsheet/Shared/Drawing.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Escher\\\\DgContainer\\:\\:getDgId\\(\\) has no return type specified\\.$#"
count: 1
Expand Down Expand Up @@ -1422,26 +1358,6 @@ parameters:
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Shared\\\\Trend\\\\Trend\\:\\:calculate\\(\\) has parameter \\$yValues with no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Shared/Trend/Trend.php
-
message: "#^Call to function is_array\\(\\) with string will always evaluate to false\\.$#"
count: 1
path: src/PhpSpreadsheet/Spreadsheet.php
-
message: "#^Parameter \\#1 \\$worksheet of method PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:getIndex\\(\\) expects PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet, PhpOffice\\\\PhpSpreadsheet\\\\Worksheet\\\\Worksheet\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Spreadsheet.php
-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet\\:\\:\\$workbookViewVisibilityValues has no type specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Spreadsheet.php
-
message: "#^Strict comparison using \\=\\=\\= between PhpOffice\\\\PhpSpreadsheet\\\\Spreadsheet and null will always evaluate to false\\.$#"
count: 1
path: src/PhpSpreadsheet/Spreadsheet.php
-
message: "#^Unreachable statement \\- code above always terminates\\.$#"
count: 1
path: src/PhpSpreadsheet/Spreadsheet.php
-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Style\\\\ConditionalFormatting\\\\ConditionalDataBar\\:\\:setConditionalFormattingRuleExt\\(\\) has no return type specified\\.$#"
count: 1
Expand Down
13 changes: 13 additions & 0 deletions samples/Basic/27_Images_Xlsx.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
<?php

use PhpOffice\PhpSpreadsheet\IOFactory;
use PhpOffice\PhpSpreadsheet\Worksheet\Drawing;

require __DIR__ . '/../Header.php';

// Read from Xlsx (.xls) template
$helper->log('Load Xlsx template file');
$reader = IOFactory::createReader('Xlsx');
// Note that Xlsx converts bmp to png, so it needs to be added
// programmatically rather than in template.
// Also note Xls converts both bmp and gif to png.
$spreadsheet = $reader->load(__DIR__ . '/../templates/27template.xlsx');
$sheet = $spreadsheet->getActiveSheet();
$drawing = new Drawing();
$drawing->setName('Test BMP');
$drawing->setPath(__DIR__ . '/../images/bmp.bmp');
$drawing->setCoordinates('G17');
$drawing->setWorksheet($sheet);

$sheet->getCell('G16')->setValue('BMP');
$sheet->getStyle('G16')->getFont()->setName('Arial Black')->setBold(true);

// Save
$helper->write($spreadsheet, __FILE__);
2 changes: 1 addition & 1 deletion samples/Calculations/LookupRef/ADDRESS.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$worksheet->getCell('A1')->setValue('=ADDRESS(2,3)');
$worksheet->getCell('A2')->setValue('=ADDRESS(2,3,2)');
$worksheet->getCell('A3')->setValue('=ADDRESS(2,3,2,FALSE)');
$worksheet->getCell('A4')->setValue('=ADDRESS(2,3,1,FALSE,"[Book1]Sheet1")');
$worksheet->getCell('A4')->setValue('=ADDRESS(2,3,1,FALSE,"[Book1.xlsx]Sheet1")');
$worksheet->getCell('A5')->setValue('=ADDRESS(2,3,1,FALSE,"EXCEL SHEET")');

for ($row = 1; $row <= 5; ++$row) {
Expand Down
Binary file modified samples/templates/27template.xlsx
Binary file not shown.
Loading

0 comments on commit 80e4d3a

Please sign in to comment.