Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[32058][To 2.4-develop] Marked classes and interfaces as API part 3 #32735

Merged
merged 1 commit into from
Apr 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
marked as api
  • Loading branch information
Usik2203 committed Apr 13, 2021
commit 066a483bdc24761be70f2f12be942b38c5f51896
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Catalog\Block\Adminhtml\Product\Edit\Button;

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

/**
* Class Generic
*
* @api
*/
class Generic implements ButtonProviderInterface
{
Expand Down
51 changes: 32 additions & 19 deletions app/code/Magento/Checkout/Controller/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,69 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Checkout\Controller;

use Magento\Catalog\Controller\Product\View\ViewInterface;
use Magento\Checkout\Model\Cart as CustomerCart;
use Magento\Checkout\Model\Session;
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\Config\ScopeConfigInterface;
use Magento\Framework\Controller\Result\Redirect;
use Magento\Framework\Data\Form\FormKey\Validator;
use Magento\Framework\UrlInterface;
use Magento\Store\Model\ScopeInterface;
use Magento\Store\Model\Store;
use Magento\Store\Model\StoreManagerInterface;

/**
* Shopping cart controller
*
* @api
*/
abstract class Cart extends \Magento\Framework\App\Action\Action implements ViewInterface
{
/**
* @var \Magento\Framework\App\Config\ScopeConfigInterface
* @var ScopeConfigInterface
*/
protected $_scopeConfig;

/**
* @var \Magento\Checkout\Model\Session
* @var Session
*/
protected $_checkoutSession;

/**
* @var \Magento\Store\Model\StoreManagerInterface
* @var StoreManagerInterface
*/
protected $_storeManager;

/**
* @var \Magento\Framework\Data\Form\FormKey\Validator
* @var Validator
*/
protected $_formKeyValidator;

/**
* @var \Magento\Checkout\Model\Cart
* @var CustomerCart
*/
protected $cart;

/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator
* @param Context $context
* @param ScopeConfigInterface $scopeConfig
* @param Session $checkoutSession
* @param StoreManagerInterface $storeManager
* @param Validator $formKeyValidator
* @param CustomerCart $cart
* @codeCoverageIgnore
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
\Magento\Checkout\Model\Session $checkoutSession,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator,
Context $context,
ScopeConfigInterface $scopeConfig,
Session $checkoutSession,
StoreManagerInterface $storeManager,
Validator $formKeyValidator,
CustomerCart $cart
) {
$this->_formKeyValidator = $formKeyValidator;
Expand All @@ -68,7 +81,7 @@ public function __construct(
*
* @param null|string $backUrl
*
* @return \Magento\Framework\Controller\Result\Redirect
* @return Redirect
*/
protected function _goBack($backUrl = null)
{
Expand Down Expand Up @@ -96,10 +109,10 @@ protected function _isInternalUrl($url)
/**
* Url must start from base secure or base unsecure url
*/
/** @var $store \Magento\Store\Model\Store */
/** @var $store Store */
$store = $this->_storeManager->getStore();
$unsecure = strpos($url, (string) $store->getBaseUrl()) === 0;
$secure = strpos($url, (string) $store->getBaseUrl(\Magento\Framework\UrlInterface::URL_TYPE_LINK, true)) === 0;
$secure = strpos($url, (string) $store->getBaseUrl(UrlInterface::URL_TYPE_LINK, true)) === 0;
return $unsecure || $secure;
}

Expand Down Expand Up @@ -136,7 +149,7 @@ private function shouldRedirectToCart()
{
return $this->_scopeConfig->isSetFlag(
'checkout/cart/redirect_to_cart',
\Magento\Store\Model\ScopeInterface::SCOPE_STORE
ScopeInterface::SCOPE_STORE
);
}
}
74 changes: 48 additions & 26 deletions app/code/Magento/Customer/Setup/CustomerSetup.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
<?php
/**
* Customer resource setup model
*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Customer\Setup;

use Magento\Customer\Api\AddressMetadataInterface;
use Magento\Customer\Api\CustomerMetadataInterface;
use Magento\Customer\Model\Attribute;
use Magento\Customer\Model\Attribute\Backend\Data\Boolean;
use Magento\Customer\Model\Attribute\Data\Postcode;
use Magento\Customer\Model\Customer\Attribute\Backend\Billing;
use Magento\Customer\Model\Customer\Attribute\Backend\Password;
use Magento\Customer\Model\Customer\Attribute\Backend\Shipping;
use Magento\Customer\Model\Customer\Attribute\Backend\Store;
use Magento\Customer\Model\Customer\Attribute\Backend\Website;
use Magento\Customer\Model\Customer\Attribute\Source\Group;
use Magento\Customer\Model\ResourceModel\Address;
use Magento\Customer\Model\ResourceModel\Address\Attribute\Backend\Region;
use Magento\Customer\Model\ResourceModel\Address\Attribute\Collection;
use Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Country;
use Magento\Customer\Model\ResourceModel\Customer;
use Magento\Eav\Model\Config;
use Magento\Eav\Model\Entity\Attribute\Backend\Datetime;
use Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend;
use Magento\Eav\Model\Entity\Attribute\Source\Table;
use Magento\Eav\Model\Entity\Increment\NumericValue;
use Magento\Eav\Model\Entity\Setup\Context;
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory;
use Magento\Eav\Setup\EavSetup;
use Magento\Framework\App\CacheInterface;
use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\CollectionFactory;

/**
* Customer resource setup model
*
* @api
* @codeCoverageIgnore
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
Expand Down Expand Up @@ -127,11 +150,11 @@ public function getDefaultEntities()
{
$entities = [
'customer' => [
'entity_type_id' => \Magento\Customer\Api\CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
'entity_model' => \Magento\Customer\Model\ResourceModel\Customer::class,
'attribute_model' => \Magento\Customer\Model\Attribute::class,
'entity_type_id' => CustomerMetadataInterface::ATTRIBUTE_SET_ID_CUSTOMER,
'entity_model' => Customer::class,
'attribute_model' => Attribute::class,
'table' => 'customer_entity',
'increment_model' => \Magento\Eav\Model\Entity\Increment\NumericValue::class,
'increment_model' => NumericValue::class,
'additional_attribute_table' => 'customer_eav_attribute',
'entity_attribute_collection' => \Magento\Customer\Model\ResourceModel\Attribute\Collection::class,
'attributes' => [
Expand All @@ -140,7 +163,7 @@ public function getDefaultEntities()
'label' => 'Associate to Website',
'input' => 'select',
'source' => \Magento\Customer\Model\Customer\Attribute\Source\Website::class,
'backend' => \Magento\Customer\Model\Customer\Attribute\Backend\Website::class,
'backend' => Website::class,
'sort_order' => 10,
'position' => 10,
'adminhtml_only' => 1,
Expand All @@ -150,7 +173,7 @@ public function getDefaultEntities()
'label' => 'Create In',
'input' => 'select',
'source' => \Magento\Customer\Model\Customer\Attribute\Source\Store::class,
'backend' => \Magento\Customer\Model\Customer\Attribute\Backend\Store::class,
'backend' => Store::class,
'sort_order' => 20,
'visible' => false,
'adminhtml_only' => 1,
Expand Down Expand Up @@ -223,7 +246,7 @@ public function getDefaultEntities()
'type' => 'static',
'label' => 'Group',
'input' => 'select',
'source' => \Magento\Customer\Model\Customer\Attribute\Source\Group::class,
'source' => Group::class,
'sort_order' => 25,
'position' => 25,
'adminhtml_only' => 1,
Expand All @@ -234,7 +257,7 @@ public function getDefaultEntities()
'label' => 'Date of Birth',
'input' => 'date',
'frontend' => \Magento\Eav\Model\Entity\Attribute\Frontend\Datetime::class,
'backend' => \Magento\Eav\Model\Entity\Attribute\Backend\Datetime::class,
'backend' => Datetime::class,
'required' => false,
'sort_order' => 90,
'visible' => false,
Expand All @@ -247,7 +270,7 @@ public function getDefaultEntities()
'password_hash' => [
'type' => 'static',
'input' => 'hidden',
'backend' => \Magento\Customer\Model\Customer\Attribute\Backend\Password::class,
'backend' => Password::class,
'required' => false,
'sort_order' => 81,
'visible' => false,
Expand All @@ -271,7 +294,7 @@ public function getDefaultEntities()
'type' => 'static',
'label' => 'Default Billing Address',
'input' => 'text',
'backend' => \Magento\Customer\Model\Customer\Attribute\Backend\Billing::class,
'backend' => Billing::class,
'required' => false,
'sort_order' => 82,
'visible' => false,
Expand All @@ -280,7 +303,7 @@ public function getDefaultEntities()
'type' => 'static',
'label' => 'Default Shipping Address',
'input' => 'text',
'backend' => \Magento\Customer\Model\Customer\Attribute\Backend\Shipping::class,
'backend' => Shipping::class,
'required' => false,
'sort_order' => 83,
'visible' => false,
Expand Down Expand Up @@ -318,7 +341,7 @@ public function getDefaultEntities()
'type' => 'static',
'label' => 'Gender',
'input' => 'select',
'source' => \Magento\Eav\Model\Entity\Attribute\Source\Table::class,
'source' => Table::class,
'required' => false,
'sort_order' => 110,
'visible' => false,
Expand All @@ -332,21 +355,20 @@ public function getDefaultEntities()
'type' => 'static',
'label' => 'Disable Automatic Group Change Based on VAT ID',
'input' => 'boolean',
'backend' => \Magento\Customer\Model\Attribute\Backend\Data\Boolean::class,
'backend' => Boolean::class,
'position' => 28,
'required' => false,
'adminhtml_only' => true
]
],
],
'customer_address' => [
'entity_type_id' => \Magento\Customer\Api\AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS,
'entity_model' => \Magento\Customer\Model\ResourceModel\Address::class,
'attribute_model' => \Magento\Customer\Model\Attribute::class,
'entity_type_id' => AddressMetadataInterface::ATTRIBUTE_SET_ID_ADDRESS,
'entity_model' => Address::class,
'attribute_model' => Attribute::class,
'table' => 'customer_address_entity',
'additional_attribute_table' => 'customer_eav_attribute',
'entity_attribute_collection' =>
\Magento\Customer\Model\ResourceModel\Address\Attribute\Collection::class,
'entity_attribute_collection' => Collection::class,
'attributes' => [
'prefix' => [
'type' => 'static',
Expand Down Expand Up @@ -407,7 +429,7 @@ public function getDefaultEntities()
'type' => 'static',
'label' => 'Street Address',
'input' => 'multiline',
'backend' => \Magento\Eav\Model\Entity\Attribute\Backend\DefaultBackend::class,
'backend' => DefaultBackend::class,
'sort_order' => 70,
'multiline_count' => 2,
'validate_rules' => '{"max_text_length":255,"min_text_length":1}',
Expand All @@ -425,15 +447,15 @@ public function getDefaultEntities()
'type' => 'static',
'label' => 'Country',
'input' => 'select',
'source' => \Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Country::class,
'source' => Country::class,
'sort_order' => 90,
'position' => 90,
],
'region' => [
'type' => 'static',
'label' => 'State/Province',
'input' => 'text',
'backend' => \Magento\Customer\Model\ResourceModel\Address\Attribute\Backend\Region::class,
'backend' => Region::class,
'required' => false,
'sort_order' => 100,
'position' => 100,
Expand All @@ -442,7 +464,7 @@ public function getDefaultEntities()
'type' => 'static',
'label' => 'State/Province',
'input' => 'hidden',
'source' => \Magento\Customer\Model\ResourceModel\Address\Attribute\Source\Region::class,
'source' => Address\Attribute\Source\Region::class,
'required' => false,
'sort_order' => 100,
'position' => 100,
Expand All @@ -453,7 +475,7 @@ public function getDefaultEntities()
'input' => 'text',
'sort_order' => 110,
'validate_rules' => '[]',
'data' => \Magento\Customer\Model\Attribute\Data\Postcode::class,
'data' => Postcode::class,
'position' => 110,
'required' => false,
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Quote\Model\Quote\Item;

use Magento\Framework\DataObject;
use Magento\Quote\Api\Data\CartItemInterface;

/**
* Cart item options processor
*
* @api
*/
class CartItemOptionsProcessor
{
/**
Expand All @@ -25,7 +33,7 @@ public function __construct(CartItemProcessorsPool $cartItemProcessorsPool)
/**
* @param string $productType
* @param CartItemInterface $cartItem
* @return \Magento\Framework\DataObject|float
* @return DataObject|float
*/
public function getBuyRequest($productType, CartItemInterface $cartItem)
{
Expand All @@ -41,8 +49,8 @@ public function getBuyRequest($productType, CartItemInterface $cartItem)
* Add custom options to buy request.
*
* @param CartItemInterface $cartItem
* @param \Magento\Framework\DataObject|float $params
* @return \Magento\Framework\DataObject|float
* @param DataObject|float $params
* @return DataObject|float
*/
private function addCustomOptionsToBuyRequest(CartItemInterface $cartItem, $params)
{
Expand All @@ -51,7 +59,7 @@ private function addCustomOptionsToBuyRequest(CartItemInterface $cartItem, $para
if (!$buyRequestUpdate) {
return $params;
}
if ($params instanceof \Magento\Framework\DataObject) {
if ($params instanceof DataObject) {
$buyRequestUpdate->addData($params->getData());
} elseif (is_numeric($params)) {
$buyRequestUpdate->setData('qty', $params);
Expand Down
Loading