Skip to content

Commit 5c6925d

Browse files
authored
Merge branch 'master' into optimize-worksheet-from-array
2 parents 3ca3d99 + f7c183b commit 5c6925d

File tree

1,296 files changed

+24010
-22985
lines changed

Some content is hidden

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

1,296 files changed

+24010
-22985
lines changed

.github/workflows/github-pages.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,26 @@ on:
44
tags:
55
- '*'
66

7+
permissions: {}
78
jobs:
89
github-pages:
10+
permissions:
11+
contents: write # to push pages branch (peaceiris/actions-gh-pages)
12+
913
runs-on: ubuntu-latest
1014
steps:
1115
- name: Checkout
12-
uses: actions/checkout@v3
16+
uses: actions/checkout@v4
1317

1418
- name: Setup PHP, with composer and extensions
1519
uses: shivammathur/setup-php@v2
1620
with:
17-
php-version: 8.1
21+
php-version: 8.3
1822
coverage: none # remove xdebug
1923

2024
- name: Build API documentation
2125
run: |
22-
curl -LO https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.4.1/phpDocumentor.phar
26+
curl -LO https://github.com/phpDocumentor/phpDocumentor/releases/download/v3.5.0/phpDocumentor.phar
2327
php phpDocumentor.phar --directory src/ --target docs/api
2428
2529
- name: Deploy to GithHub Pages

.github/workflows/main.yml

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
name: main
2-
on: [ push, pull_request ]
2+
on: [ push, pull_request, merge_group ]
3+
permissions:
4+
contents: read # to fetch code (actions/checkout)
35
jobs:
46
test:
57
runs-on: ubuntu-latest
@@ -8,9 +10,9 @@ jobs:
810
experimental:
911
- false
1012
php-version:
11-
- '8.0'
1213
- '8.1'
1314
- '8.2'
15+
- '8.3'
1416

1517
include:
1618
- php-version: 'nightly'
@@ -20,7 +22,7 @@ jobs:
2022

2123
steps:
2224
- name: Checkout
23-
uses: actions/checkout@v3
25+
uses: actions/checkout@v4
2426

2527
- name: Setup PHP, with composer and extensions
2628
uses: shivammathur/setup-php@v2
@@ -34,7 +36,7 @@ jobs:
3436
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
3537

3638
- name: Cache composer dependencies
37-
uses: actions/cache@v3
39+
uses: actions/cache@v4
3840
with:
3941
path: ${{ steps.composer-cache.outputs.dir }}
4042
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -59,20 +61,20 @@ jobs:
5961
- name: "Run PHPUnit tests (Experimental: ${{ matrix.experimental }})"
6062
env:
6163
FAILURE_ACTION: "${{ matrix.experimental == true }}"
62-
run: vendor/bin/phpunit --verbose || $FAILURE_ACTION
64+
run: vendor/bin/phpunit --display-incomplete --display-skipped --display-deprecations --display-errors --display-notices --display-warnings || $FAILURE_ACTION
6365

6466
phpdoc-types:
6567
runs-on: ubuntu-latest
6668
steps:
6769
- name: Checkout
68-
uses: actions/checkout@v3
70+
uses: actions/checkout@v4
6971
with:
7072
fetch-depth: 2
7173

7274
- name: Setup PHP, with composer and extensions
7375
uses: shivammathur/setup-php@v2
7476
with:
75-
php-version: 8.1
77+
php-version: 8.3
7678
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
7779
coverage: none
7880

@@ -84,12 +86,12 @@ jobs:
8486
runs-on: ubuntu-latest
8587
steps:
8688
- name: Checkout
87-
uses: actions/checkout@v3
89+
uses: actions/checkout@v4
8890

8991
- name: Setup PHP, with composer and extensions
9092
uses: shivammathur/setup-php@v2
9193
with:
92-
php-version: 8.1
94+
php-version: 8.3
9395
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
9496
coverage: none
9597
tools: cs2pr
@@ -99,7 +101,7 @@ jobs:
99101
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
100102

