Skip to content

Commit 3e331de

Browse files
committed
Merge remote-tracking branch 'origin/AC-3110-p5' into delivery-bunch-w21
2 parents 6269f94 + f7ded81 commit 3e331de

File tree

11 files changed

+48
-44
lines changed

11 files changed

+48
-44
lines changed

app/code/Magento/Deploy/Package/Processor/PostProcessor/CssUrls.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private function updateCssUrls(array $urlMap)
156156
foreach ($targetFiles as $matchedFileData) {
157157
$filePath = $matchedFileData['filePath'];
158158
$oldCss = $this->staticDir->readFile($filePath);
159-
$newCss = str_replace($ref, $matchedFileData['replace'], $oldCss);
159+
$newCss = str_replace($ref, $matchedFileData['replace'] ?? '', $oldCss);
160160
if ($oldCss !== $newCss) {
161161
$this->staticDir->writeFile($filePath, $newCss);
162162
}

app/code/Magento/Deploy/Package/Processor/PreProcessor/Less.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private function buildMap($filePath, $packagePath, $contentType)
175175
{
176176
$content = $this->deployStaticFile->readTmpFile($filePath, $packagePath);
177177
$replaceCallback = function ($matchedContent) use ($filePath, $packagePath, $contentType) {
178-
$matchedFileId = $matchedContent['path'];
178+
$matchedFileId = $matchedContent['path'] ?? '';
179179
// phpcs:ignore Magento2.Functions.DiscouragedFunction
180180
if (!pathinfo($matchedContent['path'], PATHINFO_EXTENSION)) {
181181
$matchedFileId .= '.' . $contentType;
@@ -212,7 +212,7 @@ private function buildMap($filePath, $packagePath, $contentType)
212212
*/
213213
private function normalizePath($path)
214214
{
215-
if (strpos($path, '/../') === false) {
215+
if ($path === null || strpos($path, '/../') === false) {
216216
return $path;
217217
}
218218
$pathParts = explode('/', $path);

app/code/Magento/Deploy/Service/Bundle.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ class Bundle
2727
/**
2828
* Path to package subdirectory where bundle files are located
2929
*/
30-
const BUNDLE_JS_DIR = 'js/bundle';
30+
public const BUNDLE_JS_DIR = 'js/bundle';
3131

3232
/**
3333
* Matched file extension name for JavaScript files
3434
*/
35-
const ASSET_TYPE_JS = 'js';
35+
public const ASSET_TYPE_JS = 'js';
3636

3737
/**
3838
* Matched file extension name for template files
3939
*/
40-
const ASSET_TYPE_HTML = 'html';
40+
public const ASSET_TYPE_HTML = 'html';
4141

4242
/**
4343
* Public static directory writable interface
@@ -157,7 +157,7 @@ public function deploy($area, $theme, $locale)
157157
. '/' . $sourcePath['locale']
158158
. '/' . $filePath;
159159
} else {
160-
$sourcePath = str_replace('\\', '/', $sourcePath);
160+
$sourcePath = str_replace('\\', '/', $sourcePath ?? '');
161161
$sourcePath = $this->pubStaticDir->getRelativePath($sourcePath);
162162
$filePath = substr($sourcePath, strlen($area . '/' . $theme . '/' . $locale) + 1);
163163
}
@@ -241,7 +241,7 @@ private function isExcluded($filePath, $area, $theme)
241241
*/
242242
private function prepareExcludePath($path)
243243
{
244-
if (strpos($path, Repository::FILE_ID_SEPARATOR) !== false) {
244+
if ($path !== null && strpos($path, Repository::FILE_ID_SEPARATOR) !== false) {
245245
list($excludedModule, $excludedPath) = explode(Repository::FILE_ID_SEPARATOR, $path);
246246
if ($excludedModule == 'Lib') {
247247
return $excludedPath;

app/code/Magento/Deploy/Service/DeployPackage.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ private function checkIfCanCopy(PackageFile $file, Package $package, Package $pa
224224
private function checkFileSkip($filePath, array $options)
225225
{
226226
if ($filePath !== '.') {
227+
$filePath = (string)$filePath;
227228
// phpcs:ignore Magento2.Functions.DiscouragedFunction
228229
$ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
229230
// phpcs:ignore Magento2.Functions.DiscouragedFunction

app/code/Magento/Deploy/Source/Lib.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
class Lib implements SourceInterface
2020
{
21-
const TYPE = 'lib';
21+
public const TYPE = 'lib';
2222

2323
/**
2424
* @var Files
@@ -59,6 +59,7 @@ public function get()
5959
{
6060
$files = [];
6161
foreach ($this->filesUtil->getStaticLibraryFiles() as $fileName) {
62+
$fileName = $fileName === null ? '' : $fileName;
6263
if (strpos($fileName, 'css/docs') === 0) {
6364
continue;
6465
}

app/code/Magento/Developer/Console/Command/GeneratePatchCommand.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ class GeneratePatchCommand extends Command
2727
/**
2828
* Command arguments and options
2929
*/
30-
const COMMAND_NAME = 'setup:db-declaration:generate-patch';
31-
const MODULE_NAME = 'module';
32-
const INPUT_KEY_IS_REVERTABLE = 'revertable';
33-
const INPUT_KEY_PATCH_TYPE = 'type';
34-
const INPUT_KEY_PATCH_NAME = 'patch';
30+
public const COMMAND_NAME = 'setup:db-declaration:generate-patch';
31+
public const MODULE_NAME = 'module';
32+
public const INPUT_KEY_IS_REVERTABLE = 'revertable';
33+
public const INPUT_KEY_PATCH_TYPE = 'type';
34+
public const INPUT_KEY_PATCH_NAME = 'patch';
3535

3636
/**
3737
* @var ComponentRegistrar
@@ -126,17 +126,17 @@ protected function configure()
126126
protected function execute(InputInterface $input, OutputInterface $output): int
127127
{
128128
$moduleName = $input->getArgument(self::MODULE_NAME);
129-
$patchName = $input->getArgument(self::INPUT_KEY_PATCH_NAME);
129+
$patchName = $input->getArgument(self::INPUT_KEY_PATCH_NAME) ?? '';
130130
$includeRevertMethod = false;
131131
if ($input->getOption(self::INPUT_KEY_IS_REVERTABLE)) {
132132
$includeRevertMethod = true;
133133
}
134-
$type = $input->getOption(self::INPUT_KEY_PATCH_TYPE);
134+
$type = $input->getOption(self::INPUT_KEY_PATCH_TYPE) ?? '';
135135
$modulePath = $this->componentRegistrar->getPath(ComponentRegistrar::MODULE, $moduleName);
136136
if (null === $modulePath) {
137137
throw new \InvalidArgumentException(sprintf('Cannot find a registered module with name "%s"', $moduleName));
138138
}
139-
$preparedModuleName = str_replace('_', '\\', $moduleName);
139+
$preparedModuleName = str_replace('_', '\\', $moduleName ?? '');
140140
$preparedType = ucfirst($type);
141141
$patchInterface = sprintf('%sPatchInterface', $preparedType);
142142
$patchTemplateData = $this->getPatchTemplate();

app/code/Magento/Developer/Console/Command/SourceThemeDeployCommand.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
*/
66
namespace Magento\Developer\Console\Command;
77

8+
use Magento\Framework\App\View\Asset\Publisher;
9+
use Magento\Framework\Console\Cli;
810
use Magento\Framework\Validator\Locale;
911
use Magento\Framework\View\Asset\Repository;
1012
use Symfony\Component\Console\Command\Command;
11-
use Magento\Framework\App\View\Asset\Publisher;
12-
use Symfony\Component\Console\Input\InputOption;
1313
use Symfony\Component\Console\Input\InputArgument;
1414
use Symfony\Component\Console\Input\InputInterface;
15+
use Symfony\Component\Console\Input\InputOption;
1516
use Symfony\Component\Console\Output\OutputInterface;
1617

1718
/**
@@ -24,27 +25,27 @@ class SourceThemeDeployCommand extends Command
2425
/**
2526
* Locale option key
2627
*/
27-
const LOCALE_OPTION = 'locale';
28+
public const LOCALE_OPTION = 'locale';
2829

2930
/**
3031
* Area option key
3132
*/
32-
const AREA_OPTION = 'area';
33+
public const AREA_OPTION = 'area';
3334

3435
/**
3536
* Theme option key
3637
*/
37-
const THEME_OPTION = 'theme';
38+
public const THEME_OPTION = 'theme';
3839

3940
/**
4041
* Type argument key
4142
*/
42-
const TYPE_ARGUMENT = 'type';
43+
public const TYPE_ARGUMENT = 'type';
4344

4445
/**
4546
* Files argument key
4647
*/
47-
const FILE_ARGUMENT = 'file';
48+
public const FILE_ARGUMENT = 'file';
4849

4950
/**
5051
* @var Locale
@@ -146,7 +147,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
146147
);
147148
}
148149

149-
if (!preg_match('#^[\w\-]+\/[\w\-]+$#', $theme)) {
150+
if ($theme === null || !preg_match('#^[\w\-]+\/[\w\-]+$#', $theme)) {
150151
throw new \InvalidArgumentException(
151152
'Value "' . $theme . '" of the option "' . self::THEME_OPTION .
152153
'" has invalid format. The format should be "Vendor/theme".'
@@ -163,6 +164,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
163164
$output->writeln($message);
164165

165166
foreach ($files as $file) {
167+
// phpcs:ignore Magento2.Functions.DiscouragedFunction
166168
$fileInfo = pathinfo($file);
167169
$asset = $this->assetRepository->createAsset(
168170
$fileInfo['dirname'] . DIRECTORY_SEPARATOR . $fileInfo['basename'] . '.' . $type,
@@ -185,5 +187,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
185187
}
186188

187189
$output->writeln('<info>Successfully processed.</info>');
190+
191+
return Cli::RETURN_SUCCESS;
188192
}
189193
}

app/code/Magento/Developer/Console/Command/XmlCatalogGenerateCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ class XmlCatalogGenerateCommand extends Command
3131
/**
3232
* Option for the type of IDE
3333
*/
34-
const IDE_OPTION = 'ide';
34+
public const IDE_OPTION = 'ide';
3535

3636
/**
3737
* Argument for the path to IDE config file
3838
*/
39-
const IDE_FILE_PATH_ARGUMENT = 'path';
39+
public const IDE_FILE_PATH_ARGUMENT = 'path';
4040

4141
/**
4242
* @var Files
@@ -175,7 +175,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
175175
*/
176176
private function getFormatters($format)
177177
{
178-
$format = strtolower($format);
178+
$format = $format === null ? '' : strtolower($format);
179179
if (!isset($this->formats[$format])) {
180180
return false;
181181
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,16 +565,16 @@ public function getAllowedMethods()
565565

566566
if ($this->_isDomestic) {
567567
$allowedMethods = array_merge(
568-
explode(',', $this->getConfigData('doc_methods')),
569-
explode(',', $this->getConfigData('nondoc_methods'))
568+
explode(',', $this->getConfigData('doc_methods') ?? ''),
569+
explode(',', $this->getConfigData('nondoc_methods') ?? '')
570570
);
571571
} else {
572572
switch ($contentType) {
573573
case self::DHL_CONTENT_TYPE_DOC:
574-
$allowedMethods = explode(',', $this->getConfigData('doc_methods'));
574+
$allowedMethods = explode(',', $this->getConfigData('doc_methods') ?? '');
575575
break;
576576
case self::DHL_CONTENT_TYPE_NON_DOC:
577-
$allowedMethods = explode(',', $this->getConfigData('nondoc_methods'));
577+
$allowedMethods = explode(',', $this->getConfigData('nondoc_methods') ?? '');
578578
break;
579579
default:
580580
throw new \Magento\Framework\Exception\LocalizedException(__('Wrong Content Type'));

app/code/Magento/Dhl/Model/Validator/XmlValidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(
4747
*/
4848
public function validate($xmlResponse, $isShippingLabel = false)
4949
{
50-
if (strlen(trim($xmlResponse)) > 0 && strpos(trim($xmlResponse), '<?xml') === 0) {
50+
if ($xmlResponse !== null && strlen(trim($xmlResponse)) > 0 && strpos(trim($xmlResponse), '<?xml') === 0) {
5151
if (!$this->xmlSecurity->scan($xmlResponse)) {
5252
throw new DocumentValidationException(__('The security validation of the XML document has failed.'));
5353
}

0 commit comments

Comments
 (0)