Skip to content

Commit 714c021

Browse files
committed
Merge remote-tracking branch 'origin/AC-3162-p10' into delivery-bunch-w22
2 parents f58dedd + 7c37fc7 commit 714c021

File tree

13 files changed

+66
-48
lines changed

13 files changed

+66
-48
lines changed

lib/internal/Magento/Framework/Api/Code/Generator/ExtensionAttributesGenerator.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
*/
1616
class ExtensionAttributesGenerator extends \Magento\Framework\Code\Generator\EntityAbstract
1717
{
18-
const ENTITY_TYPE = 'extension';
18+
public const ENTITY_TYPE = 'extension';
1919

20-
const EXTENSION_SUFFIX = 'Extension';
20+
public const EXTENSION_SUFFIX = 'Extension';
2121

2222
/**
2323
* @var \Magento\Framework\Api\ExtensionAttribute\Config
@@ -80,23 +80,23 @@ private function getTypeProcessor()
8080
}
8181

8282
/**
83-
* {@inheritdoc}
83+
* @inheritdoc
8484
*/
8585
protected function _getDefaultConstructorDefinition()
8686
{
8787
return [];
8888
}
8989

9090
/**
91-
* {@inheritdoc}
91+
* @inheritdoc
9292
*/
9393
protected function _getClassProperties()
9494
{
9595
return [];
9696
}
9797

9898
/**
99-
* {@inheritdoc}
99+
* @inheritdoc
100100
*/
101101
protected function _getClassMethods()
102102
{
@@ -139,7 +139,7 @@ protected function _getClassMethods()
139139
}
140140

141141
/**
142-
* {@inheritdoc}
142+
* @inheritdoc
143143
*/
144144
protected function _validateData()
145145
{
@@ -148,7 +148,7 @@ protected function _validateData()
148148
}
149149

150150
/**
151-
* {@inheritdoc}
151+
* @inheritdoc
152152
*/
153153
protected function _generateCode()
154154
{
@@ -177,11 +177,11 @@ protected function getCustomAttributes()
177177
if (!isset($this->allCustomAttributes)) {
178178
$this->allCustomAttributes = $this->config->get();
179179
}
180-
$dataInterface = ltrim($this->getSourceClassName(), '\\');
180+
$dataInterface = $this->getSourceClassName() !== null ? ltrim($this->getSourceClassName(), '\\') : '';
181181
if (isset($this->allCustomAttributes[$dataInterface])) {
182182
foreach ($this->allCustomAttributes[$dataInterface] as $attributeName => $attributeMetadata) {
183183
$attributeType = $attributeMetadata[Converter::DATA_TYPE];
184-
if (strpos($attributeType, '\\') !== false) {
184+
if ($attributeType !== null && strpos($attributeType, '\\') !== false) {
185185
/** Add preceding slash to class names, while leaving primitive types as is */
186186
$attributeType = $this->_getFullyQualifiedClassName($attributeType);
187187
$this->allCustomAttributes[$dataInterface][$attributeName][Converter::DATA_TYPE] =
@@ -202,7 +202,7 @@ protected function getCustomAttributes()
202202
protected function validateResultClassName()
203203
{
204204
$result = true;
205-
$sourceClassName = $this->getSourceClassName();
205+
$sourceClassName = $this->getSourceClassName() ?? '';
206206
$resultClassName = $this->_getResultClassName();
207207
$interfaceSuffix = 'Interface';
208208
$expectedResultClassName = substr($sourceClassName, 0, -strlen($interfaceSuffix)) . self::EXTENSION_SUFFIX;

lib/internal/Magento/Framework/Api/ImageContentValidator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22
/**
3-
*
43
* Copyright © Magento, Inc. All rights reserved.
54
* See COPYING.txt for license details.
65
*/
@@ -87,7 +86,7 @@ protected function isMimeTypeValid($mimeType)
8786
protected function isNameValid($name)
8887
{
8988
// Cannot contain \ / ? * : " ; < > ( ) | { }
90-
if (!preg_match('/^[^\\/?*:";<>()|{}\\\\]+$/', $name)) {
89+
if ($name === null || !preg_match('/^[^\\/?*:";<>()|{}\\\\]+$/', $name)) {
9190
return false;
9291
}
9392
return true;

lib/internal/Magento/Framework/Api/SimpleDataObjectConverter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected function _unpackAssociativeArray($data)
148148
*/
149149
public static function snakeCaseToUpperCamelCase($input)
150150
{
151-
return str_replace('_', '', ucwords($input, '_'));
151+
return $input !== null ? str_replace('_', '', ucwords($input, '_')) : '';
152152
}
153153

154154
/**
@@ -172,6 +172,6 @@ public static function snakeCaseToCamelCase($input)
172172
*/
173173
public static function camelCaseToSnakeCase($name)
174174
{
175-
return strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $name));
175+
return $name !== null ? strtolower(preg_replace('/(.)([A-Z])/', "$1_$2", $name)) : '';
176176
}
177177
}

lib/internal/Magento/Framework/App/Config/ConfigPathResolver.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function __construct(ScopeCodeResolver $scopeCodeResolver)
2727

2828
/**
2929
* Creates full config path for given params.
30+
*
3031
* If $type variable was provided, it will be used as first part of path.
3132
*
3233
* @param string $path The path of configuration
@@ -43,8 +44,8 @@ public function __construct(ScopeCodeResolver $scopeCodeResolver)
4344
*/
4445
public function resolve($path, $scope = ScopeConfigInterface::SCOPE_TYPE_DEFAULT, $scopeCode = null, $type = null)
4546
{
46-
$path = trim($path, '/');
47-
$scope = rtrim($scope, 's');
47+
$path = $path !== null ? trim($path, '/') : '';
48+
$scope = $scope !== null ? rtrim($scope, 's') : '';
4849

4950
/** Scope name is currently stored in plural form. */
5051
if (in_array($scope, [ScopeInterface::SCOPE_STORE, ScopeInterface::SCOPE_WEBSITE])) {

lib/internal/Magento/Framework/App/Config/Data.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
<?php
22
/**
3-
* Configuration data container
4-
*
53
* Copyright © Magento, Inc. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
86
namespace Magento\Framework\App\Config;
97

8+
/**
9+
* Configuration data container
10+
*/
1011
class Data implements DataInterface
1112
{
1213
/**
@@ -35,6 +36,8 @@ public function __construct(MetadataProcessor $processor, array $data)
3536
}
3637

3738
/**
39+
* Get config source
40+
*
3841
* @return array
3942
*/
4043
public function getSource()
@@ -67,7 +70,7 @@ public function getValue($path = null)
6770
*/
6871
public function setValue($path, $value)
6972
{
70-
$keys = explode('/', $path);
73+
$keys = explode('/', (string)$path);
7174
$lastKey = array_pop($keys);
7275
$currentElement = & $this->_data;
7376
foreach ($keys as $key) {

lib/internal/Magento/Framework/App/Config/Initial.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
<?php
22
/**
3-
* Initial configuration data container. Provides interface for reading initial config values
4-
*
53
* Copyright © Magento, Inc. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
@@ -10,12 +8,15 @@
108
use Magento\Framework\App\Config\ScopeConfigInterface;
119
use Magento\Framework\Serialize\SerializerInterface;
1210

11+
/**
12+
* Initial configuration data container. Provides interface for reading initial config values
13+
*/
1314
class Initial
1415
{
1516
/**
1617
* Cache identifier used to store initial config
1718
*/
18-
const CACHE_ID = 'initial_config';
19+
public const CACHE_ID = 'initial_config';
1920

2021
/**
2122
* Config data
@@ -69,7 +70,7 @@ public function __construct(
6970
*/
7071
public function getData($scope)
7172
{
72-
list($scopeType, $scopeCode) = array_pad(explode('|', $scope), 2, null);
73+
[$scopeType, $scopeCode] = array_pad(explode('|', (string)$scope), 2, null);
7374

7475
if (ScopeConfigInterface::SCOPE_TYPE_DEFAULT == $scopeType) {
7576
return $this->_data[$scopeType] ?? [];

lib/internal/Magento/Framework/App/DeploymentConfig/CommentParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function ($entry) {
9999
private function getCommentText($commentBlock)
100100
{
101101
$commentsLine = [];
102-
foreach (preg_split("/(\r?\n)/", $commentBlock) as $commentLine) {
102+
foreach (preg_split("/(\r?\n)/", (string)$commentBlock) as $commentLine) {
103103
if (preg_match('/^(?=\s+?\*[^\/])(.+)/', $commentLine, $matches)
104104
&& false === strpos($commentLine, 'For the section')
105105
) {

lib/internal/Magento/Framework/App/DocRootLocator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(RequestInterface $request, ReadFactory $readFactory,
5151
*/
5252
public function isPub()
5353
{
54-
$rootBasePath = $this->request->getServer('DOCUMENT_ROOT');
54+
$rootBasePath = $this->request->getServer('DOCUMENT_ROOT') ?? '';
5555
$readDirectory = $this->filesystem->getDirectoryRead(DirectoryList::ROOT);
5656

5757
return (substr($rootBasePath, -\strlen('/pub')) === '/pub') && ! $readDirectory->isExist('setup');

lib/internal/Magento/Framework/App/ErrorHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ErrorHandler
4646
*/
4747
public function handler($errorNo, $errorStr, $errorFile, $errorLine)
4848
{
49-
if (strpos($errorStr, 'DateTimeZone::__construct') !== false) {
49+
if ($errorStr !== null && strpos($errorStr, 'DateTimeZone::__construct') !== false) {
5050
// there's no way to distinguish between caught system exceptions and warnings
5151
return false;
5252
}
@@ -58,6 +58,7 @@ public function handler($errorNo, $errorStr, $errorFile, $errorLine)
5858

5959
$msg = isset($this->errorPhrases[$errorNo]) ? $this->errorPhrases[$errorNo] : "Unknown error ({$errorNo})";
6060
$msg .= ": {$errorStr} in {$errorFile} on line {$errorLine}";
61+
// phpcs:ignore Magento2.Exceptions.DirectThrow
6162
throw new \Exception($msg);
6263
}
6364
}

lib/internal/Magento/Framework/App/PageCache/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function process(\Magento\Framework\App\Response\Http $response)
138138
&& ($this->request->isGet() || $this->request->isHead())
139139
) {
140140
$tagsHeader = $response->getHeader('X-Magento-Tags');
141-
$tags = $tagsHeader ? explode(',', $tagsHeader->getFieldValue()) : [];
141+
$tags = $tagsHeader ? explode(',', $tagsHeader->getFieldValue() ?? '') : [];
142142

143143
$response->clearHeader('Set-Cookie');
144144
if ($this->state->getMode() != AppState::MODE_DEVELOPER) {

0 commit comments

Comments
 (0)