Skip to content

Commit 892dee4

Browse files
authored
Merge pull request #5484 from magento-trigger/MC-13825
[TR] Migrate ZF2 components to Laminas
2 parents 70cf0c2 + b26e6c9 commit 892dee4

File tree

249 files changed

+6154
-5747
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

249 files changed

+6154
-5747
lines changed

app/code/Magento/Backend/App/Area/FrontNameResolver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Magento\Framework\App\RequestInterface;
1515
use Magento\Store\Model\ScopeInterface;
1616
use Magento\Store\Model\Store;
17-
use Zend\Uri\Uri;
17+
use Laminas\Uri\Uri;
1818

1919
/**
2020
* Class to get area front name.

app/code/Magento/Backend/Test/Unit/App/Area/FrontNameResolverTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class FrontNameResolverTest extends \PHPUnit\Framework\TestCase
2929
protected $scopeConfigMock;
3030

3131
/**
32-
* @var \PHPUnit_Framework_MockObject_MockObject|\Zend\Uri\Uri
32+
* @var \PHPUnit_Framework_MockObject_MockObject|\Laminas\Uri\Uri
3333
*/
3434
protected $uri;
3535

@@ -51,7 +51,7 @@ protected function setUp()
5151
->method('get')
5252
->with(ConfigOptionsList::CONFIG_PATH_BACKEND_FRONTNAME)
5353
->will($this->returnValue($this->_defaultFrontName));
54-
$this->uri = $this->createMock(\Zend\Uri\Uri::class);
54+
$this->uri = $this->createMock(\Laminas\Uri\Uri::class);
5555

5656
$this->request = $this->createMock(\Magento\Framework\App\Request\Http::class);
5757

app/code/Magento/CacheInvalidate/Model/PurgeCache.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use Magento\Framework\Cache\InvalidateLogger;
99

