Skip to content

Commit 426b2c4

Browse files
Merge branch '2.4-develop' into 2.4-develop-prs
2 parents 432da27 + e334af1 commit 426b2c4

File tree

18 files changed

+2032
-84
lines changed

18 files changed

+2032
-84
lines changed

app/code/Magento/Dhl/Block/Adminhtml/Unitofmeasure.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Dhl\Block\Adminhtml;
77

88
use Magento\Dhl\Model;
9+
use Magento\Framework\Measure\Weight;
910
use Magento\Shipping\Helper;
1011
use Magento\Backend\Block\Template\Context;
1112
use Magento\Config\Block\System\Config\Form\Field;
@@ -17,8 +18,6 @@
1718
class Unitofmeasure extends Field
1819
{
1920
/**
20-
* Carrier helper
21-
*
2221
* @var Helper\Carrier
2322
*/
2423
protected $carrierHelper;
@@ -73,8 +72,8 @@ public function _construct()
7372

7473
$convertedWeight = $this->carrierHelper->convertMeasureWeight(
7574
$kgWeight,
76-
\Zend_Measure_Weight::KILOGRAM,
77-
\Zend_Measure_Weight::POUND
75+
Weight::KILOGRAM,
76+
Weight::POUND
7877
);
7978
$weight = sprintf('%.3f', $convertedWeight);
8079

app/code/Magento/Dhl/Model/Carrier.php

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
use Magento\Framework\HTTP\AsyncClient\HttpResponseDeferredInterface;
1616
use Magento\Framework\HTTP\AsyncClient\Request;
1717
use Magento\Framework\HTTP\AsyncClientInterface;
18+
use Magento\Framework\Measure\Length;
19+
use Magento\Framework\Measure\Weight;
1820
use Magento\Framework\Module\Dir;
1921
use Magento\Framework\Xml\Security;
2022
use Magento\Quote\Model\Quote\Address\RateRequest;
@@ -604,18 +606,18 @@ public function getCode($type, $code = '')
604606
'dimensions' => ['HEIGHT' => __('Height'), 'DEPTH' => __('Depth'), 'WIDTH' => __('Width')],
605607
'size' => ['0' => __('Regular'), '1' => __('Specific')],
606608
'dimensions_variables' => [
607-
'L' => \Zend_Measure_Weight::POUND,
608-
'LB' => \Zend_Measure_Weight::POUND,
609-
'POUND' => \Zend_Measure_Weight::POUND,
610-
'K' => \Zend_Measure_Weight::KILOGRAM,
611-
'KG' => \Zend_Measure_Weight::KILOGRAM,
612-
'KILOGRAM' => \Zend_Measure_Weight::KILOGRAM,
613-
'I' => \Zend_Measure_Length::INCH,
614-
'IN' => \Zend_Measure_Length::INCH,
615-
'INCH' => \Zend_Measure_Length::INCH,
616-
'C' => \Zend_Measure_Length::CENTIMETER,
617-
'CM' => \Zend_Measure_Length::CENTIMETER,
618-
'CENTIMETER' => \Zend_Measure_Length::CENTIMETER,
609+
'L' => Weight::POUND,
610+
'LB' => Weight::POUND,
611+
'POUND' => Weight::POUND,
612+
'K' => Weight::KILOGRAM,
613+
'KG' => Weight::KILOGRAM,
614+
'KILOGRAM' => Weight::KILOGRAM,
615+
'I' => Length::INCH,
616+
'IN' => Length::INCH,
617+
'INCH' => Length::INCH,
618+
'C' => Length::CENTIMETER,
619+
'CM' => Length::CENTIMETER,
620+
'CENTIMETER' => Length::CENTIMETER,
619621
],
620622
];
621623

