Skip to content

Commit

Permalink
allow PHP 8.3 (#4471)
Browse files Browse the repository at this point in the history
Fix use of range() and auto-width columns for Excel exports
  • Loading branch information
kevinpapst committed Dec 1, 2023
1 parent 8fd2e70 commit e0769bc
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 54 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
matrix:
php: ['8.1', '8.2']
php: ['8.1', '8.2', '8.3']

name: Integration (${{ matrix.php }})
steps:
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
TEST_WITH_BUNDLES: 1

- name: Upload code coverage
if: matrix.php == '8.1'
if: matrix.php == '8.2'
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ Do **NOT** use Version 1, it won't get any more updates!

### Requirements

- PHP 8.1 minimum
- PHP 8.1.3 minimum
- MariaDB or MySQL
- A webserver and subdomain (subdirectory is not supported)
- PHP extensions: `gd`, `intl`, `json`, `mbstring`, `pdo`, `tokenizer`, `xml`, `xsl`, `zip`

Support for PHP 8.2 and 8.3.

## Installation

- [Recommended setup](https://www.kimai.org/documentation/installation.html#recommended-setup) — with Git and Composer
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}
],
"require": {
"php": "8.1.*||8.2.*",
"php": "8.1.*||8.2.*||8.3.*",
"ext-gd": "*",
"ext-intl": "*",
"ext-json": "*",
Expand Down
88 changes: 44 additions & 44 deletions composer.lock

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

5 changes: 2 additions & 3 deletions src/Export/Base/XlsxRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,11 @@ protected function applyStyles(Spreadsheet $spreadsheet): void
// Freeze first row and date & time columns for easier navigation
$sheet->freezePane('D2');

/** @var string $column */
foreach (range('A', $highestColumn) as $column) {
foreach ($sheet->getColumnIterator() as $columnName => $column) {
// We default to a reasonable auto-width decided by the client,
// sadly ->getDefaultColumnDimension() is not supported so it needs
// to be specific about what column should be auto sized.
$col = $sheet->getColumnDimension($column);
$col = $sheet->getColumnDimension($columnName);

// If no other width is specified (which defaults to -1)
if ((int) $col->getWidth() === -1) {
Expand Down
5 changes: 2 additions & 3 deletions src/Export/Spreadsheet/Writer/XlsxWriter.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ public function save(Spreadsheet $spreadsheet, array $options = []): \SplFileInf
$sheet->freezePane($options['freeze']);
}

/** @var string $column */
foreach (range('A', $highestColumn) as $column) {
foreach ($sheet->getColumnIterator() as $columnName => $column) {
// We default to a reasonable auto-width decided by the client,
// sadly ->getDefaultColumnDimension() is not supported so it needs
// to be specific about what column should be auto sized.
$col = $sheet->getColumnDimension($column);
$col = $sheet->getColumnDimension($columnName);

// If no other width is specified (which defaults to -1)
if ((int) $col->getWidth() === -1) {
Expand Down

0 comments on commit e0769bc

Please sign in to comment.