Skip to content

Commit 782c8ef

Browse files
author
Yuri Kovsher
committed
Merge remote-tracking branch 'tango-ce/MAGETWO-33060' into MAGETWO-32571
Conflicts: lib/internal/Magento/Framework/Exception/AbstractAggregateException.php
2 parents 3248d45 + 14fb2d8 commit 782c8ef

File tree

22 files changed

+54
-51
lines changed

22 files changed

+54
-51
lines changed

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ protected function _prepareProduct(\Magento\Framework\Object $buyRequest, $produ
809809
}
810810
}
811811

812-
return $this->getSpecifyOptionMessage();
812+
return (string)$this->getSpecifyOptionMessage();
813813
}
814814

815815
/**
@@ -834,7 +834,7 @@ public function checkProductBuyState($product)
834834
}
835835
}
836836
if (empty($attributes)) {
837-
throw new \Magento\Framework\Model\Exception($this->getSpecifyOptionMessage());
837+
throw new \Magento\Framework\Model\Exception((string)$this->getSpecifyOptionMessage());
838838
}
839839
}
840840
return $this;
@@ -843,7 +843,7 @@ public function checkProductBuyState($product)
843843
/**
844844
* Retrieve message for specify option(s)
845845
*
846-
* @return string
846+
* @return \Magento\Framework\Phrase
847847
*/
848848
public function getSpecifyOptionMessage()
849849
{

app/code/Magento/Customer/Model/Resource/GroupRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function save(\Magento\Customer\Api\Data\GroupInterface $group)
124124
* Would like a better way to determine this error condition but
125125
* difficult to do without imposing more database calls
126126
*/
127-
if ($e->getMessage() === __('Customer Group already exists.')) {
127+
if ($e->getMessage() == (string)__('Customer Group already exists.')) {
128128
throw new InvalidTransitionException('Customer Group already exists.');
129129
}
130130
throw $e;

app/code/Magento/ImportExport/Model/Import/Entity/AbstractEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ public function getErrorMessages()
465465
$messages = [];
466466
foreach ($this->_errors as $errorCode => $errorRows) {
467467
if (isset($this->_messageTemplates[$errorCode])) {
468-
$errorCode = __($this->_messageTemplates[$errorCode]);
468+
$errorCode = (string)__($this->_messageTemplates[$errorCode]);
469469
}
470470
foreach ($errorRows as $errorRowData) {
471471
$key = $errorRowData[1] ? sprintf($errorCode, $errorRowData[1]) : $errorCode;

app/code/Magento/Payment/Block/Info/Cc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,19 @@ protected function _prepareSpecificInformation($transport = null)
9797
$transport = parent::_prepareSpecificInformation($transport);
9898
$data = [];
9999
if ($ccType = $this->getCcTypeName()) {
100-
$data[__('Credit Card Type')] = $ccType;
100+
$data[(string)__('Credit Card Type')] = $ccType;
101101
}
102102
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());
104104
}
105105
if (!$this->getIsSecureMode()) {
106106
if ($ccSsIssue = $this->getInfo()->getCcSsIssue()) {
107-
$data[__('Switch/Solo/Maestro Issue Number')] = $ccSsIssue;
107+
$data[(string)__('Switch/Solo/Maestro Issue Number')] = $ccSsIssue;
108108
}
109109
$year = $this->getInfo()->getCcSsStartYear();
110110
$month = $this->getInfo()->getCcSsStartMonth();
111111
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);
113113
}
114114
}
115115
return $transport->setData(array_merge($data, $transport->getData()));

app/code/Magento/Store/Ui/DataProvider/Options.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function getOptions(array $options = [])
5353
$storeCollection = $this->systemStore->getStoreCollection();
5454

5555
$currentOptions = [
56-
__('All Store Views') => [
56+
(string)__('All Store Views') => [
5757
'label' => __('All Store Views'),
5858
'value' => 0,
5959
],

app/functions.php

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* Create value-object \Magento\Framework\Phrase
99
*
10-
* @return string
10+
* @return \Magento\Framework\Phrase
1111
*/
1212
function __()
1313
{
@@ -18,11 +18,5 @@ function __()
1818
$argc = $argc[0];
1919
}
2020

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);
2822
}

dev/tests/integration/testsuite/Magento/Captcha/Model/ObserverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public function testBackendLoginActionWithInvalidCaptchaReturnsError()
3232
];
3333
$this->getRequest()->setPost($post);
3434
$this->dispatch('backend/admin');
35-
$this->assertContains(__('Incorrect CAPTCHA'), $this->getResponse()->getBody());
35+
$this->assertContains((string)__('Incorrect CAPTCHA'), $this->getResponse()->getBody());
3636
}
3737

3838
/**

dev/tests/integration/testsuite/Magento/Checkout/Model/Type/OnepageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@ public function testSaveBillingNewAddressErrorExistingEmail()
482482
$this->assertArrayHasKey('message', $result, 'Error message was expected to be set');
483483
$this->assertStringStartsWith(
484484
'There is already a registered customer using this email address',
485-
$result['message'],
485+
(string)$result['message'],
486486
'Validation error is invalid.'
487487
);
488488
}

dev/tests/integration/testsuite/Magento/ConfigurableProduct/Model/Product/Type/ConfigurableTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,10 @@ public function testPrepareForCart()
291291

292292
public function testGetSpecifyOptionMessage()
293293
{
294-
$this->assertEquals('Please specify the product\'s option(s).', $this->_model->getSpecifyOptionMessage());
294+
$this->assertEquals(
295+
'Please specify the product\'s option(s).',
296+
(string)$this->_model->getSpecifyOptionMessage()
297+
);
295298
}
296299

297300
/**

dev/tests/integration/testsuite/Magento/CurrencySymbol/Controller/Adminhtml/System/Currency/SaveRatesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function testSaveAction()
5252
$this->dispatch('backend/admin/system_currency/saveRates');
5353

5454
$this->assertSessionMessages(
55-
$this->contains(__('All valid rates have been saved.')),
55+
$this->contains((string)__('All valid rates have been saved.')),
5656
\Magento\Framework\Message\MessageInterface::TYPE_SUCCESS
5757
);
5858

@@ -84,7 +84,7 @@ public function testSaveWithWarningAction()
8484
$this->dispatch('backend/admin/system_currency/saveRates');
8585

8686
$this->assertSessionMessages(
87-
$this->contains(__('Please correct the input data for %1 => %2 rate', $currencyCode, $currencyTo)),
87+
$this->contains((string)__('Please correct the input data for %1 => %2 rate', $currencyCode, $currencyTo)),
8888
\Magento\Framework\Message\MessageInterface::TYPE_WARNING
8989
);
9090
}

0 commit comments

Comments
 (0)