@@ -719,7 +721,7 @@ public function getDhlProductTitle($code)
719721
protected function _getWeight($weight, $maxWeight = false, $configWeightUnit = false)
720722
{
721723
if ($maxWeight) {
722-
$configWeightUnit = \Zend_Measure_Weight::KILOGRAM;
724+
$configWeightUnit = Weight::KILOGRAM;
723725
} elseif ($configWeightUnit) {
724726
$configWeightUnit = $this->getCode('dimensions_variables', $configWeightUnit);
725727
} else {
@@ -924,10 +926,10 @@ protected function _getDimension($dimension, $configWeightUnit = false)
924926
$configWeightUnit = $this->getCode('dimensions_variables', $configWeightUnit);
925927
}
926928

927-
if ($configWeightUnit == \Zend_Measure_Weight::POUND) {
928-
$configDimensionUnit = \Zend_Measure_Length::INCH;
929+
if ($configWeightUnit == Weight::POUND) {
930+
$configDimensionUnit = Length::INCH;
929931
} else {
930-
$configDimensionUnit = \Zend_Measure_Length::CENTIMETER;
932+
$configDimensionUnit = Length::CENTIMETER;
931933
}
932934

933935
$countryDimensionUnit = $this->getCode('dimensions_variables', $this->_getDimensionUnit());

app/code/Magento/Fedex/Model/Carrier.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
use Magento\Framework\App\ObjectManager;
1010
use Magento\Framework\DataObject;
1111
use Magento\Framework\Exception\LocalizedException;
12+
use Magento\Framework\Measure\Length;
13+
use Magento\Framework\Measure\Weight;
1214
use Magento\Framework\Module\Dir;
1315
use Magento\Framework\Serialize\Serializer\Json;
1416
use Magento\Framework\Webapi\Soap\ClientFactory;
@@ -1308,7 +1310,7 @@ protected function _formShipmentRequest(\Magento\Framework\DataObject $request)
13081310
$height = $packageParams->getHeight();
13091311
$width = $packageParams->getWidth();
13101312
$length = $packageParams->getLength();
1311-
$weightUnits = $packageParams->getWeightUnits() == \Zend_Measure_Weight::POUND ? 'LB' : 'KG';
1313+
$weightUnits = $packageParams->getWeightUnits() == Weight::POUND ? 'LB' : 'KG';
13121314
$unitPrice = 0;
13131315
$itemsQty = 0;
13141316
$itemsDesc = [];
@@ -1455,7 +1457,7 @@ protected function _formShipmentRequest(\Magento\Framework\DataObject $request)
14551457
'Length' => $length,
14561458
'Width' => $width,
14571459
'Height' => $height,
1458-
'Units' => $packageParams->getDimensionUnits() == \Zend_Measure_Length::INCH ? 'IN' : 'CM',
1460+
'Units' => $packageParams->getDimensionUnits() == Length::INCH ? 'IN' : 'CM',
14591461
];
14601462
}
14611463

app/code/Magento/Shipping/Helper/Carrier.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
*/
66
namespace Magento\Shipping\Helper;
77

8+
use Magento\Framework\Measure\Exception\MeasureException;
9+
use Magento\Framework\Measure\Length;
10+
use Magento\Framework\Measure\Weight;
11+
812
/**
913
* Carrier helper
1014
*/
@@ -13,12 +17,12 @@ class Carrier extends \Magento\Framework\App\Helper\AbstractHelper
1317
/**
1418
* Carriers root xml path
1519
*/
16-
const XML_PATH_CARRIERS_ROOT = 'carriers';
20+
public const XML_PATH_CARRIERS_ROOT = 'carriers';
1721

1822
/**
1923
* Config path to UE country list
2024
*/
21-
const XML_PATH_EU_COUNTRIES_LIST = 'general/country/eu_countries';
25+
public const XML_PATH_EU_COUNTRIES_LIST = 'general/country/eu_countries';
2226

