blob: 53c5c039ba82a0ba5bf74f427c8d9ca020bcbf2e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
From 05fcad5da30ff15326ad13c91bcd49cdc3cb9ec7 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 3 Jan 2020 09:48:45 +0100
Subject: [PATCH] Fix using array_key_exists() on objects is deprecated (7.4)
---
src/Barcode.php | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/Barcode.php b/src/Barcode.php
index 65e27ed7..27c2a487 100644
--- a/src/Barcode.php
+++ b/src/Barcode.php
@@ -51,13 +51,18 @@ public function __construct($options = null)
$options = [];
}
- if (! is_array($options) && ! ($options instanceof Traversable)) {
+ if (is_array($options)) {
+ if (array_key_exists('options', $options)) {
+ $options['options'] = ['options' => $options['options']];
+ }
+ } else if ($options instanceof Traversable) {
+ if (property_exists($options, 'options')) {
+ $options['options'] = ['options' => $options['options']];
+ }
+ } else {
$options = ['adapter' => $options];
}
- if (array_key_exists('options', $options)) {
- $options['options'] = ['options' => $options['options']];
- }
parent::__construct($options);
}
|