Skip to content

Commit 7160ad6

Browse files
committed
AC-3160: Fix possible deprecation issues with 8.1
1 parent 645e14e commit 7160ad6

File tree

4 files changed

+8
-16
lines changed

4 files changed

+8
-16
lines changed

lib/internal/Magento/Framework/View/Element/Template/File/Validator.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99
use Magento\Framework\Component\ComponentRegistrar;
1010
use \Magento\Framework\Filesystem\Driver\File as FileDriver;
1111

12-
/**
13-
* Class Validator
14-
*/
1512
class Validator
1613
{
1714
/**
1815
* Config path to 'Allow Symlinks' template settings
1916
*/
20-
const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink';
17+
public const XML_PATH_TEMPLATE_ALLOW_SYMLINK = 'dev/template/allow_symlink';
2118

2219
/**
2320
* Template files map
@@ -140,7 +137,7 @@ protected function isPathInDirectories($path, $directories)
140137
}
141138
$realPath = $this->fileDriver->getRealPath($path);
142139
foreach ($directories as $directory) {
143-
if (0 === strpos($realPath, $directory)) {
140+
if ($directory !== null && 0 === strpos($realPath, $directory)) {
144141
return true;
145142
}
146143
}

lib/internal/Magento/Framework/View/Element/UiComponent/Config/DomMerger.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,12 @@
88
use Magento\Framework\Config\Dom;
99
use Magento\Framework\Config\ValidationStateInterface;
1010

11-
/**
12-
* Class DomMerger
13-
*/
1411
class DomMerger implements DomMergerInterface
1512
{
1613
/**
1714
* Format of items in errors array to be used by default. Available placeholders - fields of \LibXMLError.
1815
*/
19-
const ERROR_FORMAT_DEFAULT = "Message: %message%\nLine: %line%\n";
16+
public const ERROR_FORMAT_DEFAULT = "Message: %message%\nLine: %line%\n";
2017

2118
/**
2219
* @var \Magento\Framework\Config\ValidationStateInterface
@@ -45,15 +42,11 @@ class DomMerger implements DomMergerInterface
4542
protected $idAttributes = [];
4643

4744
/**
48-
* Context XPath
49-
*
5045
* @var array
5146
*/
5247
protected $contextXPath = [];
5348

5449
/**
55-
* Is merge simple XML Element
56-
*
5750
* @var bool
5851
*/
5952
protected $isMergeSimpleXMLElement;
@@ -152,7 +145,7 @@ protected function mergeAttributes(\DOMElement $baseNode, \DOMNode $mergeNode)
152145
protected function createXPath(\DOMNode $node)
153146
{
154147
$parentXPath = '';
155-
$currentXPath = $node->getNodePath();
148+
$currentXPath = $node->getNodePath() ?? '';
156149
if ($node->parentNode !== null && !$node->isSameNode($node->parentNode)) {
157150
$parentXPath = $this->createXPath($node->parentNode);
158151
$pathParts = explode('/', $currentXPath);
@@ -187,6 +180,7 @@ protected function createXPath(\DOMNode $node)
187180
*
188181
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
189182
* @SuppressWarnings(PHPMD.NPathComplexity)
183+
* phpcs:disable Generic.Metrics.NestingLevel
190184
*/
191185
protected function nestedMerge(\DOMXPath $rootDomXPath, \DOMNodeList $insertedNodes, \DOMNode $contextNode)
192186
{
@@ -236,6 +230,7 @@ protected function nestedMerge(\DOMXPath $rootDomXPath, \DOMNodeList $insertedNo
236230
}
237231
}
238232
}
233+
// phpcs:enable Generic.Metrics.NestingLevel
239234

240235
/**
241236
* Append child node

lib/internal/Magento/Framework/View/FileSystem.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public function getEmailTemplateFileName($fileId, array $params, $module)
171171
*/
172172
public static function normalizePath($path)
173173
{
174-
$parts = explode('/', $path);
174+
$parts = $path !== null ? explode('/', $path) : [];
175175
$result = [];
176176

177177
foreach ($parts as $part) {

lib/internal/Magento/Framework/View/Layout/Data/Structure.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function createStructuralElement($name, $type, $class)
7777
*/
7878
protected function _generateAnonymousName($class)
7979
{
80-
$position = strpos($class, '\\Block\\');
80+
$position = $class !== null ? strpos($class, '\\Block\\') : '';
8181
$key = $position !== false ? substr($class, $position + 7) : $class;
8282
$key = strtolower(trim($key, '_'));
8383

0 commit comments

Comments
 (0)