Skip to content

Commit f40f3bf

Browse files
authored
Merge pull request #544 from cedric-anne/fix/php8.1
Fix deprecated usages and return types on PHP 8.1
2 parents eb3d10e + bb3bfeb commit f40f3bf

File tree

8 files changed

+20
-1
lines changed

8 files changed

+20
-1
lines changed

lib/Component.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ function ($a, $b) use ($sortScore, $tmp) {
339339
*
340340
* @return array
341341
*/
342+
#[\ReturnTypeWillChange]
342343
public function jsonSerialize()
343344
{
344345
$components = [];

lib/Component/VCard.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,7 @@ protected function getDefaults()
445445
*
446446
* @return array
447447
*/
448+
#[\ReturnTypeWillChange]
448449
public function jsonSerialize()
449450
{
450451
// A vcard does not have sub-components, so we're overriding this

lib/ElementList.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class ElementList extends ArrayIterator
2525
* @param int $offset
2626
* @param mixed $value
2727
*/
28+
#[\ReturnTypeWillChange]
2829
public function offsetSet($offset, $value)
2930
{
3031
throw new LogicException('You can not add new objects to an ElementList');
@@ -37,6 +38,7 @@ public function offsetSet($offset, $value)
3738
*
3839
* @param int $offset
3940
*/
41+
#[\ReturnTypeWillChange]
4042
public function offsetUnset($offset)
4143
{
4244
throw new LogicException('You can not remove objects from an ElementList');

lib/Node.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ abstract public function serialize();
7373
*
7474
* @return array
7575
*/
76+
#[\ReturnTypeWillChange]
7677
abstract public function jsonSerialize();
7778

7879
/**
@@ -102,6 +103,7 @@ public function destroy()
102103
*
103104
* @return ElementList
104105
*/
106+
#[\ReturnTypeWillChange]
105107
public function getIterator()
106108
{
107109
if (!is_null($this->iterator)) {
@@ -157,6 +159,7 @@ public function validate($options = 0)
157159
*
158160
* @return int
159161
*/
162+
#[\ReturnTypeWillChange]
160163
public function count()
161164
{
162165
$it = $this->getIterator();
@@ -177,6 +180,7 @@ public function count()
177180
*
178181
* @return bool
179182
*/
183+
#[\ReturnTypeWillChange]
180184
public function offsetExists($offset)
181185
{
182186
$iterator = $this->getIterator();
@@ -193,6 +197,7 @@ public function offsetExists($offset)
193197
*
194198
* @return mixed
195199
*/
200+
#[\ReturnTypeWillChange]
196201
public function offsetGet($offset)
197202
{
198203
$iterator = $this->getIterator();
@@ -208,6 +213,7 @@ public function offsetGet($offset)
208213
* @param int $offset
209214
* @param mixed $value
210215
*/
216+
#[\ReturnTypeWillChange]
211217
public function offsetSet($offset, $value)
212218
{
213219
$iterator = $this->getIterator();
@@ -228,6 +234,7 @@ public function offsetSet($offset, $value)
228234
*
229235
* @param int $offset
230236
*/
237+
#[\ReturnTypeWillChange]
231238
public function offsetUnset($offset)
232239
{
233240
$iterator = $this->getIterator();

lib/Parameter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ function ($out, $item) {
321321
*
322322
* @return array
323323
*/
324+
#[\ReturnTypeWillChange]
324325
public function jsonSerialize()
325326
{
326327
return $this->value;
@@ -354,6 +355,7 @@ public function __toString()
354355
*
355356
* @return ElementList
356357
*/
358+
#[\ReturnTypeWillChange]
357359
public function getIterator()
358360
{
359361
if (!is_null($this->iterator)) {

lib/Parser/MimeDir.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ protected function readProperty($line)
439439
$propObj->add(null, $namelessParameter);
440440
}
441441

442-
if ('QUOTED-PRINTABLE' === strtoupper($propObj['ENCODING'])) {
442+
if (isset($propObj['ENCODING']) && 'QUOTED-PRINTABLE' === strtoupper($propObj['ENCODING'])) {
443443
$propObj->setQuotedPrintableValue($this->extractQuotedPrintableValue());
444444
} else {
445445
$charset = $this->charset;

lib/Property.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ public function setJsonValue(array $value)
276276
*
277277
* @return array
278278
*/
279+
#[\ReturnTypeWillChange]
279280
public function jsonSerialize()
280281
{
281282
$parameters = [];
@@ -387,6 +388,7 @@ public function __toString()
387388
*
388389
* @return bool
389390
*/
391+
#[\ReturnTypeWillChange]
390392
public function offsetExists($name)
391393
{
392394
if (is_int($name)) {
@@ -413,6 +415,7 @@ public function offsetExists($name)
413415
*
414416
* @return Node
415417
*/
418+
#[\ReturnTypeWillChange]
416419
public function offsetGet($name)
417420
{
418421
if (is_int($name)) {
@@ -433,6 +436,7 @@ public function offsetGet($name)
433436
* @param string $name
434437
* @param mixed $value
435438
*/
439+
#[\ReturnTypeWillChange]
436440
public function offsetSet($name, $value)
437441
{
438442
if (is_int($name)) {
@@ -453,6 +457,7 @@ public function offsetSet($name, $value)
453457
*
454458
* @param string $name
455459
*/
460+
#[\ReturnTypeWillChange]
456461
public function offsetUnset($name)
457462
{
458463
if (is_int($name)) {

lib/Property/ICalendar/DateTime.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ function ($item) {
300300
* @param string $name
301301
* @param mixed $value
302302
*/
303+
#[\ReturnTypeWillChange]
303304
public function offsetSet($name, $value)
304305
{
305306
parent::offsetSet($name, $value);

0 commit comments

Comments
 (0)