Skip to content

Commit f9b9862

Browse files
anzinxmav
authored andcommitted
Fixed order address validator
1 parent 0eb44ce commit f9b9862

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

app/code/Magento/Sales/Model/Order/Address/Validator.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Directory\Model\CountryFactory;
1111
use Magento\Eav\Model\Config as EavConfig;
1212
use Magento\Framework\App\ObjectManager;
13+
use Magento\Framework\Exception\LocalizedException;
1314
use Magento\Sales\Model\Order\Address;
1415

1516
/**
@@ -66,7 +67,7 @@ public function __construct(
6667
/**
6768
* Validate address.
6869
*
69-
* @param \Magento\Sales\Model\Order\Address $address
70+
* @param Address $address
7071
* @return array
7172
*/
7273
public function validate(Address $address)
@@ -93,7 +94,7 @@ public function validate(Address $address)
9394
if (!filter_var($address->getEmail(), FILTER_VALIDATE_EMAIL)) {
9495
$warnings[] = 'Email has a wrong format';
9596
}
96-
if (!filter_var(in_array($address->getAddressType(), [Address::TYPE_BILLING, Address::TYPE_SHIPPING]))) {
97+
if (!in_array($address->getAddressType(), [Address::TYPE_BILLING, Address::TYPE_SHIPPING])) {
9798
$warnings[] = 'Address type doesn\'t match required options';
9899
}
99100
return $warnings;
@@ -200,7 +201,7 @@ protected function isStateRequired($countryId)
200201
* Check whether telephone is required for address.
201202
*
202203
* @return bool
203-
* @throws \Magento\Framework\Exception\LocalizedException
204+
* @throws LocalizedException
204205
*/
205206
protected function isTelephoneRequired()
206207
{
@@ -211,7 +212,7 @@ protected function isTelephoneRequired()
211212
* Check whether company is required for address.
212213
*
213214
* @return bool
214-
* @throws \Magento\Framework\Exception\LocalizedException
215+
* @throws LocalizedException
215216
*/
216217
protected function isCompanyRequired()
217218
{
@@ -222,7 +223,7 @@ protected function isCompanyRequired()
222223
* Check whether telephone is required for address.
223224
*
224225
* @return bool
225-
* @throws \Magento\Framework\Exception\LocalizedException
226+
* @throws LocalizedException
226227
*/
227228
protected function isFaxRequired()
228229
{

0 commit comments

Comments
 (0)