You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pimple/pimple/src/Pimple/Container.php
+9-9Lines changed: 9 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -38,12 +38,12 @@
38
38
*/
39
39
class Container implements \ArrayAccess
40
40
{
41
-
private$values = array();
41
+
private$values = [];
42
42
private$factories;
43
43
private$protected;
44
-
private$frozen = array();
45
-
private$raw = array();
46
-
private$keys = array();
44
+
private$frozen = [];
45
+
private$raw = [];
46
+
private$keys = [];
47
47
48
48
/**
49
49
* Instantiates the container.
@@ -52,7 +52,7 @@ class Container implements \ArrayAccess
52
52
*
53
53
* @param array $values The parameters or objects
54
54
*/
55
-
publicfunction__construct(array$values = array())
55
+
publicfunction__construct(array$values = [])
56
56
{
57
57
$this->factories = new \SplObjectStorage();
58
58
$this->protected = new \SplObjectStorage();
@@ -162,7 +162,7 @@ public function offsetUnset($id)
162
162
*/
163
163
publicfunctionfactory($callable)
164
164
{
165
-
if (!\method_exists($callable, '__invoke')) {
165
+
if (!\is_object($callable) || !\method_exists($callable, '__invoke')) {
166
166
thrownewExpectedInvokableException('Service definition is not a Closure or invokable object.');
167
167
}
168
168
@@ -184,7 +184,7 @@ public function factory($callable)
184
184
*/
185
185
publicfunctionprotect($callable)
186
186
{
187
-
if (!\method_exists($callable, '__invoke')) {
187
+
if (!\is_object($callable) || !\method_exists($callable, '__invoke')) {
188
188
thrownewExpectedInvokableException('Callable is not a Closure or invokable object.');
189
189
}
190
190
@@ -246,7 +246,7 @@ public function extend($id, $callable)
246
246
}
247
247
248
248
if (isset($this->protected[$this->values[$id]])) {
249
-
@\trigger_error(\sprintf('How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "%s" should be protected?', $id), \E_USER_DEPRECATED);
249
+
@\trigger_error(\sprintf('How Pimple behaves when extending protected closures will be fixed in Pimple 4. Are you sure "%s" should be protected?', $id), E_USER_DEPRECATED);
250
250
}
251
251
252
252
if (!\is_object($callable) || !\method_exists($callable, '__invoke')) {
0 commit comments