101103
- name: Cache composer dependencies
102-
uses: actions/cache@v3
104+
uses: actions/cache@v4
103105
with:
104106
path: ${{ steps.composer-cache.outputs.dir }}
105107
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -109,18 +111,18 @@ jobs:
109111
run: composer install --no-progress --prefer-dist --optimize-autoloader
110112

111113
- name: Code style with PHP-CS-Fixer
112-
run: ./vendor/bin/php-cs-fixer fix --format=checkstyle | cs2pr
114+
run: (./vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr) || ./vendor/bin/php-cs-fixer fix --diff --dry-run
113115

114116
phpcs:
115117
runs-on: ubuntu-latest
116118
steps:
117119
- name: Checkout
118-
uses: actions/checkout@v3
120+
uses: actions/checkout@v4
119121

120122
- name: Setup PHP, with composer and extensions
121123
uses: shivammathur/setup-php@v2
122124
with:
123-
php-version: 8.1
125+
php-version: 8.3
124126
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
125127
coverage: none
126128
tools: cs2pr
@@ -130,7 +132,7 @@ jobs:
130132
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
131133

132134
- name: Cache composer dependencies
133-
uses: actions/cache@v3
135+
uses: actions/cache@v4
134136
with:
135137
path: ${{ steps.composer-cache.outputs.dir }}
136138
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -146,12 +148,12 @@ jobs:
146148
runs-on: ubuntu-latest
147149
steps:
148150
- name: Checkout
149-
uses: actions/checkout@v3
151+
uses: actions/checkout@v4
150152

151153
- name: Setup PHP, with composer and extensions
152154
uses: shivammathur/setup-php@v2
153155
with:
154-
php-version: 8.1
156+
php-version: 8.3
155157
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
156158
coverage: none
157159
tools: cs2pr
@@ -161,7 +163,7 @@ jobs:
161163
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
162164

163165
- name: Cache composer dependencies
164-
uses: actions/cache@v3
166+
uses: actions/cache@v4
165167
with:
166168
path: ${{ steps.composer-cache.outputs.dir }}
167169
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -171,18 +173,18 @@ jobs:
171173
run: composer install --no-progress --prefer-dist --optimize-autoloader
172174

173175
- name: Code Version Compatibility check with PHP_CodeSniffer
174-
run: ./vendor/bin/phpcs -q --report-width=200 --report=summary,full src/ --standard=PHPCompatibility --runtime-set testVersion 8.0-
176+
run: ./vendor/bin/phpcs -q --report-width=200 --report=summary,full src/ --standard=PHPCompatibility --runtime-set testVersion 8.1-
175177

176178
phpstan:
177179
runs-on: ubuntu-latest
178180
steps:
179181
- name: Checkout
180-
uses: actions/checkout@v3
182+
uses: actions/checkout@v4
181183

182184
- name: Setup PHP, with composer and extensions
183185
uses: shivammathur/setup-php@v2
184186
with:
185-
php-version: 8.1
187+
php-version: 8.3
186188
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
187189
coverage: none
188190
tools: cs2pr
@@ -192,7 +194,7 @@ jobs:
192194
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
193195

194196
- name: Cache composer dependencies
195-
uses: actions/cache@v3
197+
uses: actions/cache@v4
196198
with:
197199
path: ${{ steps.composer-cache.outputs.dir }}
198200
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -215,7 +217,7 @@ jobs:
215217
- name: Setup PHP, with composer and extensions
216218
uses: shivammathur/setup-php@v2
217219
with:
218-
php-version: 8.1
220+
php-version: 8.3
219221
extensions: ctype, dom, gd, iconv, fileinfo, libxml, mbstring, simplexml, xml, xmlreader, xmlwriter, zip, zlib
220222
coverage: pcov
221223

@@ -224,7 +226,7 @@ jobs:
224226
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
225227