1010
/**
11-
* Class PurgeCache
11+
* PurgeCache model
1212
*/
1313
class PurgeCache
1414
{
@@ -110,8 +110,8 @@ private function splitTags($tagsPattern)
110110
/**
111111
* Send curl purge request to servers to invalidate cache by tags pattern
112112
*
113-
* @param \Zend\Http\Client\Adapter\Socket $socketAdapter
114-
* @param \Zend\Uri\Uri[] $servers
113+
* @param \Laminas\Http\Client\Adapter\Socket $socketAdapter
114+
* @param \Laminas\Uri\Uri[] $servers
115115
* @param string $formattedTagsChunk
116116
* @return bool Return true if successful; otherwise return false
117117
*/

app/code/Magento/CacheInvalidate/Model/SocketFactory.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,22 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\CacheInvalidate\Model;
79

10+
/**
11+
* Factory for the \Laminas\Http\Client\Adapter\Socket
12+
*/
813
class SocketFactory
914
{
1015
/**
11-
* @return \Zend\Http\Client\Adapter\Socket
16+
* Create object
17+
*
18+
* @return \Laminas\Http\Client\Adapter\Socket
1219
*/
1320
public function create()
1421
{
15-
return new \Zend\Http\Client\Adapter\Socket();
22+
return new \Laminas\Http\Client\Adapter\Socket();
1623
}
1724
}

app/code/Magento/CacheInvalidate/Test/Unit/Model/PurgeCacheTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
*/
66
namespace Magento\CacheInvalidate\Test\Unit\Model;
77

8-
use Zend\Uri\UriFactory;
8+
use Laminas\Uri\UriFactory;
99

1010
class PurgeCacheTest extends \PHPUnit\Framework\TestCase
1111
{
1212
/** @var \Magento\CacheInvalidate\Model\PurgeCache */
1313
protected $model;
1414

15-
/** @var \PHPUnit_Framework_MockObject_MockObject | \Zend\Http\Client\Adapter\Socket */
15+
/** @var \PHPUnit_Framework_MockObject_MockObject | \Laminas\Http\Client\Adapter\Socket */
1616
protected $socketAdapterMock;
1717

1818
/** @var \PHPUnit_Framework_MockObject_MockObject | \Magento\Framework\Cache\InvalidateLogger */
@@ -24,7 +24,7 @@ class PurgeCacheTest extends \PHPUnit\Framework\TestCase
2424
protected function setUp()
2525
{
2626
$socketFactoryMock = $this->createMock(\Magento\CacheInvalidate\Model\SocketFactory::class);
27-
$this->socketAdapterMock = $this->createMock(\Zend\Http\Client\Adapter\Socket::class);
27+
$this->socketAdapterMock = $this->createMock(\Laminas\Http\Client\Adapter\Socket::class);
2828
$this->socketAdapterMock->expects($this->once())
2929
->method('setOptions')
3030
->with(['timeout' => 10]);
@@ -113,7 +113,7 @@ public function testSendPurgeRequestWithException()
113113
->method('getUris')
114114
->willReturn($uris);
115115
$this->socketAdapterMock->method('connect')
116-
->willThrowException(new \Zend\Http\Client\Adapter\Exception\RuntimeException());
116+
->willThrowException(new \Laminas\Http\Client\Adapter\Exception\RuntimeException());
117117
$this->loggerMock->expects($this->never())
118118
->method('execute');
119119
$this->loggerMock->expects($this->once())

app/code/Magento/CacheInvalidate/Test/Unit/Model/SocketFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ class SocketFactoryTest extends \PHPUnit\Framework\TestCase
1010
public function testCreate()
1111
{
1212
$factory = new \Magento\CacheInvalidate\Model\SocketFactory();
13-
$this->assertInstanceOf(\Zend\Http\Client\Adapter\Socket::class, $factory->create());
13+
$this->assertInstanceOf(\Laminas\Http\Client\Adapter\Socket::class, $factory->create());
1414
}
1515
}

app/code/Magento/Captcha/Model/DefaultModel.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
use Magento\Framework\Math\Random;
1212

1313
/**
14-
* Implementation of \Zend\Captcha\Image
14+
* Implementation of \Laminas\Captcha\Image
1515
*
1616
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
1717
*
1818
* @api
1919
* @since 100.0.2
2020
*/
21-
class DefaultModel extends \Zend\Captcha\Image implements \Magento\Captcha\Model\CaptchaInterface
21+
class DefaultModel extends \Laminas\Captcha\Image implements \Magento\Captcha\Model\CaptchaInterface
2222
{
2323
/**
2424
* Key in session for captcha code
@@ -51,7 +51,7 @@ class DefaultModel extends \Zend\Captcha\Image implements \Magento\Captcha\Model
5151
/**
5252
* Override default value to prevent a captcha cut off
5353
* @var int
54-
* @see \Zend\Captcha\Image::$fsize
54+
* @see \Laminas\Captcha\Image::$fsize
5555
* @since 100.2.0
5656
*/
5757
protected $fsize = 22;
@@ -99,7 +99,7 @@ class DefaultModel extends \Zend\Captcha\Image implements \Magento\Captcha\Model
9999
* @param ResourceModel\LogFactory $resLogFactory
100100
* @param string $formId
101101
* @param Random $randomMath
102-
* @throws \Zend\Captcha\Exception\ExtensionNotLoadedException
102+
* @throws \Laminas\Captcha\Exception\ExtensionNotLoadedException
103103
*/
104104
public function __construct(
105105
\Magento\Framework\Session\SessionManagerInterface $session,
@@ -537,7 +537,7 @@ private function clearWord()
537537
/**
538538
* Override function to generate less curly captcha that will not cut off
539539
*
540-
* @see \Zend\Captcha\Image::_randomSize()
540+
* @see \Laminas\Captcha\Image::_randomSize()
541541
* @return int
542542
* @throws \Magento\Framework\Exception\LocalizedException
543543
* @since 100.2.0

app/code/Magento/Captcha/Model/ResourceModel/Log.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class Log extends \Magento\Framework\Model\ResourceModel\Db\AbstractDb
1414
{
1515
/**
16-
* Type Remote Address
16+
* Remote Address log type
1717
*/
1818
const TYPE_REMOTE_ADDRESS = 1;
1919

@@ -79,7 +79,7 @@ public function logAttempt($login)
7979
'count' => 1,
8080
'updated_at' => $this->_coreDate->gmtDate()
8181
],
82-
['count' => new \Zend\Db\Sql\Expression('count+1'), 'updated_at']
82+
['count' => new \Laminas\Db\Sql\Expression('count+1'), 'updated_at']
8383
);
8484
}
8585
$ip = $this->_remoteAddress->getRemoteAddress();
@@ -92,7 +92,7 @@ public function logAttempt($login)
9292
'count' => 1,
9393
'updated_at' => $this->_coreDate->gmtDate()
9494
],
95-
['count' => new \Zend\Db\Sql\Expression('count+1'), 'updated_at']
95+
['count' => new \Laminas\Db\Sql\Expression('count+1'), 'updated_at']
9696
);
9797
}
9898
return $this;

