File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 22
33All notable changes to this project will be documented in this file.
44
5+ ## WIP
6+
7+ * Fix PHP notice triggered when an observer is disabled
8+
59## [ 4.0.2] - 2019-02-06
610[ 4.0.2 ] : https://github.com/Smile-SA/magento2-module-debug-toolbar/compare/4.0.1...4.0.2
711
Original file line number Diff line number Diff line change 77 */
88namespace Smile \DebugToolbar \Plugin \Event ;
99
10+ use Closure ;
1011use Magento \Framework \Event \InvokerInterface as MagentoInvoker ;
1112use Magento \Framework \Event \Observer as MagentoObserver ;
1213use Smile \DebugToolbar \Helper \Observer as HelperObserver ;
@@ -37,18 +38,22 @@ public function __construct(HelperObserver $helperObserver)
3738 * Plugin on dispatch.
3839 *
3940 * @param MagentoInvoker $subject
40- * @param \ Closure $closure
41+ * @param Closure $closure
4142 * @param array $configuration
4243 * @param MagentoObserver $observer
4344 * @return mixed
4445 * @SuppressWarnings(PHPMD.UnusedFormalParameter)
4546 */
4647 public function aroundDispatch (
4748 MagentoInvoker $ subject ,
48- \ Closure $ closure ,
49+ Closure $ closure ,
4950 array $ configuration ,
5051 MagentoObserver $ observer
5152 ) {
53+ if (array_key_exists ('disabled ' , $ configuration ) && $ configuration ['disabled ' ] === true ) {
54+ return $ closure ($ configuration , $ observer );
55+ }
56+
5257 $ eventName = $ observer ->getEvent ()->getName ();
5358 $ observerInstance = $ configuration ['instance ' ];
5459 $ observerName = array_key_exists ('name ' , $ configuration ) ? $ configuration ['name ' ] : $ observerInstance ;
You can’t perform that action at this time.
0 commit comments