Skip to content

Commit af6d19d

Browse files
author
Gabriel Galvao da Gama
committed
Merge remote-tracking branch 'magento-engcom/imported-magento-magento2-32735' into api-changes-delivery
2 parents eb56d46 + 066a483 commit af6d19d

File tree

7 files changed

+163
-94
lines changed

7 files changed

+163
-94
lines changed

app/code/Magento/Catalog/Block/Adminhtml/Product/Edit/Button/Generic.php

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Button;
79

810
use Magento\Catalog\Api\Data\ProductInterface;
@@ -12,6 +14,8 @@
1214

1315
/**
1416
* Class Generic
17+
*
18+
* @api
1519
*/
1620
class Generic implements ButtonProviderInterface
1721
{

app/code/Magento/Checkout/Controller/Cart.php

+32-19
Original file line numberDiff line numberDiff line change
@@ -3,56 +3,69 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Checkout\Controller;
79

810
use Magento\Catalog\Controller\Product\View\ViewInterface;
911
use Magento\Checkout\Model\Cart as CustomerCart;
12+
use Magento\Checkout\Model\Session;
13+
use Magento\Framework\App\Action\Context;
14+
use Magento\Framework\App\Config\ScopeConfigInterface;
15+
use Magento\Framework\Controller\Result\Redirect;
16+
use Magento\Framework\Data\Form\FormKey\Validator;
17+
use Magento\Framework\UrlInterface;
18+
use Magento\Store\Model\ScopeInterface;
19+
use Magento\Store\Model\Store;
20+
use Magento\Store\Model\StoreManagerInterface;
1021

1122
/**
1223
* Shopping cart controller
24+
*
25+
* @api
1326
*/
1427
abstract class Cart extends \Magento\Framework\App\Action\Action implements ViewInterface
1528
{
1629
/**
17-
* @var \Magento\Framework\App\Config\ScopeConfigInterface
30+
* @var ScopeConfigInterface
1831
*/
1932
protected $_scopeConfig;
2033

2134
/**
22-
* @var \Magento\Checkout\Model\Session
35+
* @var Session
2336
*/
2437
protected $_checkoutSession;
2538

2639
/**
27-
* @var \Magento\Store\Model\StoreManagerInterface
40+
* @var StoreManagerInterface
2841
*/
2942
protected $_storeManager;
3043

3144
/**
32-
* @var \Magento\Framework\Data\Form\FormKey\Validator
45+
* @var Validator
3346
*/
3447
protected $_formKeyValidator;
3548

3649
/**
37-
* @var \Magento\Checkout\Model\Cart
50+
* @var CustomerCart
3851
*/
3952
protected $cart;
4053

4154
/**
42-
* @param \Magento\Framework\App\Action\Context $context
43-
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
44-
* @param \Magento\Checkout\Model\Session $checkoutSession
45-
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
46-
* @param \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator
55+
* @param Context $context
56+
* @param ScopeConfigInterface $scopeConfig
57+
* @param Session $checkoutSession
58+
* @param StoreManagerInterface $storeManager
59+
* @param Validator $formKeyValidator
4760
* @param CustomerCart $cart
4861
* @codeCoverageIgnore
4962
*/
5063
public function __construct(
51-
\Magento\Framework\App\Action\Context $context,
52-
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
53-
\Magento\Checkout\Model\Session $checkoutSession,
54-
\Magento\Store\Model\StoreManagerInterface $storeManager,
55-
\Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator,
64+
Context $context,
65+
ScopeConfigInterface $scopeConfig,
66+
Session $checkoutSession,
67+
StoreManagerInterface $storeManager,
68+
Validator $formKeyValidator,
5669
CustomerCart $cart
5770
) {
5871
$this->_formKeyValidator = $formKeyValidator;
@@ -68,7 +81,7 @@ public function __construct(
6881
*
6982
* @param null|string $backUrl
7083
*
71-
* @return \Magento\Framework\Controller\Result\Redirect
84+
* @return Redirect
7285
*/
7386
protected function _goBack($backUrl = null)
7487
{
@@ -96,10 +109,10 @@ protected function _isInternalUrl($url)
96109
/**
97110
* Url must start from base secure or base unsecure url
98111
*/
99-
/** @var $store \Magento\Store\Model\Store */
112+
/** @var $store Store */
100113
$store = $this->_storeManager->getStore();
101114
$unsecure = strpos($url, (string) $store->getBaseUrl()) === 0;
102-
$secure = strpos($url, (string) $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, true)) === 0;
115+
$secure = strpos($url, (string) $store->getBaseUrl(UrlInterface::URL_TYPE_LINK, true)) === 0;
103116
return $unsecure || $secure;
104117
}
105118

@@ -136,7 +149,7 @@ private function shouldRedirectToCart()
136149
{
137150
return $this->_scopeConfig->isSetFlag(
138151
'checkout/cart/redirect_to_cart',
139-
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
152+
ScopeInterface::SCOPE_STORE
140153
);
141154
}
142155
}

app/code/Magento/Customer/Setup/CustomerSetup.php

+48-26
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,43 @@
11
<?php
22
/**
3-
* Customer resource setup model
4-
*
53
* Copyright © Magento, Inc. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
6+
declare(strict_types=1);
7+
88
namespace Magento\Customer\Setup;
99

10+
use Magento\Customer\Api\AddressMetadataInterface;
11+
use Magento\Customer\Api\CustomerMetadataInterface;
12+
use Magento\Customer\Model\Attribute;
13+
use Magento\Customer\Model\Attribute\Backend\Data\Boolean;
14+
use Magento\Customer\Model\Attribute\Data\Postcode;
15+
use Magento\Customer\Model\Customer\Attribute\Backend\Billing;
16+
use Magento\Customer\Model\Customer\Attribute\Backend\Password;
17+
use Magento\Customer\Model\Customer\Attribute\Backend\Shipping;
18+
use Magento\Customer\Model\Customer\Attribute\Backend\Store;
19+
use Magento\Customer\Model\Customer\Attribute\Backend\Website;
20+
use Magento\Customer\Model\Customer\Attribute\Source\Group;
21+
use Magento\Customer\Model\ResourceModel\Address;
22+
use Magento\Customer\Model\ResourceModel\Address\Attribute\Backend\Region;
23+
use Magento\Customer\Model\ResourceModel\Address\Attribute\Collection;
24+
use Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Country;
25+
use Magento\Customer\Model\ResourceModel\Customer;
1026
use Magento\Eav\Model\Config;
27+
use Magento\Eav\Model\Entity\Attribute\Backend\Datetime;
28+
use Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend;
29+
use Magento\Eav\Model\Entity\Attribute\Source\Table;
30+
use Magento\Eav\Model\Entity\Increment\NumericValue;
1131
use Magento\Eav\Model\Entity\Setup\Context;
32+
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory;
1233
use Magento\Eav\Setup\EavSetup;
1334
use Magento\Framework\App\CacheInterface;
1435
use Magento\Framework\Setup\ModuleDataSetupInterface;
15-
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory;
1636

1737
/**
38+
* Customer resource setup model
39+
*
40+
* @api
1841
* @codeCoverageIgnore
1942
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2043
*/
@@ -127,11 +150,11 @@ public function getDefaultEntities()
127150
{
128151
$entities = [
129152
'customer' => [
130-
'entity_type_id' => \Magento\Customer\Api\CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
131-
'entity_model' => \Magento\Customer\Model\ResourceModel\Customer::class,
132-
'attribute_model' => \Magento\Customer\Model\Attribute::class,
153+
'entity_type_id' => CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
154+
'entity_model' => Customer::class,
155+
'attribute_model' => Attribute::class,
133156
'table' => 'customer_entity',
134-
'increment_model' => \Magento\Eav\Model\Entity\Increment\NumericValue::class,
157+
'increment_model' => NumericValue::class,
135158
'additional_attribute_table' => 'customer_eav_attribute',
136159
'entity_attribute_collection' => \Magento\Customer\Model\ResourceModel\Attribute\Collection::class,
137160
'attributes' => [
@@ -140,7 +163,7 @@ public function getDefaultEntities()
140163
'label' => 'Associate to Website',
141164
'input' => 'select',
142165
'source' => \Magento\Customer\Model\Customer\Attribute\Source\Website::class,
143-
'backend' => \Magento\Customer\Model\Customer\Attribute\Backend\Website::class,
166+
'backend' => Website::class,
144167
'sort_order' => 10,
145168
'position' => 10,
146169
'adminhtml_only' => 1,
@@ -150,7 +173,7 @@ public function getDefaultEntities()
150173
'label' => 'Create In',
151174
'input' => 'select',
152175
'source' => \Magento\Customer\Model\Customer\Attribute\Source\Store::class,
153-
'backend' => \Magento\Customer\Model\Customer\Attribute\Backend\Store::class,
176+
'backend' => Store::class,
154177
'sort_order' => 20,
155178
'visible' => false,
156179
'adminhtml_only' => 1,
@@ -223,7 +246,7 @@ public function getDefaultEntities()
223246
'type' => 'static',
224247
'label' => 'Group',
225248
'input' => 'select',
226-
'source' => \Magento\Customer\Model\Customer\Attribute\Source\Group::class,
249+
'source' => Group::class,
227250
'sort_order' => 25,
228251
'position' => 25,
229252
'adminhtml_only' => 1,
@@ -234,7 +257,7 @@ public function getDefaultEntities()
234257
'label' => 'Date of Birth',
235258
'input' => 'date',
236259
'frontend' => \Magento\Eav\Model\Entity\Attribute\Frontend\Datetime::class,
237-
'backend' => \Magento\Eav\Model\Entity\Attribute\Backend\Datetime::class,
260+
'backend' => Datetime::class,
238261
'required' => false,
239262
'sort_order' => 90,
240263
'visible' => false,
@@ -247,7 +270,7 @@ public function getDefaultEntities()
247270
'password_hash' => [
248271
'type' => 'static',
249272
'input' => 'hidden',
250-
'backend' => \Magento\Customer\Model\Customer\Attribute\Backend\Password::class,
273+
'backend' => Password::class,
251274
'required' => false,
252275
'sort_order' => 81,
253276
'visible' => false,
@@ -271,7 +294,7 @@ public function getDefaultEntities()
271294
'type' => 'static',
272295
'label' => 'Default Billing Address',
273296
'input' => 'text',
274-
'backend' => \Magento\Customer\Model\Customer\Attribute\Backend\Billing::class,
297+
'backend' => Billing::class,
275298
'required' => false,
276299
'sort_order' => 82,
277300
'visible' => false,
@@ -280,7 +303,7 @@ public function getDefaultEntities()
280303
'type' => 'static',
281304
'label' => 'Default Shipping Address',
282305
'input' => 'text',
283-
'backend' => \Magento\Customer\Model\Customer\Attribute\Backend\Shipping::class,
306+
'backend' => Shipping::class,
284307
'required' => false,
285308
'sort_order' => 83,
286309
'visible' => false,
@@ -318,7 +341,7 @@ public function getDefaultEntities()
318341
'type' => 'static',
319342
'label' => 'Gender',
320343
'input' => 'select',
321-
'source' => \Magento\Eav\Model\Entity\Attribute\Source\Table::class,
344+
'source' => Table::class,
322345
'required' => false,
323346
'sort_order' => 110,
324347
'visible' => false,
@@ -332,21 +355,20 @@ public function getDefaultEntities()
332355
'type' => 'static',
333356
'label' => 'Disable Automatic Group Change Based on VAT ID',
334357
'input' => 'boolean',
335-
'backend' => \Magento\Customer\Model\Attribute\Backend\Data\Boolean::class,
358+
'backend' => Boolean::class,
336359
'position' => 28,
337360
'required' => false,
338361
'adminhtml_only' => true
339362
]
340363
],
341364
],
342365
'customer_address' => [
343-
'entity_type_id' => \Magento\Customer\Api\AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS,
344-
'entity_model' => \Magento\Customer\Model\ResourceModel\Address::class,
345-
'attribute_model' => \Magento\Customer\Model\Attribute::class,
366+
'entity_type_id' => AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS,
367+
'entity_model' => Address::class,
368+
'attribute_model' => Attribute::class,
346369
'table' => 'customer_address_entity',
347370
'additional_attribute_table' => 'customer_eav_attribute',
348-
'entity_attribute_collection' =>
349-
\Magento\Customer\Model\ResourceModel\Address\Attribute\Collection::class,
371+
'entity_attribute_collection' => Collection::class,
350372
'attributes' => [
351373
'prefix' => [
352374
'type' => 'static',
@@ -407,7 +429,7 @@ public function getDefaultEntities()
407429
'type' => 'static',
408430
'label' => 'Street Address',
409431
'input' => 'multiline',
410-
'backend' => \Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend::class,
432+
'backend' => DefaultBackend::class,
411433
'sort_order' => 70,
412434
'multiline_count' => 2,
413435
'validate_rules' => '{"max_text_length":255,"min_text_length":1}',
@@ -425,15 +447,15 @@ public function getDefaultEntities()
425447
'type' => 'static',
426448
'label' => 'Country',
427449
'input' => 'select',
428-
'source' => \Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Country::class,
450+
'source' => Country::class,
429451
'sort_order' => 90,
430452
'position' => 90,
431453
],
432454
'region' => [
433455
'type' => 'static',
434456
'label' => 'State/Province',
435457
'input' => 'text',
436-
'backend' => \Magento\Customer\Model\ResourceModel\Address\Attribute\Backend\Region::class,
458+
'backend' => Region::class,
437459
'required' => false,
438460
'sort_order' => 100,
439461
'position' => 100,
@@ -442,7 +464,7 @@ public function getDefaultEntities()
442464
'type' => 'static',
443465
'label' => 'State/Province',
444466
'input' => 'hidden',
445-
'source' => \Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Region::class,
467+
'source' => Address\Attribute\Source\Region::class,
446468
'required' => false,
447469
'sort_order' => 100,
448470
'position' => 100,
@@ -453,7 +475,7 @@ public function getDefaultEntities()
453475
'input' => 'text',
454476
'sort_order' => 110,
455477
'validate_rules' => '[]',
456-
'data' => \Magento\Customer\Model\Attribute\Data\Postcode::class,
478+
'data' => Postcode::class,
457479
'position' => 110,
458480
'required' => false,
459481
],

app/code/Magento/Quote/Model/Quote/Item/CartItemOptionsProcessor.php

+12-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,18 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Quote\Model\Quote\Item;
79

10+
use Magento\Framework\DataObject;
811
use Magento\Quote\Api\Data\CartItemInterface;
912

13+
/**
14+
* Cart item options processor
15+
*
16+
* @api
17+
*/
1018
class CartItemOptionsProcessor
1119
{
1220
/**
@@ -25,7 +33,7 @@ public function __construct(CartItemProcessorsPool $cartItemProcessorsPool)
2533
/**
2634
* @param string $productType
2735
* @param CartItemInterface $cartItem
28-
* @return \Magento\Framework\DataObject|float
36+
* @return DataObject|float
2937
*/
3038
public function getBuyRequest($productType, CartItemInterface $cartItem)
3139
{
@@ -41,8 +49,8 @@ public function getBuyRequest($productType, CartItemInterface $cartItem)
4149
* Add custom options to buy request.
4250
*
4351
* @param CartItemInterface $cartItem
44-
* @param \Magento\Framework\DataObject|float $params
45-
* @return \Magento\Framework\DataObject|float
52+
* @param DataObject|float $params
53+
* @return DataObject|float
4654
*/
4755
private function addCustomOptionsToBuyRequest(CartItemInterface $cartItem, $params)
4856
{
@@ -51,7 +59,7 @@ private function addCustomOptionsToBuyRequest(CartItemInterface $cartItem, $para
5159
if (!$buyRequestUpdate) {
5260
return $params;
5361
}
54-
if ($params instanceof \Magento\Framework\DataObject) {
62+
if ($params instanceof DataObject) {
5563
$buyRequestUpdate->addData($params->getData());
5664
} elseif (is_numeric($params)) {
5765
$buyRequestUpdate->setData('qty', $params);

0 commit comments

Comments
 (0)