app/code/Magento/Captcha/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
"magento/module-checkout": "*",
1212
"magento/module-customer": "*",
1313
"magento/module-store": "*",
14-
"zendframework/zend-captcha": "^2.7.1",
15-
"zendframework/zend-db": "^2.8.2",
16-
"zendframework/zend-session": "^2.7.3"
14+
"laminas/laminas-captcha": "^2.7.1",
15+
"laminas/laminas-db": "^2.8.2",
16+
"laminas/laminas-session": "^2.7.3"
1717
},
1818
"type": "magento2-module",
1919
"license": [

app/code/Magento/Catalog/Controller/Product/Frontend/Action/Synchronize.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77

88
use Magento\Catalog\Model\Product\ProductFrontendAction\Synchronizer;
99
use Magento\Framework\App\Action\Context;
10+
use Magento\Framework\App\Action\HttpPostActionInterface;
1011
use Magento\Framework\Controller\Result\JsonFactory;
1112

1213
/**
1314
* Synchronizes Product Frontend Actions with database
1415
*/
15-
class Synchronize extends \Magento\Framework\App\Action\Action
16+
class Synchronize extends \Magento\Framework\App\Action\Action implements HttpPostActionInterface
1617
{
1718
/**
1819
* @var Context
@@ -46,6 +47,8 @@ public function __construct(
4647
}
4748

4849
/**
50+
* @inheritDoc
51+
*
4952
* This is handle for synchronizing between frontend and backend product actions:
5053
* - visit product page (recently_viewed)
5154
* - compare products (recently_compared)
@@ -57,9 +60,6 @@ public function __construct(
5760
* 'added_at' => "JS_TIMESTAMP"
5861
* ]
5962
* ]
60-
*
61-
*
62-
* @inheritdoc
6363
*/
6464
public function execute()
6565
{
@@ -71,8 +71,8 @@ public function execute()
7171
$this->synchronizer->syncActions($productsData, $typeId);
7272
} catch (\Exception $e) {
7373
$resultJson->setStatusHeader(
74-
\Zend\Http\Response::STATUS_CODE_400,
75-
\Zend\Http\AbstractMessage::VERSION_11,
74+
\Laminas\Http\Response::STATUS_CODE_400,
75+
\Laminas\Http\AbstractMessage::VERSION_11,
7676
'Bad Request'
7777
);
7878
}

app/code/Magento/Catalog/Test/Unit/Controller/Product/Frontend/Action/SynchronizeTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,8 +133,8 @@ public function testExecuteActionException()
133133
$jsonObject->expects($this->once())
134134
->method('setStatusHeader')
135135
->with(
136-
\Zend\Http\Response::STATUS_CODE_400,
137-
\Zend\Http\AbstractMessage::VERSION_11,
136+
\Laminas\Http\Response::STATUS_CODE_400,
137+
\Laminas\Http\AbstractMessage::VERSION_11,
138138
'Bad Request'
139139
);
140140
$jsonObject->expects($this->once())

app/code/Magento/Checkout/Model/Cart/RequestQuantityProcessor.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
use Magento\Framework\Locale\ResolverInterface;
1111

12+
/**
13+
* Cart request quantity processor
14+
*/
1215
class RequestQuantityProcessor
1316
{
1417
/**
@@ -34,7 +37,7 @@ public function __construct(
3437
*/
3538
public function process(array $cartData): array
3639
{
37-
$filter = new \Zend\I18n\Filter\NumberParse($this->localeResolver->getLocale());
40+
$filter = new \Laminas\I18n\Filter\NumberParse($this->localeResolver->getLocale());
3841

3942
foreach ($cartData as $index => $data) {
4043
if (isset($data['qty'])) {

app/code/Magento/Customer/Controller/Section/Load.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ public function execute()
7878
$response = $this->sectionPool->getSectionsData($sectionNames, (bool)$forceNewSectionTimestamp);
7979
} catch (\Exception $e) {
8080
$resultJson->setStatusHeader(
81-
\Zend\Http\Response::STATUS_CODE_400,
82-
\Zend\Http\AbstractMessage::VERSION_11,
81+
\Laminas\Http\Response::STATUS_CODE_400,
82+
\Laminas\Http\AbstractMessage::VERSION_11,
8383
'Bad Request'
8484
);
8585
$response = ['message' => $this->escaper->escapeHtml($e->getMessage())];

app/code/Magento/Customer/Test/Unit/Controller/Section/LoadTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ public function testExecuteWithThrowException()
166166
$this->resultJsonMock->expects($this->once())
167167
->method('setStatusHeader')
168168
->with(
169-
\Zend\Http\Response::STATUS_CODE_400,
170-
\Zend\Http\AbstractMessage::VERSION_11,
169+
\Laminas\Http\Response::STATUS_CODE_400,
170+
\Laminas\Http\AbstractMessage::VERSION_11,
171171
'Bad Request'
172172
);
173173

app/code/Magento/Downloadable/Model/Url/DomainValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
use Magento\Downloadable\Api\DomainManagerInterface as DomainManager;
1111
use Magento\Framework\Validator\Ip as IpValidator;
12-
use Zend\Uri\Uri as UriHandler;
12+
use Laminas\Uri\Uri as UriHandler;
1313

1414
/**
1515
* Class is responsible for checking if downloadable product link domain is allowed.

app/code/Magento/Downloadable/Setup/Patch/Data/AddDownloadableHostsConfig.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,22 @@
77

88
namespace Magento\Downloadable\Setup\Patch\Data;
99

10+
use Laminas\Uri\Uri as UriHandler;
11+
use Magento\Backend\App\Area\FrontNameResolver;
1012
use Magento\Config\Model\Config\Backend\Admin\Custom;
13+
use Magento\Downloadable\Api\DomainManagerInterface as DomainManager;
1114
use Magento\Framework\App\Config\ScopeConfigInterface;
1215
use Magento\Framework\Exception\NoSuchEntityException;
16+
use Magento\Framework\Setup\ModuleDataSetupInterface;
1317
use Magento\Framework\Setup\Patch\DataPatchInterface;
18+
use Magento\Framework\Url\ScopeResolverInterface;
1419
use Magento\Framework\UrlInterface;
1520
use Magento\Store\Model\ScopeInterface;
1621
use Magento\Store\Model\Store;
17-
use Zend\Uri\Uri as UriHandler;
18-
use Magento\Framework\Url\ScopeResolverInterface;
19-
use Magento\Downloadable\Api\DomainManagerInterface as DomainManager;
20-
use Magento\Framework\Setup\ModuleDataSetupInterface;
21-
use Magento\Backend\App\Area\FrontNameResolver;
2222

2323
/**
2424
* Adding base url as allowed downloadable domain.
25+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2526
*/
2627
class AddDownloadableHostsConfig implements DataPatchInterface
2728
{
@@ -79,7 +80,7 @@ public function __construct(
7980
}
8081

8182
/**
82-
* @inheritdoc
83+
* @inheritDoc
8384
*/
8485
public function apply()
8586
{
@@ -141,6 +142,8 @@ public function apply()
141142
}
142143

143144
$this->domainManager->addDomains($this->whitelist);
145+
146+
return $this;
144147
}
145148

146149
/**

0 commit comments

Comments
 (0)