@@ -42,7 +42,7 @@
if (is_dir('downloader')) {
header("Location: downloader");
} else {
- echo $mageFilename." was not found";
+ echo $mageFilename . " was not found";
}
exit;
}
@@ -55,10 +55,10 @@
umask(0);
/* Store or website code */
-$mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : '';
+$mageRunCode = $_SERVER['MAGE_RUN_CODE'] ?? '';
/* Run store or run website */
-$mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store';
+$mageRunType = $_SERVER['MAGE_RUN_TYPE'] ?? 'store';
if (file_exists($maintenanceFile)) {
$maintenanceBypass = false;
diff --git a/install.php b/install.php
index 9e46c7e9798..4cccd8b8c60 100644
--- a/install.php
+++ b/install.php
@@ -113,28 +113,27 @@
*
*/
-if (version_compare(phpversion(), '7.3.0', '<')===true) {
+if (version_compare(phpversion(), '7.3.0', '<') === true) {
die('ERROR: Whoops, it looks like you have an invalid PHP version. OpenMage supports PHP 7.3.0 or newer.');
}
set_include_path(__DIR__ . PATH_SEPARATOR . get_include_path());
require 'app/bootstrap.php';
require 'app/Mage.php';
-try {
- $app = Mage::app('default');
+$app = Mage::app('default');
- $installer = Mage::getSingleton('install/installer_console');
- /* @var $installer Mage_Install_Model_Installer_Console */
+/** @var Mage_Install_Model_Installer_Console $installer */
+$installer = Mage::getSingleton('install/installer_console');
+try {
if ($installer->init($app) // initialize installer
&& $installer->checkConsole() // check if the script is run in shell, otherwise redirect to web-installer
&& $installer->setArgs() // set and validate script arguments
- && $installer->install()) // do install
- {
+ && $installer->install() // do install
+ ) {
echo 'SUCCESS: ' . $installer->getEncryptionKey() . "\n";
exit;
}
-
} catch (Exception $e) {
Mage::printException($e);
}
diff --git a/lib/Mage/Archive/Helper/File.php b/lib/Mage/Archive/Helper/File.php
index 09d3a27f5fa..8035bc8b7cd 100644
--- a/lib/Mage/Archive/Helper/File.php
+++ b/lib/Mage/Archive/Helper/File.php
@@ -72,8 +72,8 @@ public function __construct($filePath)
$pathInfo = pathinfo($filePath);
$this->_filePath = $filePath;
- $this->_fileLocation = isset($pathInfo['dirname']) ? $pathInfo['dirname'] : '';
- $this->_fileName = isset($pathInfo['basename']) ? $pathInfo['basename'] : '';
+ $this->_fileLocation = $pathInfo['dirname'] ?? '';
+ $this->_fileName = $pathInfo['basename'] ?? '';
}
/**
diff --git a/lib/Magento/Db/Adapter/Pdo/Mysql.php b/lib/Magento/Db/Adapter/Pdo/Mysql.php
index fed8d782238..b6c0dd238d4 100644
--- a/lib/Magento/Db/Adapter/Pdo/Mysql.php
+++ b/lib/Magento/Db/Adapter/Pdo/Mysql.php
@@ -131,9 +131,10 @@ public function quote($value, $type = null)
{
$this->_connect();
- if ($type !== null &&
- array_key_exists($type = strtoupper($type), $this->_numericDataTypes) &&
- $this->_numericDataTypes[$type] == Zend_Db::FLOAT_TYPE) {
+ if ($type !== null
+ && rray_key_exists($type = strtoupper($type), $this->_numericDataTypes)
+ && $this->_numericDataTypes[$type] == Zend_Db::FLOAT_TYPE
+ ) {
$value = $this->_convertFloat($value);
$quoteValue = sprintf('%F', $value);
return $quoteValue;
diff --git a/lib/Varien/Data/Collection/Filesystem.php b/lib/Varien/Data/Collection/Filesystem.php
index b9c65807b1f..5165c0fa6a9 100644
--- a/lib/Varien/Data/Collection/Filesystem.php
+++ b/lib/Varien/Data/Collection/Filesystem.php
@@ -250,7 +250,8 @@ protected function _collectRecursive($dir)
}
} elseif ($this->_collectFiles && is_file($item)
&& (!$this->_allowedFilesMask || preg_match($this->_allowedFilesMask, basename($item)))
- && (!$this->_disallowedFilesMask || !preg_match($this->_disallowedFilesMask, basename($item)))) {
+ && (!$this->_disallowedFilesMask || !preg_match($this->_disallowedFilesMask, basename($item)))
+ ) {
$this->_collectedFiles[] = $item;
}
}
diff --git a/lib/Varien/Data/Tree/Db.php b/lib/Varien/Data/Tree/Db.php
index e8f1e696437..1e2480d2e35 100644
--- a/lib/Varien/Data/Tree/Db.php
+++ b/lib/Varien/Data/Tree/Db.php
@@ -92,10 +92,11 @@ public function __construct($connection, $table, $fields)
$this->_conn = $connection;
$this->_table = $table;
- if (!isset($fields[self::ID_FIELD]) ||
- !isset($fields[self::PARENT_FIELD]) ||
- !isset($fields[self::LEVEL_FIELD]) ||
- !isset($fields[self::ORDER_FIELD])) {
+ if (!isset($fields[self::ID_FIELD])
+ || !isset($fields[self::PARENT_FIELD])
+ || !isset($fields[self::LEVEL_FIELD])
+ || !isset($fields[self::ORDER_FIELD])
+ ) {
throw new Exception('"$fields" tree configuratin array');
}
diff --git a/lib/Varien/Data/Tree/Dbp.php b/lib/Varien/Data/Tree/Dbp.php
index 898dd182553..b36a5b14e7e 100644
--- a/lib/Varien/Data/Tree/Dbp.php
+++ b/lib/Varien/Data/Tree/Dbp.php
@@ -94,10 +94,11 @@ public function __construct($connection, $table, $fields)
$this->_conn = $connection;
$this->_table = $table;
- if (!isset($fields[self::ID_FIELD]) ||
- !isset($fields[self::PATH_FIELD]) ||
- !isset($fields[self::LEVEL_FIELD]) ||
- !isset($fields[self::ORDER_FIELD])) {
+ if (!isset($fields[self::ID_FIELD])
+ || !isset($fields[self::PATH_FIELD])
+ || !isset($fields[self::LEVEL_FIELD])
+ || !isset($fields[self::ORDER_FIELD])
+ ) {
throw new Exception('"$fields" tree configuratin array');
}
diff --git a/lib/Varien/Db/Adapter/Pdo/Mysql.php b/lib/Varien/Db/Adapter/Pdo/Mysql.php
index a67c27600eb..97bbcd37850 100644
--- a/lib/Varien/Db/Adapter/Pdo/Mysql.php
+++ b/lib/Varien/Db/Adapter/Pdo/Mysql.php
@@ -314,24 +314,14 @@ protected function _getHostInfo($hostName)
if (strpos($hostName, '/') !== false) {
$hostInfo->setAddressType(self::ADDRESS_TYPE_UNIX_SOCKET)
->setUnixSocket($hostName);
- } elseif (preg_match(
- '/^\[(([0-9a-f]{1,4})?(:([0-9a-f]{1,4})?){1,}:([0-9a-f]{1,4}))(%[0-9a-z]+)?\](:([0-9]+))?$/i',
- $hostName,
- $matches
- )
- ) {
- $hostName = isset($matches[1]) ? $matches[1] : null;
+ } elseif (preg_match('/^\[(([0-9a-f]{1,4})?(:([0-9a-f]{1,4})?){1,}:([0-9a-f]{1,4}))(%[0-9a-z]+)?\](:([0-9]+))?$/i', $hostName, $matches)) {
+ $hostName = $matches[1] ?? null;
!is_null($hostName) && isset($matches[6]) && ($hostName .= $matches[6]);
$hostInfo->setAddressType(self::ADDRESS_TYPE_IPV6_ADDRESS)
->setHostName($hostName)
- ->setPort(isset($matches[8]) ? $matches[8] : null);
- } elseif (preg_match(
- '/^(([0-9a-f]{1,4})?(:([0-9a-f]{1,4})?){1,}:([0-9a-f]{1,4}))(%[0-9a-z]+)?$/i',
- $hostName,
- $matches
- )
- ) {
- $hostName = isset($matches[1]) ? $matches[1] : null;
+ ->setPort($matches[8] ?? null);
+ } elseif (preg_match('/^(([0-9a-f]{1,4})?(:([0-9a-f]{1,4})?){1,}:([0-9a-f]{1,4}))(%[0-9a-z]+)?$/i', $hostName, $matches)) {
+ $hostName = $matches[1] ?? null;
!is_null($hostName) && isset($matches[6]) && ($hostName .= $matches[6]);
$hostInfo->setAddressType(self::ADDRESS_TYPE_IPV6_ADDRESS)
->setHostName($hostName);
@@ -369,7 +359,7 @@ protected function _connect()
throw new Zend_Db_Adapter_Exception('pdo_mysql extension is not installed');
}
- $hostInfo = $this->_getHostInfo(isset($this->_config['host']) ? $this->_config['host'] : (isset($this->_config['unix_socket']) ? $this->_config['unix_socket'] : null));
+ $hostInfo = $this->_getHostInfo($this->_config['host'] ?? $this->_config['unix_socket'] ?? null);
switch ($hostInfo->getAddressType()) {
case self::ADDRESS_TYPE_UNIX_SOCKET:
@@ -462,7 +452,7 @@ public function raw_fetchRow($sql, $field = null)
if (empty($field)) {
return $row;
} else {
- return isset($row[$field]) ? $row[$field] : false;
+ return $row[$field] ?? false;
}
}
@@ -572,11 +562,12 @@ protected function _prepareQuery(&$sql, &$bind = [])
*/
public function proccessBindCallback($matches)
{
- if (isset($matches[6]) && (
- strpos($matches[6], "'") !== false ||
- strpos($matches[6], ':') !== false ||
- strpos($matches[6], '?') !== false
- )
+ if (isset($matches[6])
+ && (
+ strpos($matches[6], "'") !== false
+ || strpos($matches[6], ':') !== false
+ || strpos($matches[6], '?') !== false
+ )
) {
$bindName = ':_mage_bind_var_' . (++$this->_bindIncrement);
$this->_bindParams[$bindName] = $this->_unQuote($matches[6]);
@@ -1194,7 +1185,7 @@ public function getForeignKeys($tableName, $schemaName = null)
'SCHEMA_NAME' => $schemaName,
'TABLE_NAME' => $tableName,
'COLUMN_NAME' => $match[2],
- 'REF_SHEMA_NAME' => isset($match[3]) ? $match[3] : $schemaName,
+ 'REF_SHEMA_NAME' => $match[3] ?? $schemaName,
'REF_TABLE_NAME' => $match[4],
'REF_COLUMN_NAME' => $match[5],
'ON_DELETE' => isset($match[6]) ? $match[7] : '',
@@ -1268,7 +1259,8 @@ public function modifyTables($tables)
$onUpdate = $options['ON_UPDATE'];
if ($onDelete == Varien_Db_Adapter_Interface::FK_ACTION_SET_NULL
- || $onUpdate == Varien_Db_Adapter_Interface::FK_ACTION_SET_NULL) {
+ || $onUpdate == Varien_Db_Adapter_Interface::FK_ACTION_SET_NULL
+ ) {
$columnDefinition['nullable'] = true;
}
$this->modifyColumn($options['TABLE_NAME'], $options['COLUMN_NAME'], $columnDefinition);
diff --git a/lib/Varien/Db/Select.php b/lib/Varien/Db/Select.php
index 6c3dd797586..a1f65b26c2e 100644
--- a/lib/Varien/Db/Select.php
+++ b/lib/Varien/Db/Select.php
@@ -133,7 +133,8 @@ public function resetJoinLeft()
list($correlationName, $column) = $columnEntry;
if ($column instanceof Zend_Db_Expr) {
if ($this->_findTableInCond($tableId, $column)
- || $this->_findTableInCond($tableProp['tableName'], $column)) {
+ || $this->_findTableInCond($tableProp['tableName'], $column)
+ ) {
$useJoin = true;
}
} else {
@@ -144,7 +145,8 @@ public function resetJoinLeft()
}
foreach ($this->_parts[self::WHERE] as $where) {
if ($this->_findTableInCond($tableId, $where)
- || $this->_findTableInCond($tableProp['tableName'], $where)) {
+ || $this->_findTableInCond($tableProp['tableName'], $where)
+ ) {
$useJoin = true;
}
}
@@ -158,7 +160,8 @@ public function resetJoinLeft()
}
if (!empty($table['joinCondition'])) {
if ($this->_findTableInCond($tableId, $table['joinCondition'])
- || $this->_findTableInCond($tableProp['tableName'], $table['joinCondition'])) {
+ || $this->_findTableInCond($tableProp['tableName'], $table['joinCondition'])
+ ) {
$useJoin = true;
$joinInTables[] = $tableCorrelationName;
}
diff --git a/lib/Varien/File/Csv.php b/lib/Varien/File/Csv.php
index 0baf9101a73..c9c52df303e 100644
--- a/lib/Varien/File/Csv.php
+++ b/lib/Varien/File/Csv.php
@@ -137,7 +137,8 @@ public function fputcsv(&$handle, $fields = [], $delimiter = ',', $enclosure = '
strpos($value, "\n") !== false ||
strpos($value, "\r") !== false ||
strpos($value, "\t") !== false ||
- strpos($value, ' ') !== false) {
+ strpos($value, ' ') !== false
+ ) {
$str2 = $enclosure;
$escaped = 0;
$len = strlen($value);
diff --git a/lib/Varien/Filter/Template.php b/lib/Varien/Filter/Template.php
index 6cba49cb4e1..d0d0800ef34 100644
--- a/lib/Varien/Filter/Template.php
+++ b/lib/Varien/Filter/Template.php
@@ -126,10 +126,11 @@ public function getIncludeProcessor()
public function filter($value)
{
// "depend" and "if" operands should be first
- foreach ([
+ $directives = [
self::CONSTRUCTION_DEPEND_PATTERN => 'dependDirective',
self::CONSTRUCTION_IF_PATTERN => 'ifDirective',
- ] as $pattern => $directive) {
+ ];
+ foreach ($directives as $pattern => $directive) {
if (preg_match_all($pattern, $value, $constructions, PREG_SET_ORDER)) {
foreach ($constructions as $index => $construction) {
$replacedValue = '';