Skip to content

Commit a75022a

Browse files
authored
Merge pull request #3793 from PHPOffice/powerkiki
Add all missing native types
2 parents 2e4b8f8 + 76c5b98 commit a75022a

File tree

502 files changed

+3681
-16149
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

502 files changed

+3681
-16149
lines changed

bin/check-phpdoc-types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
function checkPhpDocTypes(): void
1212
{
1313
$content = `git diff --cached` ?? `git diff` ?? `git show HEAD`;
14-
preg_match_all('~^\+ +\* @(param|var) (mixed|string|int|float|bool|null|array|\?|\|)+ \$\w+$~m', $content, $parameters);
14+
preg_match_all('~^\+ +\* @(param|var) (mixed|string|int|float|bool|null|array|\?|\|)+( \$\w+)?$~m', $content, $parameters);
1515
preg_match_all('~^\+ +\* @return (mixed|string|int|float|bool|null|array|void|\?|\|)+$~m', $content, $returns);
1616

1717
$errors = [

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,22 @@
4646
"scripts": {
4747
"check": [
4848
"./bin/check-phpdoc-types",
49-
"phpcs src/ tests/ --report=checkstyle",
50-
"phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PHPCompatibility --runtime-set testVersion 8.0- -n",
49+
"phpcs samples/ src/ tests/ --report=checkstyle",
50+
"phpcs samples/ src/ tests/ --standard=PHPCompatibility --runtime-set testVersion 8.0- -n",
5151
"php-cs-fixer fix --ansi --dry-run --diff",
5252
"phpunit --color=always",
5353
"phpstan analyse --ansi --memory-limit=2048M"
5454
],
5555
"style": [
56-
"phpcs src/ tests/ --report=checkstyle",
56+
"phpcs samples/ src/ tests/ --report=checkstyle",
5757
"php-cs-fixer fix --ansi --dry-run --diff"
5858
],
5959
"fix": [
60-
"phpcbf src/ tests/ --report=checkstyle",
60+
"phpcbf samples/ src/ tests/ --report=checkstyle",
6161
"php-cs-fixer fix"
6262
],
6363
"versions": [
64-
"phpcs --report-width=200 samples/ src/ tests/ --ignore=samples/Header.php --standard=PHPCompatibility --runtime-set testVersion 8.0- -n"
64+
"phpcs samples/ src/ tests/ --standard=PHPCompatibility --runtime-set testVersion 8.0- -n"
6565
]
6666
},
6767
"require": {

infra/LocaleGenerator.php

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,23 @@ class LocaleGenerator
2828
private const ENGLISH_REFERENCE_COLUMN = 'B';
2929
private const EOL = "\n"; // not PHP_EOL
3030

31-
/**
32-
* @var string
33-
*/
34-
protected $translationSpreadsheetName;
31+
protected string $translationSpreadsheetName;
3532

36-
/**
37-
* @var string
38-
*/
39-
protected $translationBaseFolder;
33+
protected string $translationBaseFolder;
4034

4135
protected array $phpSpreadsheetFunctions;
4236

43-
/**
44-
* @var Spreadsheet
45-
*/
46-
protected $translationSpreadsheet;
37+
protected Spreadsheet $translationSpreadsheet;
4738

4839
protected bool $verbose;
4940

50-
/**
51-
* @var Worksheet
52-
*/
53-
protected $localeTranslations;
41+
protected Worksheet $localeTranslations;
5442

5543
protected array $localeLanguageMap = [];
5644

5745
protected array $errorCodeMap = [];
5846

59-
/**
60-
* @var Worksheet
61-
*/
62-
private $functionNameTranslations;
47+
private Worksheet $functionNameTranslations;
6348

6449
protected array $functionNameLanguageMap = [];
6550

phpstan-baseline.neon

Lines changed: 995 additions & 0 deletions
Large diffs are not rendered by default.

phpstan.neon.dist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ includes:
66
parameters:
77
level: 8
88
paths:
9+
- samples/
910
- src/
1011
- tests/
11-
- samples/
1212
- infra/
1313
- bin/generate-document
1414
- bin/generate-locales

samples/Basic/24_Readfilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
class MyReadFilter implements IReadFilter
2020
{
21-
public function readCell($columnAddress, $row, $worksheetName = '')
21+
public function readCell(string $columnAddress, int $row, string $worksheetName = ''): bool
2222
{
2323
// Read title row and rows 20 - 30
2424
if ($row == 1 || ($row >= 20 && $row <= 30)) {

samples/Basic/26_Utf8.php

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,20 @@
1616
$helper->write($spreadsheet, __FILE__, ['Xlsx', 'Xls', 'Html']);
1717

1818
// Export to PDF (mpdf)
19-
function mpdfCjkWriter(Mpdf $writer): void
20-
{
21-
/** @var callable */
22-
$callback = 'mpdfCjk';
23-
$writer->setEditHtmlCallback($callback);
24-
}
19+
$mpdfCjkWriter = function (Mpdf $writer): void {
20+
$mpdfCjk = function (string $html): string {
21+
$html = str_replace("'Calibri'", "'Calibri',Sun-ExtA", $html);
2522

26-
function mpdfCjk(string $html): string
27-
{
28-
$html = str_replace("'Calibri'", "'Calibri',Sun-ExtA", $html);
23+
return str_replace("'Times New Roman'", "'Times New Roman',Sun-ExtA", $html);
24+
};
2925

30-
return str_replace("'Times New Roman'", "'Times New Roman',Sun-ExtA", $html);
31-
}
26+
$writer->setEditHtmlCallback($mpdfCjk);
27+
};
3228

3329
$helper->log('Write to Mpdf');
3430
IOFactory::registerWriter('Pdf', Mpdf::class);
35-
/** @var callable */
36-
$callback = 'mpdfCjkWriter';
3731
$filename = __FILE__;
38-
//$filename = str_replace('.php', '.mdpf.php', __FILE__);
39-
$helper->write($spreadsheet, $filename, ['Pdf'], false, $callback);
32+
$helper->write($spreadsheet, $filename, ['Pdf'], false, $mpdfCjkWriter);
4033

4134
// Remove first two rows with field headers before exporting to CSV
4235
$helper->log('Removing first two heading rows for CSV export');

samples/Basic/39_Dropdown.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function transpose(string $value): array
4040
$countryCount = count($countries);
4141

4242
// Transpose $countries from a row to a column array
43-
$countries = array_map('transpose', $countries);
43+
$countries = array_map(fn (mixed $value): array => [$value], $countries);
4444
$spreadsheet->getActiveSheet()
4545
->fromArray($countries, null, $column . '1');
4646
$spreadsheet->addNamedRange(

samples/Chart/33_Chart_create_line_dateaxis.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
$xAxisTickValues, // plotCategory
158158
$dataSeriesValues, // plotValues
159159
null, // plotDirection
160-
null, // smooth line
160+
false, // smooth line
161161
DataSeries::STYLE_SMOOTHMARKER // plotStyle
162162
);
163163

@@ -279,7 +279,7 @@
279279
// change xAxis tick marks to match Qtr boundaries
280280

281281
$nQtrs = sprintf('%3.2f', (($dateMinMax['max'] - $dateMinMax['min']) / 30.5) / 4);
282-
$tickMarkInterval = ($nQtrs > 20) ? 6 : 3; // tick marks every ? months
282+
$tickMarkInterval = ($nQtrs > 20) ? '6' : '3'; // tick marks every ? months
283283

284284
$xAxis->setAxisOptionsProperties(
285285
Properties::AXIS_LABELS_NEXT_TO, // axis_label pos

samples/Chart/33_Chart_create_radar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
$xAxisTickValues, // plotCategory
7575
$dataSeriesValues, // plotValues
7676
null, // plotDirection
77-
null, // smooth line
77+
false, // smooth line
7878
DataSeries::STYLE_MARKER // plotStyle
7979
);
8080

0 commit comments

Comments
 (0)