Skip to content

Commit

Permalink
Merge branch 'master' into #984
Browse files Browse the repository at this point in the history
  • Loading branch information
oleibman authored May 11, 2021
2 parents bb11378 + d086534 commit d5492ac
Show file tree
Hide file tree
Showing 57 changed files with 1,734 additions and 599 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,37 @@ jobs:
- name: Code style with PHP_CodeSniffer
run: ./vendor/bin/phpcs -q --report=checkstyle | cs2pr

versions:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
coverage: none
tools: cs2pr

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Code Version Compatibility check with PHP_CodeSniffer
run: ./vendor/bin/phpcs -q --report-width=200 --report=summary,full src/ --standard=PHPCompatibility --runtime-set testVersion 7.2-

phpstan:
runs-on: ubuntu-latest
steps:
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org).

### Added

- Implemented basic AutoFiltering for Ods Reader and Writer [PR #2053](https://github.com/PHPOffice/PhpSpreadsheet/pull/2053)
- Implemented basic AutoFiltering for Gnumeric Reader [PR #2055](https://github.com/PHPOffice/PhpSpreadsheet/pull/2055)
- Improved support for Row and Column ranges in formulae [Issue #1755](https://github.com/PHPOffice/PhpSpreadsheet/issues/1755) [PR #2028](https://github.com/PHPOffice/PhpSpreadsheet/pull/2028)
- Implemented URLENCODE() Web Function
- Implemented the CHITEST(), CHISQ.DIST() and CHISQ.INV() and equivalent Statistical functions, for both left- and right-tailed distributions.
- Support for ActiveSheet and SelectedCells in the ODS Reader and Writer. [PR #1908](https://github.com/PHPOffice/PhpSpreadsheet/pull/1908)
- Support for notContainsText Conditional Style in xlsx [Issue #984](https://github.com/PHPOffice/PhpSpreadsheet/issues/984)
Expand All @@ -27,7 +30,8 @@ and this project adheres to [Semantic Versioning](https://semver.org).
- Nothing.

### Fixed

- Correctly handle absolute A1 references when converting to R1C1 format [PR #2060](https://github.com/PHPOffice/PhpSpreadsheet/pull/2060)
- Correct default fill style for conditional without a pattern defined [Issue #2035](https://github.com/PHPOffice/PhpSpreadsheet/issues/2035) [PR #2050](https://github.com/PHPOffice/PhpSpreadsheet/pull/2050)
- Fixed issue where array key check for existince before accessing arrays in Xlsx.php. [PR #1970](https://github.com/PHPOffice/PhpSpreadsheet/pull/1970)
- Fixed issue with quoted strings in number format mask rendered with toFormattedString() [Issue 1972#](https://github.com/PHPOffice/PhpSpreadsheet/issues/1972) [PR #1978](https://github.com/PHPOffice/PhpSpreadsheet/pull/1978)
- Fixed issue with percentage formats in number format mask rendered with toFormattedString() [Issue 1929#](https://github.com/PHPOffice/PhpSpreadsheet/issues/1929) [PR #1928](https://github.com/PHPOffice/PhpSpreadsheet/pull/1928)
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
},
"require": {
"php": "^7.2 || ^8.0",
"ext-simplexml": "*",
"ext-ctype": "*",
"ext-dom": "*",
"ext-fileinfo": "*",
"ext-gd": "*",
"ext-iconv": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-simplexml": "*",
"ext-xml": "*",
"ext-xmlreader": "*",
"ext-xmlwriter": "*",
Expand All @@ -75,6 +75,7 @@
"psr/simple-cache": "^1.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "dev-master",
"dompdf/dompdf": "^1.0",
"friendsofphp/php-cs-fixer": "^2.18",
"jpgraph/jpgraph": "^4.0",
Expand Down
79 changes: 76 additions & 3 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions docs/references/features-cross-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -1220,13 +1220,13 @@
</tr>
<tr>
<td style="padding-left: 1em;">Merged Cells</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td style="text-align: center; color: green;">✔</td>
<td style="text-align: center; color: green;">✔</td>
<td></td>
<td></td>
<td style="text-align: center; color: green;">✔</td>
<td style="text-align: center; color: green;">✔</td>
<td>N/A</td>
<td>N/A</td>
<td></td>
<td></td>
<td></td>
Expand Down Expand Up @@ -1313,13 +1313,13 @@
<td style="text-align: center; color: orange;">●</td>
<td style="text-align: center; color: orange;">●</td>
<td></td>
<td></td>
<td></td>
<td style="text-align: center; color: orange;">●</td>
<td style="text-align: center; color: orange;">●</td>
<td></td>
<td></td>
<td style="text-align: center; color: orange;">●</td>
<td style="text-align: center; color: orange;">●</td>
<td></td>
<td style="text-align: center; color: orange;">●</td>
<td></td>
<td></td>
<td></td>
Expand Down
85 changes: 0 additions & 85 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -975,11 +975,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Calculation/LookupRef/LookupBase.php

-
message: "#^Parameter \\#3 \\$rowNum of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Matrix\\:\\:extractRowValue\\(\\) expects int, float\\|int\\<0, max\\>\\|string given\\.$#"
count: 1
path: src/PhpSpreadsheet/Calculation/LookupRef/Matrix.php

-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\LookupRef\\\\Matrix\\:\\:extractRowValue\\(\\) has no return typehint specified\\.$#"
count: 1
Expand Down Expand Up @@ -2545,71 +2540,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Reader/Csv/Delimiter.php

-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:\\$referenceHelper has no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Parameter \\#1 \\$fp of function fread expects resource, resource\\|false given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Parameter \\#1 \\$fp of function fclose expects resource, resource\\|false given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:\\$mappings has no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Offset 'No' does not exist on SimpleXMLElement\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Offset 'Unit' does not exist on SimpleXMLElement\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Offset 'DefaultSizePts' does not exist on SimpleXMLElement\\|null\\.$#"
count: 2
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:parseBorderAttributes\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:parseBorderAttributes\\(\\) has parameter \\$borderAttributes with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:parseRichText\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:parseRichText\\(\\) has parameter \\$is with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:parseGnumericColour\\(\\) has no return typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Gnumeric\\:\\:parseGnumericColour\\(\\) has parameter \\$gnmColour with no typehint specified\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Gnumeric.php

-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Html\\:\\:\\$rowspan has no typehint specified\\.$#"
count: 1
Expand Down Expand Up @@ -2810,21 +2740,6 @@ parameters:
count: 1
path: src/PhpSpreadsheet/Reader/Ods.php

-
message: "#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#"
count: 7
path: src/PhpSpreadsheet/Reader/Ods.php

-
message: "#^Method PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\:\\:convertToExcelAddressValue\\(\\) should return string but returns string\\|null\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Ods.php

-
message: "#^Parameter \\#3 \\$formula of static method PhpOffice\\\\PhpSpreadsheet\\\\Calculation\\\\Calculation\\:\\:translateSeparator\\(\\) expects string, string\\|null given\\.$#"
count: 1
path: src/PhpSpreadsheet/Reader/Ods.php

-
message: "#^Property PhpOffice\\\\PhpSpreadsheet\\\\Reader\\\\Ods\\\\PageSettings\\:\\:\\$officeNs has no typehint specified\\.$#"
count: 1
Expand Down
3 changes: 2 additions & 1 deletion samples/Basic/16_Csv.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
$filenameCSV = $helper->getFilename(__FILE__, 'csv');
/** @var \PhpOffice\PhpSpreadsheet\Writer\Csv $writerCSV */
$writerCSV = new CsvWriter($spreadsheetFromCSV);
$writerCSV->setExcelCompatibility(true);
//$writerCSV->setExcelCompatibility(true);
$writerCSV->setUseBom(true); // because of non-ASCII chars

$callStartTime = microtime(true);
$writerCSV->save($filenameCSV);
Expand Down
2 changes: 1 addition & 1 deletion src/PhpSpreadsheet/Calculation/LookupRef/Hyperlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class Hyperlink
* HYPERLINK.
*
* Excel Function:
* =HYPERLINK(linkURL,displayName)
* =HYPERLINK(linkURL, [displayName])
*
* @param mixed $linkURL Expect string. Value to check, is also the value returned when no error
* @param mixed $displayName Expect string. Value to return when testValue is an error condition
Expand Down
39 changes: 39 additions & 0 deletions src/PhpSpreadsheet/Calculation/LookupRef/LookupRefValidations.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

namespace PhpOffice\PhpSpreadsheet\Calculation\LookupRef;

use PhpOffice\PhpSpreadsheet\Calculation\Exception;
use PhpOffice\PhpSpreadsheet\Calculation\Functions;

class LookupRefValidations
{
/**
* @param mixed $value
*/
public static function validateInt($value): int
{
if (!is_numeric($value)) {
if (Functions::isError($value)) {
throw new Exception($value);
}

throw new Exception(Functions::VALUE());
}

return (int) floor((float) $value);
}

/**
* @param mixed $value
*/
public static function validatePositiveInt($value, bool $allowZero = true): int
{
$value = self::validateInt($value);

if (($allowZero === false && $value <= 0) || $value < 0) {
throw new Exception(Functions::VALUE());
}

return $value;
}
}
Loading

0 comments on commit d5492ac

Please sign in to comment.