From b9342a07cc6c195e538df519019e76e24df2de83 Mon Sep 17 00:00:00 2001 From: Dmitrii Fediuk Date: Thu, 3 Aug 2023 18:19:07 +0300 Subject: [PATCH] 0.4.2: https://github.com/mage2pro/core/issues/311 --- Controller/Index/Index.php | 9 +++++---- Observer.php | 6 +++--- Plugin/Customer/Api/AccountManagementInterface.php | 7 ++++--- Test/CaseT/API/Account/Decisions.php | 5 ++--- Test/CaseT/API/Event.php | 4 ++-- composer.json | 10 +++++----- 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/Controller/Index/Index.php b/Controller/Index/Index.php index d723abe..87e8928 100644 --- a/Controller/Index/Index.php +++ b/Controller/Index/Index.php @@ -34,12 +34,13 @@ function execute():Text { # so I use a response convenient for debugging. $r = Text::i('OK'); } - catch (\Exception $e) { + # 2023-08-03 "Treat `\Throwable` similar to `\Exception`": https://github.com/mage2pro/core/issues/311 + catch (\Throwable $t) { df_500(); - $r = Text::i(df_xts($e)); - df_log($e); + $r = Text::i(df_xts($t)); + df_log($t); if (df_my_local()) { - throw $e; # 2020-03-27 It is convenient for me to see the exception on the screen. + throw $t; # 2020-03-27 It is convenient for me to see the exception on the screen. } } return $r; diff --git a/Observer.php b/Observer.php index a324a5f..b027c65 100644 --- a/Observer.php +++ b/Observer.php @@ -1,8 +1,7 @@ enable() or $f();} - catch (E $e) {df_log($e);} + # 2023-08-03 "Treat `\Throwable` similar to `\Exception`": https://github.com/mage2pro/core/issues/311 + catch (\Throwable $t) {df_log($t);} } } \ No newline at end of file diff --git a/Plugin/Customer/Api/AccountManagementInterface.php b/Plugin/Customer/Api/AccountManagementInterface.php index c9a0e3c..5aee77b 100644 --- a/Plugin/Customer/Api/AccountManagementInterface.php +++ b/Plugin/Customer/Api/AccountManagementInterface.php @@ -14,7 +14,8 @@ final class AccountManagementInterface { */ function aroundAuthenticate(Sb $sb, \Closure $f, string $u, string $p):string { try {return $f($u, $p);} - catch (\Exception $e) {_P::f(function() use($e, $u):void { + # 2023-08-03 "Treat `\Throwable` similar to `\Exception`": https://github.com/mage2pro/core/issues/311 + catch (\Throwable $t) {_P::f(function() use($t, $u):void { # 2020-02-06 https://sift.com/developers/docs/curl/events-api/reserved-events/login Event::p('login', [ /** @@ -28,7 +29,7 @@ function aroundAuthenticate(Sb $sb, \Closure $f, string $u, string $p):string { * » */ 'failure_reason' => sift_prefix( - $e instanceof Locked || $e instanceof NotConfirmed ? 'account_suspended' : 'wrong_password' + $t instanceof Locked || $t instanceof NotConfirmed ? 'account_suspended' : 'wrong_password' ) # 2020-02-06 # «Use `login_status` to represent the success or failure of the login attempt» @@ -46,6 +47,6 @@ function aroundAuthenticate(Sb $sb, \Closure $f, string $u, string $p):string { ,'social_sign_on_type' => '' ,'username' => $u # 2020-02-06 String. «The username entered at the login prompt» ]); - }); throw $e;} + }); throw $t;} } } \ No newline at end of file diff --git a/Test/CaseT/API/Account/Decisions.php b/Test/CaseT/API/Account/Decisions.php index e3f6000..a1a0158 100644 --- a/Test/CaseT/API/Account/Decisions.php +++ b/Test/CaseT/API/Account/Decisions.php @@ -1,7 +1,6 @@ j(); } - catch (E $e) { - echo df_cc_n(df_xts($e), df_bt_s($e)); + catch (\Throwable $t) { + echo df_cc_n(df_xts($t), df_bt_s($t)); } } } \ No newline at end of file diff --git a/Test/CaseT/API/Event.php b/Test/CaseT/API/Event.php index f09708b..9d887f8 100644 --- a/Test/CaseT/API/Event.php +++ b/Test/CaseT/API/Event.php @@ -2,7 +2,6 @@ namespace Dfe\Sift\Test\CaseT\API; use Dfe\Sift\API\Facade\Event as F; use Dfe\Sift\Settings as S; -use Exception as E; # 2020-01-25 https://sift.com/developers/docs/curl/events-api final class Event extends \Dfe\Sift\Test\CaseT { /** 2020-01-25 @test */ @@ -60,7 +59,8 @@ function t01_add_item_to_cart():void { ]); echo $r->j(); } - catch (E $e) { + # 2023-08-03 "Treat `\Throwable` similar to `\Exception`": https://github.com/mage2pro/core/issues/311 + catch (\Throwable $t) { xdebug_break(); } } diff --git a/composer.json b/composer.json index 3f232d1..6a039e3 100644 --- a/composer.json +++ b/composer.json @@ -1,17 +1,17 @@ { - "name": "friends-of-commerce/sift-paymentprotect" - ,"version": "0.4.1" + "name": "mage2pro/sift" + ,"version": "0.4.2" ,"description": "Sift integration with Magento 2" ,"type": "magento2-module" - ,"homepage": "https://github.com/Friends-of-Commerce/Sift-PaymentProtect" + ,"homepage": "https://github.com/mage2pro/sift" ,"license": "MIT" ,"authors": [{ "name": "Dmitrii Fediuk", "email": "admin@mage2.pro", - "homepage": "https://github.com/Friends-of-Commerce/Sift-PaymentProtect", + "homepage": "https://www.upwork.com/fl/mage2pro", "role": "Developer" }] - ,"require": {"mage2pro/core": ">=6.3.7", "mage2pro/phone": ">=1.1.0"} + ,"require": {"mage2pro/core": ">=10.2.1", "mage2pro/phone": ">=1.1.0"} ,"autoload": {"files": ["registration.php"], "psr-4": {"Dfe\\Sift\\": ""}} ,"keywords": [ "eCommerce"