From a825a7d115eba7417c7c7efd7fe341d0dfb44543 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Fri, 22 Jun 2018 18:10:54 +0930 Subject: [PATCH] Allow a single extender to be returned (#1469) Casting an object to an array does not have the intended effect of wrapping the object in an array. Instead we need to explicitly check if the returned value is an array or not. --- framework/core/src/Extension/Extension.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/framework/core/src/Extension/Extension.php b/framework/core/src/Extension/Extension.php index 52fb73363..21600ffda 100644 --- a/framework/core/src/Extension/Extension.php +++ b/framework/core/src/Extension/Extension.php @@ -119,7 +119,13 @@ class Extension implements Arrayable return; } - $extenders = array_flatten((array) require $bootstrapper); + $extenders = require $bootstrapper; + + if (! is_array($extenders)) { + $extenders = [$extenders]; + } + + $extenders = array_flatten($extenders); foreach ($extenders as $extender) { // If an extension has not yet switched to the new bootstrap.php