File tree Expand file tree Collapse file tree 4 files changed +19
-14
lines changed
lib/internal/Magento/Framework Expand file tree Collapse file tree 4 files changed +19
-14
lines changed Original file line number Diff line number Diff line change @@ -97,19 +97,19 @@ protected function _prepareSpecificInformation($transport = null)
97
97
$ transport = parent ::_prepareSpecificInformation ($ transport );
98
98
$ data = [];
99
99
if ($ ccType = $ this ->getCcTypeName ()) {
100
- $ data [__ ('Credit Card Type ' )] = $ ccType ;
100
+ $ data [( string ) __ ('Credit Card Type ' )] = $ ccType ;
101
101
}
102
102
if ($ this ->getInfo ()->getCcLast4 ()) {
103
- $ data [__ ('Credit Card Number ' )] = sprintf ('xxxx-%s ' , $ this ->getInfo ()->getCcLast4 ());
103
+ $ data [( string ) __ ('Credit Card Number ' )] = sprintf ('xxxx-%s ' , $ this ->getInfo ()->getCcLast4 ());
104
104
}
105
105
if (!$ this ->getIsSecureMode ()) {
106
106
if ($ ccSsIssue = $ this ->getInfo ()->getCcSsIssue ()) {
107
- $ data [__ ('Switch/Solo/Maestro Issue Number ' )] = $ ccSsIssue ;
107
+ $ data [( string ) __ ('Switch/Solo/Maestro Issue Number ' )] = $ ccSsIssue ;
108
108
}
109
109
$ year = $ this ->getInfo ()->getCcSsStartYear ();
110
110
$ month = $ this ->getInfo ()->getCcSsStartMonth ();
111
111
if ($ year && $ month ) {
112
- $ data [__ ('Switch/Solo/Maestro Start Date ' )] = $ this ->_formatCardDate ($ year , $ month );
112
+ $ data [( string ) __ ('Switch/Solo/Maestro Start Date ' )] = $ this ->_formatCardDate ($ year , $ month );
113
113
}
114
114
}
115
115
return $ transport ->setData (array_merge ($ data , $ transport ->getData ()));
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ public function getOptions(array $options = [])
53
53
$ storeCollection = $ this ->systemStore ->getStoreCollection ();
54
54
55
55
$ currentOptions = [
56
- __ ('All Store Views ' ) => [
56
+ ( string ) __ ('All Store Views ' ) => [
57
57
'label ' => __ ('All Store Views ' ),
58
58
'value ' => 0 ,
59
59
],
Original file line number Diff line number Diff line change 7
7
/**
8
8
* Create value-object \Magento\Framework\Phrase
9
9
*
10
- * @return string
10
+ * @return \Magento\Framework\Phrase
11
11
*/
12
12
function __ ()
13
13
{
@@ -18,11 +18,5 @@ function __()
18
18
$ argc = $ argc [0 ];
19
19
}
20
20
21
- /**
22
- * Type casting to string is a workaround.
23
- * Many places in client code at the moment are unable to handle the \Magento\Framework\Phrase object properly.
24
- * The intended behavior is to use __toString(),
25
- * so that rendering of the phrase happens only at the last moment when needed
26
- */
27
- return (string )new \Magento \Framework \Phrase ($ text , $ argc );
21
+ return new \Magento \Framework \Phrase ($ text , $ argc );
28
22
}
Original file line number Diff line number Diff line change 7
7
*/
8
8
namespace Magento \Framework ;
9
9
10
+ use Zend \Stdlib \JsonSerializable ;
10
11
use Magento \Framework \Phrase \RendererInterface ;
11
12
12
- class Phrase
13
+ class Phrase implements JsonSerializable
13
14
{
14
15
/**
15
16
* Default phrase renderer. Allows stacking renderers that "don't know about each other"
@@ -84,4 +85,14 @@ public function __toString()
84
85
{
85
86
return $ this ->render ();
86
87
}
88
+
89
+ /**
90
+ * Specify data which should be serialized to JSON
91
+ *
92
+ * @return string
93
+ */
94
+ public function jsonSerialize ()
95
+ {
96
+ return $ this ->render ();
97
+ }
87
98
}
You can’t perform that action at this time.
0 commit comments