mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-09-15 20:46:26 +00:00
6083e393c1
See discussion #4202. Users can extend Spreadsheet, but the readers cannot return the extended class. This is solved pretty easily by adding a protected method in BaseReader which returns a new Spreadsheet. Users can then extend the Reader which they want, overriding that method to return the extended class.
17 lines
329 B
PHP
17 lines
329 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace PhpOffice\PhpSpreadsheetTests\Reader\Xlsx;
|
|
|
|
use PhpOffice\PhpSpreadsheet\Reader\Xlsx as XlsxReader;
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
|
|
class MyXlsxReader extends XlsxReader
|
|
{
|
|
protected function newSpreadsheet(): Spreadsheet
|
|
{
|
|
return new MySpreadsheet();
|
|
}
|
|
}
|