2327
/**
2428
* Locale interface
@@ -65,7 +69,7 @@ public function getOnlineCarrierCodes($store = null)
6569
*
6670
* @param string $carrierCode
6771
* @param string $configPath
68-
* @param null $store
72+
* @param null|int|string $store
6973
* @return string
7074
*/
7175
public function getCarrierConfigValue($carrierCode, $configPath, $store = null)
@@ -83,13 +87,14 @@ public function getCarrierConfigValue($carrierCode, $configPath, $store = null)
8387
* @param int|float $value
8488
* @param string $sourceWeightMeasure
8589
* @param string $toWeightMeasure
86-
* @return int|null|string
90+
* @return float|string|null
91+
* @throws MeasureException
8792
*/
8893
public function convertMeasureWeight($value, $sourceWeightMeasure, $toWeightMeasure)
8994
{
9095
if ($value) {
9196
$locale = $this->localeResolver->getLocale();
92-
$unitWeight = new \Zend_Measure_Weight($value, $sourceWeightMeasure, $locale);
97+
$unitWeight = new Weight($value, $sourceWeightMeasure, $locale);
9398
$unitWeight->setType($toWeightMeasure);
9499
return $unitWeight->getValue();
95100
}
@@ -108,7 +113,7 @@ public function convertMeasureDimension($value, $sourceDimensionMeasure, $toDime
108113
{
109114
if ($value) {
110115
$locale = $this->localeResolver->getLocale();
111-
$unitDimension = new \Zend_Measure_Length($value, $sourceDimensionMeasure, $locale);
116+
$unitDimension = new Length($value, $sourceDimensionMeasure, $locale);
112117
$unitDimension->setType($toDimensionMeasure);
113118
return $unitDimension->getValue();
114119
}
@@ -123,7 +128,7 @@ public function convertMeasureDimension($value, $sourceDimensionMeasure, $toDime
123128
*/
124129
public function getMeasureWeightName($key)
125130
{
126-
$weight = new \Zend_Measure_Weight(0);
131+
$weight = new Weight(0);
127132
$conversionList = $weight->getConversionList();
128133
if (!empty($conversionList[$key]) && !empty($conversionList[$key][1])) {
129134
return $conversionList[$key][1];
@@ -139,7 +144,7 @@ public function getMeasureWeightName($key)
139144
*/
140145
public function getMeasureDimensionName($key)
141146
{
142-
$weight = new \Zend_Measure_Length(0);
147+
$weight = new Length(0);
143148
$conversionList = $weight->getConversionList();
144149
if (!empty($conversionList[$key]) && !empty($conversionList[$key][1])) {
145150
return $conversionList[$key][1];

app/code/Magento/Shipping/view/adminhtml/templates/order/packaging/popup_content.phtml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
* @var \Magento\Shipping\Block\Adminhtml\Order\Packaging $block
99
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
1010
*/
11+
12+
use Magento\Framework\Measure\Length;
13+
use Magento\Framework\Measure\Weight;
14+
1115
?>
1216
<div id="packaging_window">
1317
<div class="message message-warning"></div>
@@ -96,10 +100,10 @@
96100
<td>
97101
<select name="container_girth_dimension_units"
98102
class="options-units-dimensions measures admin__control-select">
99-
<option value="<?= /* @noEscape */ Zend_Measure_Length::INCH ?>" selected="selected" >
103+
<option value="<?= /* @noEscape */ Length::INCH ?>" selected="selected" >
100104
<?= $block->escapeHtml(__('in')) ?>
101105
</option>
102-
<option value="<?= /* @noEscape */ Zend_Measure_Length::CENTIMETER ?>" >
106+
<option value="<?= /* @noEscape */ Length::CENTIMETER ?>" >
103107
<?= $block->escapeHtml(__('cm')) ?>
104108
</option>
105109
</select>
@@ -136,10 +140,10 @@
136140
name="container_weight" />
137141
<select name="container_weight_units"
138142
class="options-units-weight measures admin__control-select">
139-
<option value="<?= /* @noEscape */ Zend_Measure_Weight::POUND
143+
<option value="<?= /* @noEscape */ Weight::POUND
140144
?>" selected="selected" ><?= $block->escapeHtml(__('lb')) ?>
141145
</option>
142-
<option value="<?= /* @noEscape */ Zend_Measure_Weight::KILOGRAM ?>" >
146+
<option value="<?= /* @noEscape */ Weight::KILOGRAM ?>" >
143147
<?= $block->escapeHtml(__('kg')) ?>
144148
</option>
145149
</select>
@@ -164,10 +168,10 @@
164168
<td class="col-measure">
165169
<select name="container_dimension_units"
166170
class="options-units-dimensions measures admin__control-select">
167-
<option value="<?= /* @noEscape */ Zend_Measure_Length::INCH ?>" selected="selected" >
171+
<option value="<?= /* @noEscape */ Length::INCH ?>" selected="selected" >
168172
<?= $block->escapeHtml(__('in')) ?>
169173
</option>
170-
<option value="<?= /* @noEscape */ Zend_Measure_Length::CENTIMETER ?>" >
174+
<option value="<?= /* @noEscape */ Length::CENTIMETER ?>" >
171175
<?= $block->escapeHtml(__('cm')) ?>
172176
</option>
173177
</select>

app/code/Magento/Ups/Model/Carrier.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
use Magento\Framework\HTTP\AsyncClientInterface;
2424
use Magento\Framework\HTTP\ClientFactory;
2525
use Magento\Framework\Locale\FormatInterface;
26+
use Magento\Framework\Measure\Length;
27+
use Magento\Framework\Measure\Weight;
2628
use Magento\Framework\Xml\Security;
2729
use Magento\Quote\Model\Quote\Address\RateRequest;
2830
use Magento\Quote\Model\Quote\Address\RateResult\Error;
@@ -1561,8 +1563,8 @@ protected function _formShipmentRequest(DataObject $request)
15611563
$width = $packageParams->getWidth();
15621564
$length = $packageParams->getLength();
15631565
$weight = $packageParams->getWeight();
1564-
$weightUnits = $packageParams->getWeightUnits() == \Zend_Measure_Weight::POUND ? 'LBS' : 'KGS';
1565-
$dimensionsUnits = $packageParams->getDimensionUnits() == \Zend_Measure_Length::INCH ? 'IN' : 'CM';
1566+
$weightUnits = $packageParams->getWeightUnits() == Weight::POUND ? 'LBS' : 'KGS';
1567+
$dimensionsUnits = $packageParams->getDimensionUnits() == Length::INCH ? 'IN' : 'CM';
15661568
$deliveryConfirmation = $packageParams->getDeliveryConfirmation();
15671569
$customsTotal += $packageParams->getCustomsValue();
15681570

app/code/Magento/Usps/Model/Carrier.php

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
use Magento\Framework\HTTP\AsyncClient\HttpException;
1313
use Magento\Framework\HTTP\AsyncClient\Request;
1414
use Magento\Framework\HTTP\AsyncClientInterface;
15+
use Magento\Framework\Measure\Length;
16+
use Magento\Framework\Measure\Weight;
1517
use Magento\Framework\Xml\Security;
1618
use Magento\Quote\Model\Quote\Address\RateRequest;
1719
use Magento\Shipping\Helper\Carrier as CarrierHelper;
@@ -1523,12 +1525,12 @@ protected function _formUsExpressShipmentRequest(\Magento\Framework\DataObject $
15231525
$packageParams = $request->getPackageParams();
15241526

15251527
$packageWeight = $request->getPackageWeight();
1526-
if ($packageParams->getWeightUnits() != \Zend_Measure_Weight::OUNCE) {
1528+
if ($packageParams->getWeightUnits() != Weight::OUNCE) {
15271529
$packageWeight = round(
15281530
(float) $this->_carrierHelper->convertMeasureWeight(
15291531
(float)$request->getPackageWeight(),
15301532
$packageParams->getWeightUnits(),
1531-
\Zend_Measure_Weight::OUNCE
1533+
Weight::OUNCE
15321534
)
15331535
);
15341536
}
@@ -1617,12 +1619,12 @@ protected function _formUsSignatureConfirmationShipmentRequest(\Magento\Framewor
16171619
}
16181620
$packageParams = $request->getPackageParams();
16191621
$packageWeight = $request->getPackageWeight();
1620-
if ($packageParams->getWeightUnits() != \Zend_Measure_Weight::OUNCE) {
1622+
if ($packageParams->getWeightUnits() != Weight::OUNCE) {
16211623
$packageWeight = round(
16221624
(float) $this->_carrierHelper->convertMeasureWeight(
16231625
(float)$request->getPackageWeight(),
16241626
$packageParams->getWeightUnits(),
1625-
\Zend_Measure_Weight::OUNCE
1627+
Weight::OUNCE
16261628
)
16271629
);
16281630
}
@@ -1703,42 +1705,42 @@ protected function _formIntlShipmentRequest(\Magento\Framework\DataObject $reque
17031705
$length = $packageParams->getLength();
17041706
$girth = $packageParams->getGirth();
17051707
$packageWeight = $request->getPackageWeight();
1706-
if ($packageParams->getWeightUnits() != \Zend_Measure_Weight::POUND) {
1708+
if ($packageParams->getWeightUnits() != Weight::POUND) {
17071709
$packageWeight = $this->_carrierHelper->convertMeasureWeight(
17081710
(float)$request->getPackageWeight(),
17091711
$packageParams->getWeightUnits(),
1710-
\Zend_Measure_Weight::POUND
1712+
Weight::POUND
17111713
);
17121714
}
1713-
if ($packageParams->getDimensionUnits() != \Zend_Measure_Length::INCH) {
1715+
if ($packageParams->getDimensionUnits() != Length::INCH) {
17141716
$length = round(
17151717
(float) $this->_carrierHelper->convertMeasureDimension(
17161718
(float)$packageParams->getLength(),
17171719
$packageParams->getDimensionUnits(),
1718-
\Zend_Measure_Length::INCH
1720+
Length::INCH
17191721
)
17201722
);
17211723
$width = round(
17221724
(float) $this->_carrierHelper->convertMeasureDimension(
17231725
(float)$packageParams->getWidth(),
17241726
$packageParams->getDimensionUnits(),
1725-
\Zend_Measure_Length::INCH
1727+
Length::INCH
17261728
)
17271729
);
17281730
$height = round(
17291731
(float) $this->_carrierHelper->convertMeasureDimension(
17301732
(float)$packageParams->getHeight(),
17311733
$packageParams->getDimensionUnits(),
1732-
\Zend_Measure_Length::INCH
1734+
Length::INCH
17331735
)
17341736
);
17351737
}
1736-
if ($packageParams->getGirthDimensionUnits() != \Zend_Measure_Length::INCH) {
1738+
if ($packageParams->getGirthDimensionUnits() != Length::INCH) {
17371739
$girth = round(
17381740
(float) $this->_carrierHelper->convertMeasureDimension(
17391741
(float)$packageParams->getGirth(),
17401742
$packageParams->getGirthDimensionUnits(),
1741-
\Zend_Measure_Length::INCH
1743+
Length::INCH
17421744
)
17431745
);
17441746
}
@@ -1871,11 +1873,11 @@ protected function _formIntlShipmentRequest(\Magento\Framework\DataObject $reque
18711873
$item->setData($itemShipment);
18721874

18731875
$itemWeight = $item->getWeight() * $item->getQty();
1874-
if ($packageParams->getWeightUnits() != \Zend_Measure_Weight::POUND) {
1876+
if ($packageParams->getWeightUnits() != Weight::POUND) {
18751877
$itemWeight = $this->_carrierHelper->convertMeasureWeight(
18761878
$itemWeight,
18771879
$packageParams->getWeightUnits(),
1878-
\Zend_Measure_Weight::POUND
1880+
Weight::POUND
18791881
);
18801882
}
18811883
if (!empty($countriesOfManufacture[$item->getProductId()])) {

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,17 @@
5050
"laminas/laminas-escaper": "~2.10.0",
5151
"laminas/laminas-eventmanager": "^3.5.0",
5252
"laminas/laminas-feed": "^2.17.0",
53+
"laminas/laminas-filter": "^2.17.0",
5354
"laminas/laminas-http": "^2.15.0",
55+
"laminas/laminas-i18n": "^2.17.0",
5456
"laminas/laminas-mail": "^2.16.0",
5557
"laminas/laminas-mime": "^2.9.1",
5658
"laminas/laminas-modulemanager": "^2.11.0",
5759
"laminas/laminas-mvc": "^3.3.3",
5860
"laminas/laminas-oauth": "^2.4",
59-
"laminas/laminas-servicemanager": "^3.11.0",
61+
"laminas/laminas-servicemanager": "^3.16.0",
6062
"laminas/laminas-soap": "^2.10.0",
61-
"laminas/laminas-stdlib": "^3.10.0",
63+
"laminas/laminas-stdlib": "^3.11.0",
6264
"laminas/laminas-uri": "^2.9.1",
6365
"laminas/laminas-validator": "^2.17.0",
6466
"league/flysystem": "~2.4.5",

0 commit comments

Comments
 (0)