Skip to content

Commit 06f0b4c

Browse files
authored
Merge pull request #4341 from oleibman/deldeprecate
Remove Previously Announced Deprecations
2 parents 65f7158 + 77815d2 commit 06f0b4c

File tree

11 files changed

+13
-118
lines changed

11 files changed

+13
-118
lines changed

CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,14 @@ and this project adheres to [Semantic Versioning](https://semver.org).
2222

2323
### Removed
2424

25-
- Nothing yet.
25+
- Worksheet::getStyles - no replacement. [PR #4330](https://github.com/PHPOffice/PhpSpreadsheet/pull/4330)
26+
- The following items were deprecated in release 3 and are now removed.
27+
- Drawing::setIsUrl - no replacement.
28+
- Settings::setLibXmlLoaderOptions() and Settings::getLibXmlLoaderOptions() - no replacement.
29+
- Worksheet::getHashCode - no replacement.
30+
- IReader::SKIP_EMPTY_CELLS - use its alias IGNORE_EMPTY_CELLS instead.
31+
- Worksheet::getProtectedCells - use getProtectedCellRanges instead.
32+
- Writer/Html::isMpdf property - use instanceof Mpdf instead.
2633

2734
### Changed
2835

src/PhpSpreadsheet/Reader/IReader.php

-5
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ interface IReader
1818
*/
1919
public const READ_DATA_ONLY = 2;
2020

21-
/**
22-
* @deprecated 3.4.0 use IGNORE_EMPTY_CELLS instead.
23-
*/
24-
public const SKIP_EMPTY_CELLS = self::IGNORE_EMPTY_CELLS;
25-
2621
/**
2722
* Flag used to ignore empty cells when reading.
2823
*

src/PhpSpreadsheet/ReferenceHelper.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,14 @@ protected function adjustMergeCells(Worksheet $worksheet): void
321321
*/
322322
protected function adjustProtectedCells(Worksheet $worksheet, int $numberOfColumns, int $numberOfRows): void
323323
{
324-
$aProtectedCells = $worksheet->getProtectedCells();
324+
$aProtectedCells = $worksheet->getProtectedCellRanges();
325325
($numberOfColumns > 0 || $numberOfRows > 0)
326326
? uksort($aProtectedCells, [self::class, 'cellReverseSort'])
327327
: uksort($aProtectedCells, [self::class, 'cellSort']);
328-
foreach ($aProtectedCells as $cellAddress => $value) {
328+
foreach ($aProtectedCells as $cellAddress => $protectedRange) {
329329
$newReference = $this->updateCellReference($cellAddress);
330330
if ($cellAddress !== $newReference) {
331-
$worksheet->protectCells($newReference, $value, true);
331+
$worksheet->protectCells($newReference, $protectedRange->getPassword(), true);
332332
$worksheet->unprotectCells($cellAddress);
333333
}
334334
}

src/PhpSpreadsheet/Settings.php

-35
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ class Settings
2020
*/
2121
private static ?string $chartRenderer = null;
2222

23-
/**
24-
* Default options for libxml loader.
25-
*/
26-
private static ?int $libXmlLoaderOptions = null;
27-
2823
/**
2924
* The cache implementation to be used for cell collection.
3025
*/
@@ -90,36 +85,6 @@ public static function htmlEntityFlags(): int
9085
return ENT_COMPAT;
9186
}
9287

93-
/**
94-
* Set default options for libxml loader.
95-
*
96-
* @param ?int $options Default options for libxml loader
97-
*
98-
* @deprecated 3.5.0 no longer needed
99-
*/
100-
public static function setLibXmlLoaderOptions(?int $options): int
101-
{
102-
if ($options === null) {
103-
$options = defined('LIBXML_DTDLOAD') ? (LIBXML_DTDLOAD | LIBXML_DTDATTR) : 0;
104-
}
105-
self::$libXmlLoaderOptions = $options;
106-
107-
return $options;
108-
}
109-
110-
/**
111-
* Get default options for libxml loader.
112-
* Defaults to LIBXML_DTDLOAD | LIBXML_DTDATTR when not set explicitly.
113-
*
114-
* @return int Default options for libxml loader
115-
*
116-
* @deprecated 3.5.0 no longer needed
117-
*/
118-
public static function getLibXmlLoaderOptions(): int
119-
{
120-
return self::$libXmlLoaderOptions ?? (defined('LIBXML_DTDLOAD') ? (LIBXML_DTDLOAD | LIBXML_DTDATTR) : 0);
121-
}
122-
12388
/**
12489
* Sets the implementation of cache that should be used for cell collection.
12590
*/

src/PhpSpreadsheet/Worksheet/Drawing.php

-14
Original file line numberDiff line numberDiff line change
@@ -192,20 +192,6 @@ public function getIsURL(): bool
192192
return $this->isUrl;
193193
}
194194

195-
/**
196-
* Set isURL.
197-
*
198-
* @return $this
199-
*
200-
* @deprecated 3.7.0 not needed, property is set by setPath
201-
*/
202-
public function setIsURL(bool $isUrl): self
203-
{
204-
$this->isUrl = $isUrl;
205-
206-
return $this;
207-
}
208-
209195
/**
210196
* Get hash code.
211197
*

src/PhpSpreadsheet/Worksheet/Worksheet.php

-26
Original file line numberDiff line numberDiff line change
@@ -1940,24 +1940,6 @@ public function unprotectCells(AddressRange|CellAddress|int|string|array $range)
19401940
return $this;
19411941
}
19421942

1943-
/**
1944-
* Get password for protected cells.
1945-
*
1946-
* @return string[]
1947-
*
1948-
* @deprecated 2.0.1 use getProtectedCellRanges instead
1949-
* @see Worksheet::getProtectedCellRanges()
1950-
*/
1951-
public function getProtectedCells(): array
1952-
{
1953-
$array = [];
1954-
foreach ($this->protectedCells as $key => $protectedRange) {
1955-
$array[$key] = $protectedRange->getPassword();
1956-
}
1957-
1958-
return $array;
1959-
}
1960-
19611943
/**
19621944
* Get protected cells.
19631945
*
@@ -3181,14 +3163,6 @@ public function garbageCollect(): static
31813163
return $this;
31823164
}
31833165

3184-
/**
3185-
* @deprecated 3.5.0 use getHashInt instead.
3186-
*/
3187-
public function getHashCode(): string
3188-
{
3189-
return (string) $this->hash;
3190-
}
3191-
31923166
public function getHashInt(): int
31933167
{
31943168
return $this->hash;

src/PhpSpreadsheet/Writer/Html.php

-7
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,6 @@ class Html extends BaseWriter
118118
*/
119119
protected bool $isPdf = false;
120120

121-
/**
122-
* Is the current writer creating mPDF?
123-
*
124-
* @deprecated 2.0.1 use instanceof Mpdf instead
125-
*/
126-
protected bool $isMPdf = false;
127-
128121
/**
129122
* Generate the Navigation block.
130123
*/

src/PhpSpreadsheet/Writer/Pdf/Mpdf.php

-7
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,6 @@ class Mpdf extends Pdf
1010
public const SIMULATED_BODY_START = '<!-- simulated body start -->';
1111
private const BODY_TAG = '<body>';
1212

13-
/**
14-
* Is the current writer creating mPDF?
15-
*
16-
* @deprecated 2.0.1 use instanceof Mpdf instead
17-
*/
18-
protected bool $isMPdf = true;
19-
2013
/**
2114
* Gets the implementation of external PDF library that should be used.
2215
*

tests/PhpSpreadsheetTests/SettingsTest.php

-15
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,6 @@ protected function tearDown(): void
1515
Settings::setCache(null);
1616
}
1717

18-
public function testGetXMLSettings(): void
19-
{
20-
$result = Settings::getLibXmlLoaderOptions();
21-
self::assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR) & $result));
22-
}
23-
24-
public function testSetXMLSettings(): void
25-
{
26-
$original = Settings::getLibXmlLoaderOptions();
27-
Settings::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID);
28-
$result = Settings::getLibXmlLoaderOptions();
29-
self::assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID) & $result));
30-
Settings::setLibXmlLoaderOptions($original);
31-
}
32-
3318
public function testInvalidChartRenderer(): void
3419
{
3520
$this->expectException(SpException::class);

tests/PhpSpreadsheetTests/Worksheet/ByColumnAndRowTest.php

-2
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,6 @@ public function testProtectCellsByColumnAndRow(): void
133133
$sheet->fromArray($data, null, 'B2', true);
134134

135135
$sheet->protectCells([2, 2, 3, 3], 'secret', false);
136-
$protectedRanges = $sheet->/** @scrutinizer ignore-deprecated*/ getProtectedCells();
137-
self::assertArrayHasKey('B2:C3', $protectedRanges);
138136
$protectedRanges2 = $sheet->getProtectedCellRanges();
139137
self::assertArrayHasKey('B2:C3', $protectedRanges2);
140138
$spreadsheet->disconnectWorksheets();

tests/PhpSpreadsheetTests/Writer/Xlsx/UnparsedDataTest.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace PhpOffice\PhpSpreadsheetTests\Writer\Xlsx;
66

77
use Exception;
8-
use PhpOffice\PhpSpreadsheet\Settings;
98
use PhpOffice\PhpSpreadsheet\Shared\File;
109
use PHPUnit\Framework\TestCase;
1110
use ZipArchive;
@@ -66,7 +65,7 @@ public function testLoadSaveXlsxWithUnparsedData(): void
6665
self::assertNotEmpty($resultVbaProjectRaw, 'vbaProject.bin not found!');
6766

6867
// xl/workbook.xml
69-
$xmlWorkbook = simplexml_load_string($resultWorkbookRaw ?: '', 'SimpleXMLElement', Settings::getLibXmlLoaderOptions());
68+
$xmlWorkbook = simplexml_load_string($resultWorkbookRaw ?: '', 'SimpleXMLElement');
7069
self::assertNotFalse($xmlWorkbook);
7170
if (!$xmlWorkbook->workbookProtection) {
7271
self::fail('workbook.xml/workbookProtection not found!');
@@ -88,7 +87,7 @@ public function testLoadSaveXlsxWithUnparsedData(): void
8887

8988
// xl/worksheets/sheet1.xml
9089
self::assertStringContainsString('<mc:AlternateContent', $resultSheet1Raw, 'AlternateContent at sheet1.xml not found!');
91-
$xmlWorksheet = simplexml_load_string($resultSheet1Raw ?: '', 'SimpleXMLElement', Settings::getLibXmlLoaderOptions());
90+
$xmlWorksheet = simplexml_load_string($resultSheet1Raw ?: '', 'SimpleXMLElement');
9291
self::assertNotFalse($xmlWorksheet);
9392
$pageSetupAttributes = $xmlWorksheet->pageSetup->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships');
9493
self::assertTrue(isset($pageSetupAttributes->id), 'sheet1.xml/pageSetup[r:id] not found!');

0 commit comments

Comments
 (0)