226228
- name: Cache composer dependencies
227-
uses: actions/cache@v3
229+
uses: actions/cache@v4
228230
with:
229231
path: ${{ steps.composer-cache.outputs.dir }}
230232
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
@@ -240,10 +242,12 @@ jobs:
240242
~/.composer/vendor/bin/ocular code-coverage:upload --format=php-clover coverage-clover.xml
241243
242244
release:
245+
permissions:
246+
contents: write # to create a release (actions/create-release)
243247
runs-on: ubuntu-latest
244248
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
245249
steps:
246-
- uses: actions/checkout@v3
250+
- uses: actions/checkout@v4
247251
with:
248252
ref: ${{ github.ref }} # Otherwise our annotated tag is not fetched and we cannot get correct version
249253

.php-cs-fixer.dist.php

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
$finder = PhpCsFixer\Finder::create()
44
->exclude('vendor')
55
->notPath('src/PhpSpreadsheet/Writer/ZipStream3.php')
6+
->name('/(\.php|^generate-document|^generate-locales|^check-phpdoc-types)$/')
67
->in(__DIR__);
78

89
$config = new PhpCsFixer\Config();
910
$config
1011
->setRiskyAllowed(true)
1112
->setFinder($finder)
13+
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect(null, 600))
1214
->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer' . preg_replace('~\W~', '-', __DIR__))
1315
->setRules([
1416
'align_multiline_comment' => true,
@@ -17,18 +19,17 @@
1719
'backtick_to_shell_exec' => true,
1820
'binary_operator_spaces' => true,
1921
'blank_line_after_namespace' => true,
22+
'blank_lines_before_namespace' => ['max_line_breaks' => 2, 'min_line_breaks' => 2], // we want 1 blank line before namespace
2023
'blank_line_after_opening_tag' => true,
2124
'blank_line_before_statement' => true,
22-
'braces' => true,
2325
'cast_spaces' => true,
2426
'class_attributes_separation' => ['elements' => ['method' => 'one', 'property' => 'one']], // const are often grouped with other related const
2527
'class_definition' => false, // phpcs disagree
26-
'class_keyword_remove' => false, // Deprecated, and ::class keyword gives us better support in IDE
2728
'combine_consecutive_issets' => true,
2829
'combine_consecutive_unsets' => true,
2930
'combine_nested_dirname' => true,
3031
'comment_to_phpdoc' => false, // interferes with annotations
31-
'compact_nullable_typehint' => true,
32+
'compact_nullable_type_declaration' => true,
3233
'concat_space' => ['spacing' => 'one'],
3334
'constant_case' => true,
3435
'date_time_immutable' => false, // Break our unit tests
@@ -45,7 +46,6 @@
4546
'encoding' => true,
4647
'ereg_to_preg' => true,
4748
'error_suppression' => false, // it breaks \PhpOffice\PhpSpreadsheet\Helper\Handler
48-
'escape_implicit_backslashes' => true,
4949
'explicit_indirect_variable' => false, // I feel it makes the code actually harder to read
5050
'explicit_string_variable' => false, // I feel it makes the code actually harder to read
5151
'final_class' => false, // We need non-final classes
@@ -57,7 +57,6 @@
5757
'fully_qualified_strict_types' => true,
5858
'function_declaration' => true,
5959
'function_to_constant' => true,
60-
'function_typehint_space' => true,
6160
'general_phpdoc_annotation_remove' => ['annotations' => ['access', 'category', 'copyright']],
6261
'general_phpdoc_tag_rename' => true,
6362
'global_namespace_import' => true,
@@ -91,15 +90,13 @@
9190
'native_constant_invocation' => false, // Micro optimization that look messy
9291
'native_function_casing' => true,
9392
'native_function_invocation' => false, // I suppose this would be best, but I am still unconvinced about the visual aspect of it
94-
'native_function_type_declaration_casing' => true,
95-
'new_with_braces' => true,
93+
'new_with_parentheses' => ['anonymous_class' => true, 'named_class' => true],
9694
'no_alias_functions' => true,
9795
'no_alias_language_construct_call' => true,
9896
'no_alternative_syntax' => true,
9997
'no_binary_string' => true,
10098
'no_blank_lines_after_class_opening' => true,
10199
'no_blank_lines_after_phpdoc' => true,
102-
'no_blank_lines_before_namespace' => false, // we want 1 blank line before namespace
103100
'no_break_comment' => true,
104101
'no_closing_tag' => true,
105102
'no_empty_comment' => true,
@@ -119,16 +116,14 @@
119116
'no_space_around_double_colon' => true,
120117
'no_spaces_after_function_name' => true,
121118
'no_spaces_around_offset' => true,
122-
'no_spaces_inside_parenthesis' => true,
123119
'no_superfluous_elseif' => false, // Might be risky on a huge code base
124120
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
125-
'no_trailing_comma_in_list_call' => true,
126-
'no_trailing_comma_in_singleline_array' => true,
121+
'no_trailing_comma_in_singleline' => ['elements' => ['arguments', 'array_destructuring', 'array', 'group_import']],
127122
'no_trailing_whitespace' => true,
128123
'no_trailing_whitespace_in_comment' => true,
129124
'no_trailing_whitespace_in_string' => false, // Too dangerous
130125
'no_unneeded_control_parentheses' => true,
131-
'no_unneeded_curly_braces' => true,
126+
'no_unneeded_braces' => true,
132127
'no_unneeded_final_method' => true,
133128
'no_unreachable_default_argument_value' => true,
134129
'no_unset_cast' => true,
@@ -173,7 +168,6 @@
173168
'phpdoc_align' => false, // Waste of time
174169
'phpdoc_annotation_without_dot' => true,
175170
'phpdoc_indent' => true,
176-
//'phpdoc_inline_tag' => true,
177171
'phpdoc_line_span' => false, // Unfortunately our old comments turn even uglier with this
178172
'phpdoc_no_access' => true,
179173
'phpdoc_no_alias_tag' => true,
@@ -213,20 +207,20 @@
213207
'simplified_if_return' => false, // Even if technically correct we prefer to be explicit
214208
'simplified_null_return' => false, // Even if technically correct we prefer to be explicit
215209
'single_blank_line_at_eof' => true,
216-
'single_blank_line_before_namespace' => true,
217210
'single_class_element_per_statement' => true,
218211
'single_import_per_statement' => true,
219212
'single_line_after_imports' => true,
220213
'single_line_comment_style' => true,
221214
'single_line_throw' => false, // I don't see any reason for having a special case for Exception
222215
'single_quote' => true,
223-
'single_space_after_construct' => true,
224216
'single_trait_insert_per_statement' => true,
225217
'space_after_semicolon' => true,
218+
'spaces_inside_parentheses' => ['space' => 'none'],
226219
'standardize_increment' => true,
227220
'standardize_not_equals' => true,
228221
'static_lambda' => false, // Risky if we can't guarantee nobody use `bindTo()`
229222
'strict_comparison' => false, // No, too dangerous to change that
223+
'string_implicit_backslashes' => false, // was escape_implicit_backslashes, too confusing
230224
'strict_param' => false, // No, too dangerous to change that
231225
'string_length_to_empty' => true,
232226
'string_line_ending' => true,
@@ -238,6 +232,7 @@
238232
'ternary_to_null_coalescing' => true,
239233
'trailing_comma_in_multiline' => true,
240234
'trim_array_spaces' => true,
235+
'type_declaration_spaces' => ['elements' => ['function', 'property']], // was function_typehint_space
241236
'types_spaces' => true,
242237
'unary_operator_spaces' => true,
243238
'use_arrow_functions' => true,

.phpcs.xml.dist

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
<file>samples</file>
66
<file>src</file>
77
<file>tests</file>
8+
<file>infra</file>
9+
<file>bin/generate-document</file>
10+
<file>bin/generate-locales</file>
11+
<file>bin/check-phpdoc-types</file>
812

913
<exclude-pattern>samples/Header.php</exclude-pattern>
1014
<exclude-pattern>*/tests/Core/*/*Test\.(inc|css|js)$</exclude-pattern>

.readthedocs.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Read the Docs configuration file for MkDocs projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html
3+
4+
version: 2
5+
6+
build:
7+
os: ubuntu-22.04
8+
tools:
9+
python: "3"
10+
11+
mkdocs:
12+
configuration: mkdocs.yml

0 commit comments

Comments
 (0)