diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml
new file mode 100644
index 000000000..09e22309d
--- /dev/null
+++ b/.github/workflows/php-cs-fixer.yml
@@ -0,0 +1,39 @@
+name: PHP-CS-Fixer
+
+on:
+ push:
+ pull_request:
+ workflow_call:
+ # Allow manually triggering the workflow.
+ workflow_dispatch:
+
+jobs:
+ php-cs-fixer:
+ name: Validation
+ runs-on: [ubuntu-latest]
+
+ steps:
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: 7.4
+
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Get composer cache directory
+ id: composer-cache
+ run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
+
+ - name: Cache dependencies
+ uses: actions/cache@v4
+ with:
+ path: ${{ steps.composer-cache.outputs.dir }}
+ key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
+ restore-keys: ${{ runner.os }}-composer-
+
+ - name: Install dependencies
+ run: composer install --prefer-dist --no-progress --ignore-platform-req=ext-*
+
+ - name: PHP-CS-Fixer
+ run: php vendor/bin/php-cs-fixer fix --diff --dry-run
diff --git a/.gitignore b/.gitignore
index a90f6a2bb..296fb2e3a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,6 @@ act.secrets
# phpDocumentor
/docs/
+
+# php-cs-fixer cache
+/.php-cs-fixer.cache
\ No newline at end of file
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
new file mode 100644
index 000000000..47e046ab1
--- /dev/null
+++ b/.php-cs-fixer.dist.php
@@ -0,0 +1,17 @@
+in('.');
+
+return (new Config())
+ ->setRiskyAllowed(true)
+ ->setFinder($finder)
+ ->setRules([
+ 'array_syntax' => ['syntax' => 'short'],
+ 'modernize_types_casting' => true,
+ 'logical_operators' => true,
+ 'single_quote' => true,
+ ]);
diff --git a/build/bin/files.php b/build/bin/files.php
index 991f0b6a9..29c2dd5b5 100755
--- a/build/bin/files.php
+++ b/build/bin/files.php
@@ -23,7 +23,7 @@
}
$basename = $basename ?: 'n98-magerun';
-$urls = strtr($urls, array('%basename%' => $basename));
+$urls = strtr($urls, ['%basename%' => $basename]);
$urlHeaders = function ($url) {
return function ($name = null) use ($url) {
@@ -45,9 +45,9 @@
$box = function ($title) {
$len = strlen($title);
- $buffer = str_repeat("=", $len + 4);
+ $buffer = str_repeat('=', $len + 4);
$buffer .= "\n= $title =\n";
- $buffer .= str_repeat("=", $len + 4);
+ $buffer .= str_repeat('=', $len + 4);
return $buffer . "\n";
};
@@ -60,7 +60,7 @@
$main = function ($urls) use ($urlHeaders, $box, $bytes) {
foreach ($urls as $url) {
- $title = sprintf("%s: %s", $url->channel, $url->url);
+ $title = sprintf('%s: %s', $url->channel, $url->url);
echo $box($title);
$headers = $urlHeaders($url->url);
@@ -71,7 +71,7 @@
echo "\n";
}
- echo $box("Verify Phar-Files Versions");
+ echo $box('Verify Phar-Files Versions');
foreach ($urls as $url) {
$tempFile = '.magerun-phar.~dl-temp-' . md5($url->url);
diff --git a/build/phar/_cli_stub.php b/build/phar/_cli_stub.php
index 520ec7e8a..d84751eb1 100644
--- a/build/phar/_cli_stub.php
+++ b/build/phar/_cli_stub.php
@@ -7,12 +7,12 @@
$suhosin = ini_get('suhosin.executor.include.whitelist');
$suhosinBlacklist = ini_get('suhosin.executor.include.blacklist');
if (false === stripos($suhosin, 'phar') && (!$suhosinBlacklist || false !== stripos($suhosinBlacklist, 'phar'))) {
- fwrite(STDERR, implode(PHP_EOL, array(
+ fwrite(STDERR, implode(PHP_EOL, [
'The suhosin.executor.include.whitelist setting is incorrect.',
'Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):',
' suhosin.executor.include.whitelist = phar '.$suhosin,
''
- )));
+ ]));
exit(1);
}
}
diff --git a/build/phar/phar-timestamp.php b/build/phar/phar-timestamp.php
index 0af0a6fa2..b52b26280 100644
--- a/build/phar/phar-timestamp.php
+++ b/build/phar/phar-timestamp.php
@@ -55,7 +55,7 @@
$timestamps->updateTimestamps($timestamp);
$timestamps->save($pharFilepath, Phar::SHA512);
-echo "SHA1.....: ", sha1_file($pharFilepath), "\nMD5......: ", md5_file($pharFilepath), "\n";
+echo 'SHA1.....: ', sha1_file($pharFilepath), "\nMD5......: ", md5_file($pharFilepath), "\n";
if (!unlink($tmp)) {
throw new RuntimeException('Error deleting tempfile %s', var_export($tmp, true));
diff --git a/build/phar/tasks/PatchedPharPackageTask.php b/build/phar/tasks/PatchedPharPackageTask.php
index a5571f9d3..8c114f712 100644
--- a/build/phar/tasks/PatchedPharPackageTask.php
+++ b/build/phar/tasks/PatchedPharPackageTask.php
@@ -73,7 +73,7 @@ class PatchedPharPackageTask
/**
* @var array
*/
- private $filesets = array();
+ private $filesets = [];
/**
* @var PharMetadata
@@ -167,13 +167,13 @@ private function getCompressionLabel()
switch ($compression) {
case Phar::GZ:
- return "gzip";
+ return 'gzip';
case Phar::BZ2:
- return "bzip2";
+ return 'bzip2';
default:
- return sprintf("int(%d)", $compression);
+ return sprintf('int(%d)', $compression);
}
}
@@ -302,15 +302,15 @@ private function checkPreconditions()
}
if (is_null($this->destinationFile)) {
- throw new BuildException("destfile attribute must be set!", $this->getLocation());
+ throw new BuildException('destfile attribute must be set!', $this->getLocation());
}
if ($this->destinationFile->exists() && $this->destinationFile->isDirectory()) {
- throw new BuildException("destfile is a directory!", $this->getLocation());
+ throw new BuildException('destfile is a directory!', $this->getLocation());
}
if (!$this->destinationFile->canWrite()) {
- throw new BuildException("Can not write to the specified destfile!", $this->getLocation());
+ throw new BuildException('Can not write to the specified destfile!', $this->getLocation());
}
if (!is_null($this->baseDirectory)) {
if (!$this->baseDirectory->exists()) {
@@ -323,12 +323,12 @@ private function checkPreconditions()
if (!extension_loaded('openssl')) {
throw new BuildException(
- "PHP OpenSSL extension is required for OpenSSL signing of Phars!", $this->getLocation()
+ 'PHP OpenSSL extension is required for OpenSSL signing of Phars!', $this->getLocation()
);
}
if (is_null($this->key)) {
- throw new BuildException("key attribute must be set for OpenSSL signing!", $this->getLocation());
+ throw new BuildException('key attribute must be set for OpenSSL signing!', $this->getLocation());
}
if (!$this->key->exists()) {
@@ -436,7 +436,7 @@ private function compressEachFile(Phar $phar, $baseDirectory)
if (Phar::NONE != $this->compression) {
foreach ($sortedFiles as $file) {
$localName = substr($file, strlen($baseDirectory) + 1);
- $this->log($localName . "... ", Project::MSG_VERBOSE);
+ $this->log($localName . '... ', Project::MSG_VERBOSE);
$phar->addFile($file, $localName);
$phar[$localName]->compress($this->compression);
}
@@ -461,7 +461,7 @@ private function compressAllFiles(Phar $phar, $baseDirectory)
foreach ($this->filesets as $fileset) {
/* @var $fileset IterableFileSet */
$dir = $fileset->getDir($this->project);
- $msg = sprintf("Fileset %s ...", $dir);
+ $msg = sprintf('Fileset %s ...', $dir);
$this->log($msg, Project::MSG_VERBOSE);
$added = $phar->buildFromIterator($this->getSortedFilesFromFileSet($fileset), $baseDirectory);
$total += count($added);
@@ -473,14 +473,14 @@ private function compressAllFiles(Phar $phar, $baseDirectory)
return;
}
- $msg = sprintf("Compressing %d files (compression: %s) ... ", $total, $this->getCompressionLabel());
+ $msg = sprintf('Compressing %d files (compression: %s) ... ', $total, $this->getCompressionLabel());
$this->log($msg, Project::MSG_VERBOSE);
// safeguard open files soft limit
if (function_exists('posix_getrlimit')) {
$rlimit = posix_getrlimit();
if ($rlimit['soft openfiles'] < ($total + 5)) {
- $msg = sprintf("Limit of openfiles (%d) is too low.", $rlimit['soft openfiles']);
+ $msg = sprintf('Limit of openfiles (%d) is too low.', $rlimit['soft openfiles']);
$this->log($msg, Project::MSG_VERBOSE);
}
}
@@ -490,7 +490,7 @@ private function compressAllFiles(Phar $phar, $baseDirectory)
$phar->compressFiles($this->compression);
} catch (BadMethodCallException $e) {
if ($e->getMessage() === 'unable to create temporary file') {
- $msg = sprintf("Info: Check openfiles limit it must be %d or higher", $total + 5);
+ $msg = sprintf('Info: Check openfiles limit it must be %d or higher', $total + 5);
throw new BadMethodCallException($msg, 0, $e);
}
throw $e;
@@ -507,7 +507,7 @@ private function getSortedFilesFromFileSet(IterableFileSet $fileset)
{
$files = iterator_to_array($fileset, true);
$keys = array_keys($files);
- usort($files, array($this, 'sortFilesCallback'));
+ usort($files, [$this, 'sortFilesCallback']);
$array = array_combine($keys, $files);
return new ArrayIterator($array);
diff --git a/res/dev/console_auto_prepend.php b/res/dev/console_auto_prepend.php
index 4e0f6532d..ab286faea 100644
--- a/res/dev/console_auto_prepend.php
+++ b/res/dev/console_auto_prepend.php
@@ -11,5 +11,5 @@
WELCOME;
echo PHP_EOL . PHP_EOL . 'Initialized Magento (' . \Mage::getVersion() . ')' . PHP_EOL . PHP_EOL;
} else {
- echo "FATAL: Magento could not be initialized." . PHP_EOL;
+ echo 'FATAL: Magento could not be initialized.' . PHP_EOL;
}
diff --git a/src/N98/Magento/Application.php b/src/N98/Magento/Application.php
index c9053c7f5..61ca0e46d 100644
--- a/src/N98/Magento/Application.php
+++ b/src/N98/Magento/Application.php
@@ -444,7 +444,7 @@ public function checkVarDir(OutputInterface $output)
'can cause serious problems.', 'Please refer to https://github.com/netz98/n98-magerun/wiki/File-system-permissions ' .
'for more information.', '']);
} else {
- $output->writeln([sprintf('Folder %s found, but not used in n98-magerun', $tempVarDir), '', "This might cause serious problems. n98-magerun is using the configured var-folder " .
+ $output->writeln([sprintf('Folder %s found, but not used in n98-magerun', $tempVarDir), '', 'This might cause serious problems. n98-magerun is using the configured var-folder ' .
"$currentVarDir", 'Please refer to https://github.com/netz98/n98-magerun/wiki/File-system-permissions ' .
'for more information.', '']);
diff --git a/src/N98/Magento/Application/Config.php b/src/N98/Magento/Application/Config.php
index 1c1972668..9e2e5a25c 100644
--- a/src/N98/Magento/Application/Config.php
+++ b/src/N98/Magento/Application/Config.php
@@ -215,13 +215,13 @@ public function registerCustomAutoloaders(ClassLoader $autoloader)
foreach ($this->getArray('autoloaders') as $prefix => $paths) {
$paths = (array) $paths;
- $this->debugWriteln(sprintf($mask, self::PSR_0, OutputFormatter::escape($prefix), implode(",", $paths)));
+ $this->debugWriteln(sprintf($mask, self::PSR_0, OutputFormatter::escape($prefix), implode(',', $paths)));
$autoloader->add($prefix, $paths);
}
foreach ($this->getArray('autoloaders_psr4') as $prefix => $paths) {
$paths = (array) $paths;
- $this->debugWriteln(sprintf($mask, self::PSR_4, OutputFormatter::escape($prefix), implode(",", $paths)));
+ $this->debugWriteln(sprintf($mask, self::PSR_4, OutputFormatter::escape($prefix), implode(',', $paths)));
$autoloader->addPsr4($prefix, $paths);
}
}
diff --git a/src/N98/Magento/Command/Category/Create/DummyCommand.php b/src/N98/Magento/Command/Category/Create/DummyCommand.php
index 669fef306..029a7dc2a 100644
--- a/src/N98/Magento/Command/Category/Create/DummyCommand.php
+++ b/src/N98/Magento/Command/Category/Create/DummyCommand.php
@@ -19,7 +19,7 @@
*/
class DummyCommand extends AbstractMagentoCommand
{
- public const DEFAULT_CATEGORY_NAME = "My Awesome Category";
+ public const DEFAULT_CATEGORY_NAME = 'My Awesome Category';
public const DEFAULT_CATEGORY_STATUS = 1; // enabled
public const DEFAULT_CATEGORY_ANCHOR = 1; // enabled
public const DEFAULT_STORE_ID = 1; // Default Store ID
@@ -54,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->detectMagento($output, true);
$this->initMagento();
- $output->writeln("This only create sample categories, do not use on production environment");
+ $output->writeln('This only create sample categories, do not use on production environment');
// Ask for Arguments
$_argument = $this->askForArguments($input, $output);
@@ -64,9 +64,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
*/
for ($i = 0; $i < $_argument['category-number']; $i++) {
if (!is_null($_argument['category-name-prefix'])) {
- $name = $_argument['category-name-prefix'] . " " . $i;
+ $name = $_argument['category-name-prefix'] . ' ' . $i;
} else {
- $name = self::DEFAULT_CATEGORY_NAME . " " . $i;
+ $name = self::DEFAULT_CATEGORY_NAME . ' ' . $i;
}
// Check if product exists
@@ -104,7 +104,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
// Create children Categories
for ($j = 0; $j < $_argument['children-categories-number']; $j++) {
- $name_child = $name . " child " . $j;
+ $name_child = $name . ' child ' . $j;
/* @var Mage_Catalog_Model_Category $category */
$category = Mage::getModel('catalog/category');
@@ -149,20 +149,20 @@ private function askForArguments($input, $output)
$_store_ids = [];
foreach ($store_id as $item) {
- $_store_ids[$item['store_id']] = $item['store_id'] . "|" . $item['code'];
+ $_store_ids[$item['store_id']] = $item['store_id'] . '|' . $item['code'];
}
$question = new ChoiceQuestion('Please select Store ID (default: 1)', $_store_ids, self::DEFAULT_STORE_ID);
$question->setErrorMessage('Store ID "%s" is invalid.');
- $response = explode("|", $dialog->ask($input, $output, $question));
+ $response = explode('|', $dialog->ask($input, $output, $question));
$input->setArgument('store-id', $response[0]);
}
- $output->writeln('Store ID selected: ' . $input->getArgument('store-id') . "");
+ $output->writeln('Store ID selected: ' . $input->getArgument('store-id') . '');
$_argument['store-id'] = $input->getArgument('store-id');
// Number of Categories
if (is_null($input->getArgument('category-number'))) {
- $question = new Question("Please enter the number of categories to create (default 1): ", 1);
+ $question = new Question('Please enter the number of categories to create (default 1): ', 1);
$question->setValidator(function ($answer) {
$answer = (int) $answer;
if (!is_int($answer) || $answer <= 0) {
@@ -174,7 +174,7 @@ private function askForArguments($input, $output)
$input->setArgument('category-number', $dialog->ask($input, $output, $question));
}
$output->writeln(
- 'Number of categories to create: ' . $input->getArgument('category-number') . ""
+ 'Number of categories to create: ' . $input->getArgument('category-number') . ''
);
$_argument['category-number'] = $input->getArgument('category-number');
@@ -187,7 +187,7 @@ private function askForArguments($input, $output)
$question->setValidator(function ($answer) {
$answer = (int) $answer;
if (!is_int($answer) || $answer < -1) {
- throw new RuntimeException("Please enter an integer value or >= -1");
+ throw new RuntimeException('Please enter an integer value or >= -1');
}
return $answer;
@@ -200,7 +200,7 @@ private function askForArguments($input, $output)
$output->writeln(
'Number of categories children to create: ' . $input->getArgument('children-categories-number') .
- ""
+ ''
);
$_argument['children-categories-number'] = $input->getArgument('children-categories-number');
@@ -212,7 +212,7 @@ private function askForArguments($input, $output)
);
$input->setArgument('category-name-prefix', $dialog->ask($input, $output, $question));
}
- $output->writeln('CATEGORY NAME PREFIX: ' . $input->getArgument('category-name-prefix') . "");
+ $output->writeln('CATEGORY NAME PREFIX: ' . $input->getArgument('category-name-prefix') . '');
$_argument['category-name-prefix'] = $input->getArgument('category-name-prefix');
return $_argument;
@@ -226,7 +226,7 @@ private function askForArguments($input, $output)
*/
private function setCategoryStoreId(Mage_Catalog_Model_Category $category, $storeId)
{
- if (Mage::getVersion() === "1.5.1.0") {
+ if (Mage::getVersion() === '1.5.1.0') {
$category->setStoreId([0, $storeId]);
} else {
$category->setStoreId($storeId);
diff --git a/src/N98/Magento/Command/Config/AbstractConfigCommand.php b/src/N98/Magento/Command/Config/AbstractConfigCommand.php
index 1a11d929d..941b63e99 100644
--- a/src/N98/Magento/Command/Config/AbstractConfigCommand.php
+++ b/src/N98/Magento/Command/Config/AbstractConfigCommand.php
@@ -13,7 +13,7 @@
*/
abstract class AbstractConfigCommand extends AbstractMagentoCommand
{
- public const DISPLAY_NULL_UNKNOWN_VALUE = "NULL (NULL/\"unknown\" value)";
+ public const DISPLAY_NULL_UNKNOWN_VALUE = 'NULL (NULL/"unknown" value)';
/**
* @var array strings of configuration scopes
@@ -87,7 +87,7 @@ protected function _validateScopeParam($scope)
protected function _convertScopeIdParam($scope, $scopeId, $allowZeroScope = false)
{
if ($scope === 'default') {
- if ("$scopeId" !== "0") {
+ if ("$scopeId" !== '0') {
throw new InvalidArgumentException(
sprintf("Invalid scope ID %d in scope '%s', must be 0", $scopeId, $scope)
);
@@ -120,13 +120,13 @@ protected function _convertScopeIdParam($scope, $scopeId, $allowZeroScope = fals
$this->invalidScopeId(
(string) $scopeId !== (string) (int) $scopeId,
- "Invalid scope parameter, %s is not an integer value",
+ 'Invalid scope parameter, %s is not an integer value',
$scopeId
);
$this->invalidScopeId(
0 - (bool) $allowZeroScope >= (int) $scopeId,
- "Invalid scope parameter, %s is not a positive integer value",
+ 'Invalid scope parameter, %s is not a positive integer value',
$scopeId
);
diff --git a/src/N98/Magento/Command/Config/GetCommand.php b/src/N98/Magento/Command/Config/GetCommand.php
index d10cba8c8..84083d8d8 100644
--- a/src/N98/Magento/Command/Config/GetCommand.php
+++ b/src/N98/Magento/Command/Config/GetCommand.php
@@ -159,7 +159,7 @@ private function renderTableValue($value, $format)
break;
default:
throw new UnexpectedValueException(
- sprintf("Unhandled format %s", var_export($value, true))
+ sprintf('Unhandled format %s', var_export($value, true))
);
}
}
@@ -212,8 +212,8 @@ protected function renderAsMagerunScript(OutputInterface $output, $table)
$value = str_replace(["\n", "\r"], ['\n', '\r'], $value);
}
- $disaplayValue = $value === null ? "NULL" : escapeshellarg($value);
- $protectNullString = $value === "NULL" ? '--no-null ' : '';
+ $disaplayValue = $value === null ? 'NULL' : escapeshellarg($value);
+ $protectNullString = $value === 'NULL' ? '--no-null ' : '';
$line = sprintf(
'config:set %s--scope-id=%s --scope=%s -- %s %s',
diff --git a/src/N98/Magento/Command/Config/SetCommand.php b/src/N98/Magento/Command/Config/SetCommand.php
index 8a3c28131..29ce823b7 100644
--- a/src/N98/Magento/Command/Config/SetCommand.php
+++ b/src/N98/Magento/Command/Config/SetCommand.php
@@ -43,10 +43,10 @@ protected function configure()
'Allow creation of non-standard scope-id\'s for websites and stores'
)
->addOption(
- "no-null",
+ 'no-null',
null,
InputOption::VALUE_NONE,
- "Do not treat value NULL as " . self::DISPLAY_NULL_UNKNOWN_VALUE . " value"
+ 'Do not treat value NULL as ' . self::DISPLAY_NULL_UNKNOWN_VALUE . ' value'
)
;
}
@@ -89,9 +89,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$valueDisplay = $value = $input->getArgument('value');
- if ($value === "NULL" && !$input->getOption('no-null')) {
+ if ($value === 'NULL' && !$input->getOption('no-null')) {
if ($input->getOption('encrypt')) {
- throw new InvalidArgumentException("Encryption is not possbile for NULL values");
+ throw new InvalidArgumentException('Encryption is not possbile for NULL values');
}
$value = null;
$valueDisplay = self::DISPLAY_NULL_UNKNOWN_VALUE;
@@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
);
$output->writeln(
- '' . $input->getArgument('path') . " => " . $valueDisplay .
+ '' . $input->getArgument('path') . ' => ' . $valueDisplay .
''
);
return 0;
diff --git a/src/N98/Magento/Command/Developer/ClassLookupCommand.php b/src/N98/Magento/Command/Developer/ClassLookupCommand.php
index bd2d4bbb5..8abec5a9b 100644
--- a/src/N98/Magento/Command/Developer/ClassLookupCommand.php
+++ b/src/N98/Magento/Command/Developer/ClassLookupCommand.php
@@ -51,8 +51,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$input->getArgument('name')
);
$output->writeln(
- ucfirst($input->getArgument('type')) . ' ' . $input->getArgument('name') . " " .
- "resolves to " . $resolved . ''
+ ucfirst($input->getArgument('type')) . ' ' . $input->getArgument('name') . ' ' .
+ 'resolves to ' . $resolved . ''
);
if (!class_exists('\\' . $resolved)) {
diff --git a/src/N98/Magento/Command/Developer/Code/Model/MethodCommand.php b/src/N98/Magento/Command/Developer/Code/Model/MethodCommand.php
index dc8d37a8b..af36000df 100644
--- a/src/N98/Magento/Command/Developer/Code/Model/MethodCommand.php
+++ b/src/N98/Magento/Command/Developer/Code/Model/MethodCommand.php
@@ -79,7 +79,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->checkClassFileName();
$this->initTableColumns();
$this->writeToClassFile();
- $this->_output->writeln("Wrote getter and setter @methods into file: " . $this->_fileName);
+ $this->_output->writeln('Wrote getter and setter @methods into file: ' . $this->_fileName);
return 0;
}
@@ -95,7 +95,7 @@ protected function writeToClassFile()
}
$written = file_put_contents($this->_fileName, implode('', $fileParts));
if (false === $written) {
- throw new RuntimeException("Cannot write to file: " . $this->_fileName);
+ throw new RuntimeException('Cannot write to file: ' . $this->_fileName);
}
}
diff --git a/src/N98/Magento/Command/Developer/EmailTemplate/UsageCommand.php b/src/N98/Magento/Command/Developer/EmailTemplate/UsageCommand.php
index 9a9bf4b8f..9e69760ef 100644
--- a/src/N98/Magento/Command/Developer/EmailTemplate/UsageCommand.php
+++ b/src/N98/Magento/Command/Developer/EmailTemplate/UsageCommand.php
@@ -46,7 +46,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
->setHeaders(['id', 'Name', 'Scope', 'Scope Id', Path::class])
->renderByFormat($output, $templates, $input->getOption('format'));
} else {
- $output->writeln("No transactional email templates stored in the database.");
+ $output->writeln('No transactional email templates stored in the database.');
}
return 0;
}
diff --git a/src/N98/Magento/Command/Developer/Ide/PhpStorm/MetaCommand.php b/src/N98/Magento/Command/Developer/Ide/PhpStorm/MetaCommand.php
index cbc991c6f..6038534f0 100644
--- a/src/N98/Magento/Command/Developer/Ide/PhpStorm/MetaCommand.php
+++ b/src/N98/Magento/Command/Developer/Ide/PhpStorm/MetaCommand.php
@@ -212,13 +212,13 @@ protected function getClassMapForGroup($group, OutputInterface $output)
if (empty($modelDefinition->resourceModel)) {
continue;
}
- $resourceModelNodePath = 'global/models/' . strval($modelDefinition->resourceModel);
+ $resourceModelNodePath = 'global/models/' . (string) ($modelDefinition->resourceModel);
$resourceModelConfig = Mage::getConfig()->getNode($resourceModelNodePath);
if ($resourceModelConfig) {
- $classPrefix = strval($resourceModelConfig->class);
+ $classPrefix = (string) ($resourceModelConfig->class);
}
} else {
- $classPrefix = strval($modelDefinition->class);
+ $classPrefix = (string) ($modelDefinition->class);
}
if (empty($classPrefix)) {
@@ -313,7 +313,7 @@ protected function writeToOutputOld(InputInterface $input, OutputInterface $outp
$map .= "\n";
foreach ($this->groupFactories as $group => $methods) {
foreach ($methods as $method) {
- $map .= " " . $method . "('') => [\n";
+ $map .= ' ' . $method . "('') => [\n";
foreach ($classMaps[$group] as $classPrefix => $class) {
if (preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $class)) {
$map .= " '$classPrefix' instanceof \\$class,\n";
@@ -356,7 +356,7 @@ protected function writeToOutputV2017(InputInterface $input, OutputInterface $ou
foreach ($this->groupFactories as $group => $methods) {
$map = $baseMap;
foreach ($methods as $method) {
- $map .= " " . $method . "('') => [\n";
+ $map .= ' ' . $method . "('') => [\n";
asort($classMaps[$group]);
foreach ($classMaps[$group] as $classPrefix => $class) {
if (preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $class)) {
@@ -400,7 +400,7 @@ protected function writeToOutputV2017(InputInterface $input, OutputInterface $ou
foreach ($this->methodFactories as $group => $methods) {
$map = $baseMap;
foreach ($methods as $method) {
- $map .= " override( " . $method . "(0),\n";
+ $map .= ' override( ' . $method . "(0),\n";
$map .= " map( [\n";
asort($classMaps[$group]);
foreach ($classMaps[$group] as $classPrefix => $class) {
@@ -437,7 +437,7 @@ protected function writeToOutputV2019(InputInterface $input, OutputInterface $ou
foreach ($this->groupFactories as $group => $methods) {
$map = $baseMap;
foreach ($methods as $method) {
- $map .= " override( " . $method . "(0),\n";
+ $map .= ' override( ' . $method . "(0),\n";
$map .= " map( [\n";
asort($classMaps[$group]);
foreach ($classMaps[$group] as $classPrefix => $class) {
@@ -482,7 +482,7 @@ protected function writeToOutputV2019(InputInterface $input, OutputInterface $ou
foreach ($this->methodFactories as $group => $methods) {
$map = $baseMap;
foreach ($methods as $method) {
- $map .= " override( " . $method . "(0),\n";
+ $map .= ' override( ' . $method . "(0),\n";
$map .= " map( [\n";
asort($classMaps[$group]);
foreach ($classMaps[$group] as $classPrefix => $class) {
@@ -539,7 +539,7 @@ protected function getGroupXmlDefinition($group)
}
foreach ($this->missingHelperDefinitionModules as $moduleName) {
- $children = new Varien_Simplexml_Element(sprintf("<%s/>", strtolower($moduleName)));
+ $children = new Varien_Simplexml_Element(sprintf('<%s/>', strtolower($moduleName)));
$children->class = sprintf('Mage_%s_%s', $moduleName, $groupClassType);
$definitions->appendChild($children);
}
diff --git a/src/N98/Magento/Command/Developer/Log/DbCommand.php b/src/N98/Magento/Command/Developer/Log/DbCommand.php
index 51cce83ef..9601c0378 100644
--- a/src/N98/Magento/Command/Developer/Log/DbCommand.php
+++ b/src/N98/Magento/Command/Developer/Log/DbCommand.php
@@ -42,12 +42,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->detectMagento($output);
$this->initMagento();
- $output->writeln("Looking in " . $this->_getVarienAdapterPhpFile() . "");
+ $output->writeln('Looking in ' . $this->_getVarienAdapterPhpFile() . '');
$this->_replaceVariable($input, $output, '$_debug');
$this->_replaceVariable($input, $output, '$_logAllQueries');
- $output->writeln("Done. You can tail " . $this->_getDebugLogFilename() . "");
+ $output->writeln('Done. You can tail ' . $this->_getDebugLogFilename() . '');
return 0;
}
@@ -72,10 +72,10 @@ protected function _replaceVariable($input, $output, $variable)
$varienAdapterPhpFile = $this->_getVarienAdapterPhpFile();
$contents = file_get_contents($varienAdapterPhpFile);
- $debugLinePattern = "/protected\\s" . '\\' . $variable . "\\s*?=\\s(false|true)/m";
+ $debugLinePattern = '/protected\\s' . '\\' . $variable . '\\s*?=\\s(false|true)/m';
preg_match($debugLinePattern, $contents, $matches);
if (!isset($matches[1])) {
- throw new RuntimeException("Problem finding the \$_debug parameter");
+ throw new RuntimeException('Problem finding the $_debug parameter');
}
$currentValue = $matches[1];
@@ -88,10 +88,10 @@ protected function _replaceVariable($input, $output, $variable)
}
$output->writeln(
- "Changed " . $variable . " to " . $newValue . ""
+ 'Changed ' . $variable . ' to ' . $newValue . ''
);
- $contents = preg_replace($debugLinePattern, "protected " . $variable . " = " . $newValue, $contents);
+ $contents = preg_replace($debugLinePattern, 'protected ' . $variable . ' = ' . $newValue, $contents);
file_put_contents($varienAdapterPhpFile, $contents);
}
}
diff --git a/src/N98/Magento/Command/Developer/Module/Dependencies/FromCommand.php b/src/N98/Magento/Command/Developer/Module/Dependencies/FromCommand.php
index be0189dac..b49bba419 100644
--- a/src/N98/Magento/Command/Developer/Module/Dependencies/FromCommand.php
+++ b/src/N98/Magento/Command/Developer/Module/Dependencies/FromCommand.php
@@ -19,8 +19,8 @@ class FromCommand extends AbstractCommand
*/
public const COMMAND_NAME = 'dev:module:dependencies:from';
public const COMMAND_DESCRIPTION = 'Show list of modules which depend on %s module';
- public const COMMAND_SECTION_TITLE_TEXT = "List of modules which depend on %s module";
- public const COMMAND_NO_RESULTS_TEXT = "No modules depend on %s module";
+ public const COMMAND_SECTION_TITLE_TEXT = 'List of modules which depend on %s module';
+ public const COMMAND_NO_RESULTS_TEXT = 'No modules depend on %s module';
/**#@-*/
/**
@@ -33,7 +33,7 @@ protected function findModuleDependencies($moduleName, $recursive = false)
}
if (!isset($this->modules[$moduleName])) {
- throw new InvalidArgumentException(sprintf("Module %s was not found", $moduleName));
+ throw new InvalidArgumentException(sprintf('Module %s was not found', $moduleName));
}
$dependencies = [];
diff --git a/src/N98/Magento/Command/Developer/Module/Dependencies/OnCommand.php b/src/N98/Magento/Command/Developer/Module/Dependencies/OnCommand.php
index 2bcb34877..d602c9012 100644
--- a/src/N98/Magento/Command/Developer/Module/Dependencies/OnCommand.php
+++ b/src/N98/Magento/Command/Developer/Module/Dependencies/OnCommand.php
@@ -108,7 +108,7 @@ protected function findModuleDependencies($moduleName, $recursive = false)
return $dependencies;
} else {
- throw new InvalidArgumentException(sprintf("Module %s was not found", $moduleName));
+ throw new InvalidArgumentException(sprintf('Module %s was not found', $moduleName));
}
}
diff --git a/src/N98/Magento/Command/Developer/Module/ListCommand.php b/src/N98/Magento/Command/Developer/Module/ListCommand.php
index 0f58c6ba2..5fc4850ac 100644
--- a/src/N98/Magento/Command/Developer/Module/ListCommand.php
+++ b/src/N98/Magento/Command/Developer/Module/ListCommand.php
@@ -45,7 +45,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$modules = $this->filterModules($input);
if (!count($modules)) {
- $output->writeln("No modules match the specified criteria.");
+ $output->writeln('No modules match the specified criteria.');
return 0;
}
diff --git a/src/N98/Magento/Command/Developer/Module/UpdateCommand.php b/src/N98/Magento/Command/Developer/Module/UpdateCommand.php
index 2e24740e8..9a9dfafc1 100644
--- a/src/N98/Magento/Command/Developer/Module/UpdateCommand.php
+++ b/src/N98/Magento/Command/Developer/Module/UpdateCommand.php
@@ -990,10 +990,10 @@ protected function removeChildNodeIfNotNull($node, $child)
*/
protected function asPrettyXml($string)
{
- $string = preg_replace("/>\\s*", ">\n<", $string);
+ $string = preg_replace('/>\\s*', ">\n<", $string);
$xmlArray = explode("\n", $string);
$currIndent = 0;
- $indent = " ";
+ $indent = ' ';
$string = array_shift($xmlArray) . "\n";
foreach ($xmlArray as $element) {
if (preg_match('/^<([\w])+[^>\/]*>$/U', $element)) {
diff --git a/src/N98/Magento/Command/Developer/Translate/ExportCommand.php b/src/N98/Magento/Command/Developer/Translate/ExportCommand.php
index ae2a7bfe2..16d692328 100644
--- a/src/N98/Magento/Command/Developer/Translate/ExportCommand.php
+++ b/src/N98/Magento/Command/Developer/Translate/ExportCommand.php
@@ -53,7 +53,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('Exporting to ' . $filename . '');
$parameters = ['locale' => $locale];
- $sql = "SELECT * FROM core_translate WHERE locale = :locale";
+ $sql = 'SELECT * FROM core_translate WHERE locale = :locale';
if ($input->getOption('store')) {
$sql .= ' AND store_id = :store_id';
$parameters['store_id'] = Mage::app()->getStore($input->getOption('store'));
diff --git a/src/N98/Magento/Command/Eav/Attribute/Create/DummyCommand.php b/src/N98/Magento/Command/Eav/Attribute/Create/DummyCommand.php
index 8f432c769..d40689962 100644
--- a/src/N98/Magento/Command/Eav/Attribute/Create/DummyCommand.php
+++ b/src/N98/Magento/Command/Eav/Attribute/Create/DummyCommand.php
@@ -61,7 +61,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
$output->writeln(
- "This only create sample attribute values, do not use on production environment"
+ 'This only create sample attribute values, do not use on production environment'
);
// Ask for Arguments
@@ -73,7 +73,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$input->getArgument('locale')
)
);
- $argument['locale'] = "en_US";
+ $argument['locale'] = 'en_US';
} else {
$argument['locale'] = $input->getArgument('locale');
}
@@ -88,7 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$attribute->setData('option', ['value' => ['option' => [$value, $value]]]);
$attribute->save();
} catch (Exception $e) {
- $output->writeln("" . $e->getMessage() . "");
+ $output->writeln('' . $e->getMessage() . '');
}
$output->writeln("ATTRIBUTE VALUE: '" . $value . "' ADDED!\r");
}
@@ -120,15 +120,15 @@ private function askForArguments(InputInterface $input, OutputInterface $output)
$attribute_codes = [];
foreach ($attribute_code as $item) {
- $attribute_codes[$item['attribute_id']] = $item['attribute_id'] . "|" . $item['attribute_code'];
+ $attribute_codes[$item['attribute_id']] = $item['attribute_id'] . '|' . $item['attribute_code'];
}
$question = new ChoiceQuestion('Please select Attribute ID', $attribute_codes);
$question->setErrorMessage('Attribute ID "%s" is invalid.');
- $response = explode("|", $dialog->ask($input, $output, $question));
+ $response = explode('|', $dialog->ask($input, $output, $question));
$input->setArgument('attribute-id', $response[0]);
}
- $output->writeln('Attribute code selected: ' . $input->getArgument('attribute-id') . "");
+ $output->writeln('Attribute code selected: ' . $input->getArgument('attribute-id') . '');
$argument['attribute-id'] = (int) $input->getArgument('attribute-id');
// Type of Values
@@ -138,12 +138,12 @@ private function askForArguments(InputInterface $input, OutputInterface $output)
$question->setErrorMessage('Attribute Value Type "%s" is invalid.');
$input->setArgument('values-type', $dialog->ask($input, $output, $question));
}
- $output->writeln('Attribute Value Type selected: ' . $input->getArgument('values-type') . "");
+ $output->writeln('Attribute Value Type selected: ' . $input->getArgument('values-type') . '');
$argument['values-type'] = $input->getArgument('values-type');
// Number of Values
if (is_null($input->getArgument('values-number'))) {
- $question = new Question("Please enter the number of values to create (default 1): ", 1);
+ $question = new Question('Please enter the number of values to create (default 1): ', 1);
$question->setValidator(function ($answer) {
$answer = (int) ($answer);
if (!is_int($answer) || $answer <= 0) {
@@ -154,7 +154,7 @@ private function askForArguments(InputInterface $input, OutputInterface $output)
});
$input->setArgument('values-number', $dialog->ask($input, $output, $question));
}
- $output->writeln('Number of values to create: ' . $input->getArgument('values-number') . "");
+ $output->writeln('Number of values to create: ' . $input->getArgument('values-number') . '');
$argument['values-number'] = $input->getArgument('values-number');
return $argument;
diff --git a/src/N98/Magento/Command/SelfUpdateCommand.php b/src/N98/Magento/Command/SelfUpdateCommand.php
index b2b35c677..089c9ad95 100644
--- a/src/N98/Magento/Command/SelfUpdateCommand.php
+++ b/src/N98/Magento/Command/SelfUpdateCommand.php
@@ -115,7 +115,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$latestVersion = trim($response->body);
if ($this->isOutdatedVersion($latestVersion, $loadUnstable)) {
- $output->writeln(sprintf("Updating to version %s.", $latestVersion));
+ $output->writeln(sprintf('Updating to version %s.', $latestVersion));
try {
$this->downloadNewPhar($output, $remotePharDownloadUrl, $tempFilename);
@@ -144,7 +144,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln('Please re-run the self-update command to try again.');
}
} else {
- $output->writeln("You are using the latest n98-magerun2 version.");
+ $output->writeln('You are using the latest n98-magerun2 version.');
}
return Command::SUCCESS;
diff --git a/src/N98/Magento/Command/System/Check/Filesystem/FilesCheck.php b/src/N98/Magento/Command/System/Check/Filesystem/FilesCheck.php
index 798153921..3de6593fd 100644
--- a/src/N98/Magento/Command/System/Check/Filesystem/FilesCheck.php
+++ b/src/N98/Magento/Command/System/Check/Filesystem/FilesCheck.php
@@ -40,11 +40,11 @@ public function check(ResultCollection $results)
if (file_exists($magentoRoot . DIRECTORY_SEPARATOR . $file)) {
$result->setStatus(Result::STATUS_OK);
- $result->setMessage("File " . $file . " found.");
+ $result->setMessage('File ' . $file . ' found.');
} else {
$result->setStatus(Result::STATUS_ERROR);
$result->setMessage(
- "File " . $file . " not found! Usage: " . $comment . ""
+ 'File ' . $file . ' not found! Usage: ' . $comment . ''
);
}
}
diff --git a/src/N98/Magento/Command/System/Check/Filesystem/FoldersCheck.php b/src/N98/Magento/Command/System/Check/Filesystem/FoldersCheck.php
index 56ff7e2c4..2afa0e8db 100644
--- a/src/N98/Magento/Command/System/Check/Filesystem/FoldersCheck.php
+++ b/src/N98/Magento/Command/System/Check/Filesystem/FoldersCheck.php
@@ -39,18 +39,18 @@ public function check(ResultCollection $results)
$result = $results->createResult();
if (file_exists($magentoRoot . DIRECTORY_SEPARATOR . $folder)) {
$result->setStatus(Result::STATUS_OK);
- $result->setMessage("Folder " . $folder . " found.");
+ $result->setMessage('Folder ' . $folder . ' found.');
if (!is_writeable($magentoRoot . DIRECTORY_SEPARATOR . $folder)) {
$result->setStatus(Result::STATUS_ERROR);
$result->setMessage(
- "Folder " . $folder . " is not writeable! Usage: " . $comment .
- ""
+ 'Folder ' . $folder . ' is not writeable! Usage: ' . $comment .
+ ''
);
}
} else {
$result->setStatus(Result::STATUS_ERROR);
$result->setMessage(
- "Folder " . $folder . " not found! Usage: " . $comment . ""
+ 'Folder ' . $folder . ' not found! Usage: ' . $comment . ''
);
}
}
diff --git a/src/N98/Magento/Command/System/Check/MySQL/EnginesCheck.php b/src/N98/Magento/Command/System/Check/MySQL/EnginesCheck.php
index a0613cec1..881c2e222 100644
--- a/src/N98/Magento/Command/System/Check/MySQL/EnginesCheck.php
+++ b/src/N98/Magento/Command/System/Check/MySQL/EnginesCheck.php
@@ -25,11 +25,11 @@ protected function checkImplementation(Result $result, Varien_Db_Adapter_Interfa
if ($innodbFound) {
$result->setStatus(Result::STATUS_OK);
- $result->setMessage("Required MySQL Storage Engine InnoDB found.");
+ $result->setMessage('Required MySQL Storage Engine InnoDB found.');
} else {
$result->setStatus(Result::STATUS_ERROR);
$result->setMessage(
- "Required MySQL Storage Engine InnoDB not found!"
+ 'Required MySQL Storage Engine InnoDB not found!'
);
}
}
diff --git a/src/N98/Magento/Command/System/Check/PHP/BytecodeCacheExtensionsCheck.php b/src/N98/Magento/Command/System/Check/PHP/BytecodeCacheExtensionsCheck.php
index 103463f31..8a51d0247 100644
--- a/src/N98/Magento/Command/System/Check/PHP/BytecodeCacheExtensionsCheck.php
+++ b/src/N98/Magento/Command/System/Check/PHP/BytecodeCacheExtensionsCheck.php
@@ -42,7 +42,7 @@ public function check(ResultCollection $results)
} else {
$result->setMessage(
"No Bytecode-Cache found! It's recommended to install anyone of " .
- implode(', ', $bytecopdeCacheExtensions) . "."
+ implode(', ', $bytecopdeCacheExtensions) . '.'
);
}
}
diff --git a/src/N98/Magento/Command/System/Cron/RunCommand.php b/src/N98/Magento/Command/System/Cron/RunCommand.php
index 0174d7ee6..4246612c3 100644
--- a/src/N98/Magento/Command/System/Cron/RunCommand.php
+++ b/src/N98/Magento/Command/System/Cron/RunCommand.php
@@ -140,7 +140,7 @@ private function getCallbackFromRunConfigModel($runConfigModel, $jobCode)
throw new RuntimeException(sprintf('Failed to create new "%s" model for job "%s"', $runModel, $jobCode));
}
$callback = [$model, $runMethod];
- $callableName = sprintf("%s::%s", $runModel, $runMethod);
+ $callableName = sprintf('%s::%s', $runModel, $runMethod);
if (!$model || !is_callable($callback, false, $callableName)) {
throw new RuntimeException(sprintf('Invalid callback: %s for job "%s"', $callableName, $jobCode));
}
diff --git a/src/N98/Magento/Command/System/Setup/IncrementalCommand.php b/src/N98/Magento/Command/System/Setup/IncrementalCommand.php
index b0b3cd853..c83ac5745 100644
--- a/src/N98/Magento/Command/System/Setup/IncrementalCommand.php
+++ b/src/N98/Magento/Command/System/Setup/IncrementalCommand.php
@@ -331,7 +331,7 @@ protected function _outputUpdateInformation(array $needsUpdate)
$output->writeln('Structure Files to Run: ');
$filesStructure = $this->_getAvaiableDbFilesFromResource($setupResource, $args);
$this->_outputFileArray($filesStructure);
- $output->writeln("");
+ $output->writeln('');
$args[0] = $dbVersion
? Mage_Core_Model_Resource_Setup::TYPE_DATA_UPGRADE
@@ -460,14 +460,14 @@ protected function _processExceptionDuringUpdate(
) {
$input = $this->_input;
$output = $this->_output;
- $output->writeln(["Magento encountered an error while running the following setup resource.", "", " $name ", "", "The Good News: You know the error happened, and the database", "information below will help you fix this error!", "", "The Bad News: Because Magento/MySQL can't run setup resources", "transactionally your database is now in an half upgraded, invalid", "state. Even if you fix the error, new errors may occur due to", "this half upgraded, invalid state.", '', "What to Do: ", "1. Figure out why the error happened, and manually fix your", " database and/or system so it won't happen again.", "2. Restore your database from backup.", "3. Re-run the scripts.", "", "Exception Message:", $e->getMessage(), ""]);
+ $output->writeln(['Magento encountered an error while running the following setup resource.', '', " $name ", '', 'The Good News: You know the error happened, and the database', 'information below will help you fix this error!', '', "The Bad News: Because Magento/MySQL can't run setup resources", 'transactionally your database is now in an half upgraded, invalid', 'state. Even if you fix the error, new errors may occur due to', 'this half upgraded, invalid state.', '', 'What to Do: ', '1. Figure out why the error happened, and manually fix your', " database and/or system so it won't happen again.", '2. Restore your database from backup.', '3. Re-run the scripts.', '', 'Exception Message:', $e->getMessage(), '']);
if ($magentoExceptionOutput) {
$dialog = $this->getQuestionHelper();
$question = new Question('Press Enter to view raw Magento error text: ');
$dialog->ask($input, $output, $question);
- $output->writeln("Magento Exception Error Text:");
+ $output->writeln('Magento Exception Error Text:');
echo $magentoExceptionOutput, "\n"; //echoing (vs. writeln) to avoid seg fault
}
}
@@ -601,7 +601,7 @@ protected function _listDetailedUpdateInformation(array $needsUpdate)
protected function _runAllStructureUpdates(array $needsUpdate)
{
$output = $this->_output;
- $this->writeSection($output, "Run Structure Updates");
+ $this->writeSection($output, 'Run Structure Updates');
$output->writeln('All structure updates run before data updates.');
$output->writeln('');
@@ -615,7 +615,7 @@ protected function _runAllStructureUpdates(array $needsUpdate)
$c++;
}
- $this->writeSection($output, "Run Data Updates");
+ $this->writeSection($output, 'Run Data Updates');
$c = 1;
$total = count($needsUpdate);
foreach ($needsUpdate as $key => $value) {
diff --git a/src/N98/Magento/DbSettings.php b/src/N98/Magento/DbSettings.php
index f801759de..57627dcb8 100644
--- a/src/N98/Magento/DbSettings.php
+++ b/src/N98/Magento/DbSettings.php
@@ -198,7 +198,7 @@ public function getConnection()
throw new RuntimeException($message, 0, $e);
}
- $connection->query("SET NAMES utf8");
+ $connection->query('SET NAMES utf8');
$connection->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
$connection->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
diff --git a/src/N98/Util/Console/Enabler.php b/src/N98/Util/Console/Enabler.php
index 58a92c528..d4a503a31 100644
--- a/src/N98/Util/Console/Enabler.php
+++ b/src/N98/Util/Console/Enabler.php
@@ -44,7 +44,7 @@ public function functionExists($name)
*/
public function operatingSystemIsNotWindows()
{
- $this->assert(!OperatingSystem::isWindows(), "operating system is windows");
+ $this->assert(!OperatingSystem::isWindows(), 'operating system is windows');
}
/**
diff --git a/src/N98/Util/Console/Helper/DatabaseHelper.php b/src/N98/Util/Console/Helper/DatabaseHelper.php
index 3d7fd81bf..7a7006450 100644
--- a/src/N98/Util/Console/Helper/DatabaseHelper.php
+++ b/src/N98/Util/Console/Helper/DatabaseHelper.php
@@ -172,12 +172,12 @@ public function getMysqlVariableValue($variable)
public function getMysqlVariable($name, $type = null)
{
if (null === $type) {
- $type = "@@";
+ $type = '@@';
} else {
$type = (string) $type;
}
- if (!in_array($type, ["@@", "@"], true)) {
+ if (!in_array($type, ['@@', '@'], true)) {
throw new InvalidArgumentException(
sprintf('Invalid mysql variable type "%s", must be "@@" (system) or "@" (session)', $type)
);
@@ -414,7 +414,7 @@ public function getTables($withoutPrefix = null)
*
* @throws RuntimeException
*/
- private function throwRuntimeException(PDOStatement $statement, $message = "")
+ private function throwRuntimeException(PDOStatement $statement, $message = '')
{
$reason = $statement->errorInfo()
? vsprintf('SQLSTATE[%s]: %s: %s', $statement->errorInfo())
diff --git a/src/N98/Util/Console/Helper/Table/Renderer/XmlRenderer.php b/src/N98/Util/Console/Helper/Table/Renderer/XmlRenderer.php
index e80b25303..8d451bb2d 100644
--- a/src/N98/Util/Console/Helper/Table/Renderer/XmlRenderer.php
+++ b/src/N98/Util/Console/Helper/Table/Renderer/XmlRenderer.php
@@ -128,7 +128,7 @@ private function createField(DOMDocument $doc, $key, $value)
*/
private function getName($string)
{
- $name = preg_replace("/[^a-z0-9]/ui", '_', $string);
+ $name = preg_replace('/[^a-z0-9]/ui', '_', $string);
if (null === $name) {
throw new RuntimeException(
sprintf(
diff --git a/src/N98/Util/DateTime.php b/src/N98/Util/DateTime.php
index 006598538..52e0bf69f 100644
--- a/src/N98/Util/DateTime.php
+++ b/src/N98/Util/DateTime.php
@@ -43,7 +43,7 @@ public static function difference(PhpDateTime $time1, PhpDateTime $time2)
);
if (!strlen($differenceString)) {
- $milliseconds = max(0, $time2->format("u") / 1000 - $time1->format("u") / 1000);
+ $milliseconds = max(0, $time2->format('u') / 1000 - $time1->format('u') / 1000);
$differenceString = $milliseconds ? sprintf('%0.2fms', $milliseconds) : '';
}
diff --git a/src/N98/Util/Exec.php b/src/N98/Util/Exec.php
index fa69c998f..28d4619cf 100644
--- a/src/N98/Util/Exec.php
+++ b/src/N98/Util/Exec.php
@@ -49,7 +49,7 @@ public static function run($command, &$output = null, &$returnCode = null)
if ($returnCode !== self::CODE_CLEAN_EXIT) {
throw new RuntimeException(
- sprintf("Exit status %d for command %s. Output was: %s", $returnCode, $command, $output)
+ sprintf('Exit status %d for command %s. Output was: %s', $returnCode, $command, $output)
);
}
}
diff --git a/src/N98/Util/Filesystem.php b/src/N98/Util/Filesystem.php
index 0e58814de..305ece3af 100644
--- a/src/N98/Util/Filesystem.php
+++ b/src/N98/Util/Filesystem.php
@@ -36,7 +36,7 @@ public function recursiveCopy($src, $dst, $blacklist = [])
throw new RuntimeException(sprintf('Source directory <%s> error', $src));
}
- $skip = array_merge([".", ".."], $blacklist);
+ $skip = array_merge(['.', '..'], $blacklist);
$stack = [];
while (false !== ($file = readdir($handle))) {
@@ -85,7 +85,7 @@ public function recursiveRemoveDirectory($directory, $empty = false)
throw new RuntimeException(sprintf('Directory <%s> error', $directory));
}
- $skip = [".", ".."];
+ $skip = ['.', '..'];
// and scan through the items inside
while (false !== ($file = readdir($handle))) {
diff --git a/src/N98/Util/VerifyOrDie.php b/src/N98/Util/VerifyOrDie.php
index bc5d2a9e7..5156a4d5a 100644
--- a/src/N98/Util/VerifyOrDie.php
+++ b/src/N98/Util/VerifyOrDie.php
@@ -34,11 +34,11 @@ public static function filename($basename, $message = null)
# no control characters, no posix forbidden ones, no windows forbidden ones and no spaces - and not empty
$pattern = '~^[^\x00-\x1F\x7F/<>:"\\|?* ]+$~';
if (!preg_match($pattern, $basename)) {
- self::violation($message ?: sprintf("Filename %s is not portable", var_export($basename, true)));
+ self::violation($message ?: sprintf('Filename %s is not portable', var_export($basename, true)));
}
if ('-' === $basename[0]) {
- self::violation($message ?: sprintf("Filename %s starts with a dash", var_export($basename, true)));
+ self::violation($message ?: sprintf('Filename %s starts with a dash', var_export($basename, true)));
}
return $basename;
diff --git a/tests/N98/Magento/Application/ConfigFileTest.php b/tests/N98/Magento/Application/ConfigFileTest.php
index 18d4361ef..f4108f001 100644
--- a/tests/N98/Magento/Application/ConfigFileTest.php
+++ b/tests/N98/Magento/Application/ConfigFileTest.php
@@ -38,7 +38,7 @@ public function applyVariables()
{
$configFile = new ConfigFile();
$configFile->loadFile('data://,- %root%');
- $configFile->applyVariables("root-folder");
+ $configFile->applyVariables('root-folder');
self::assertSame(['root-folder'], $configFile->toArray());
}
@@ -75,6 +75,6 @@ public function parseEmptyFile()
public function invalidFileThrowsException()
{
$this->expectException(InvalidArgumentException::class);
- @ConfigFile::createFromFile(":");
+ @ConfigFile::createFromFile(':');
}
}
diff --git a/tests/N98/Magento/Application/ConfigTest.php b/tests/N98/Magento/Application/ConfigTest.php
index ead5eee92..4598d8b24 100644
--- a/tests/N98/Magento/Application/ConfigTest.php
+++ b/tests/N98/Magento/Application/ConfigTest.php
@@ -55,7 +55,7 @@ public function loader()
self::assertInstanceOf(__NAMESPACE__ . '\\ConfigurationLoader', $loader);
self::assertSame($loader, $config->getLoader());
- $loader->loadStageTwo("");
+ $loader->loadStageTwo('');
$config->load();
self::assertIsArray($config->getConfig());
diff --git a/tests/N98/Magento/Command/Admin/User/ChangeStatusCommandTest.php b/tests/N98/Magento/Command/Admin/User/ChangeStatusCommandTest.php
index 86968b78f..9157adeba 100644
--- a/tests/N98/Magento/Command/Admin/User/ChangeStatusCommandTest.php
+++ b/tests/N98/Magento/Command/Admin/User/ChangeStatusCommandTest.php
@@ -283,6 +283,6 @@ public function testIfNoIdIsPresentItIsPromptedFor()
$commandTester = new CommandTester($command);
$commandTester->execute(['command' => $command->getName()]);
- self::assertStringContainsString("User aydin is now inactive", $commandTester->getDisplay());
+ self::assertStringContainsString('User aydin is now inactive', $commandTester->getDisplay());
}
}
diff --git a/tests/N98/Magento/Command/Admin/User/DeleteUserCommandTest.php b/tests/N98/Magento/Command/Admin/User/DeleteUserCommandTest.php
index 82c79226e..0c8059685 100644
--- a/tests/N98/Magento/Command/Admin/User/DeleteUserCommandTest.php
+++ b/tests/N98/Magento/Command/Admin/User/DeleteUserCommandTest.php
@@ -167,7 +167,7 @@ public function testMessageIsPrintedIfErrorDeleting()
->method('getId')
->willReturn(2);
- $exception = new Exception("Error!");
+ $exception = new Exception('Error!');
$this->userModel
->expects(self::once())
->method('delete')
diff --git a/tests/N98/Magento/Command/Category/Create/DummyCommandTest.php b/tests/N98/Magento/Command/Category/Create/DummyCommandTest.php
index 5e85d21e2..478065312 100644
--- a/tests/N98/Magento/Command/Category/Create/DummyCommandTest.php
+++ b/tests/N98/Magento/Command/Category/Create/DummyCommandTest.php
@@ -27,8 +27,8 @@ public function testExecute()
self::assertMatchesRegularExpression('/CATEGORY CHILD: \'My Awesome Category (.+)\' WITH ID: \'(.+)\' CREATED!/', $commandTester->getDisplay());
// Check if the category is created correctly
- $match_parent = "";
- $match_child = "";
+ $match_parent = '';
+ $match_child = '';
preg_match('/CATEGORY: \'My Awesome Category (.+)\' WITH ID: \'(.+)\' CREATED!/', $commandTester->getDisplay(), $match_parent);
self::assertTrue($this->checkifCategoryExist($match_parent[2]));
preg_match('/CATEGORY CHILD: \'My Awesome Category (.+)\' WITH ID: \'(.+)\' CREATED!/', $commandTester->getDisplay(), $match_child);
diff --git a/tests/N98/Magento/Command/Database/DumpCommandTest.php b/tests/N98/Magento/Command/Database/DumpCommandTest.php
index 338f37e0c..b30d6c7fc 100644
--- a/tests/N98/Magento/Command/Database/DumpCommandTest.php
+++ b/tests/N98/Magento/Command/Database/DumpCommandTest.php
@@ -41,7 +41,7 @@ public function testExecute()
self::assertMatchesRegularExpression('/mysqldump/', $commandTester->getDisplay());
self::assertMatchesRegularExpression('/\.sql/', $commandTester->getDisplay());
- self::assertStringContainsString(".sql.gz", $commandTester->getDisplay());
+ self::assertStringContainsString('.sql.gz', $commandTester->getDisplay());
}
/**
@@ -105,8 +105,8 @@ public function testWithStripOption()
self::assertMatchesRegularExpression("/--ignore-table=$db.sales_flat_order/", $commandTester->getDisplay());
self::assertMatchesRegularExpression("/--ignore-table=$db.sales_flat_order_item/", $commandTester->getDisplay());
self::assertMatchesRegularExpression("/--ignore-table=$db.sales_flat_order_item/", $commandTester->getDisplay());
- self::assertStringNotContainsString("not_existing_table_1", $commandTester->getDisplay());
- self::assertStringContainsString(".sql.gz", $commandTester->getDisplay());
+ self::assertStringNotContainsString('not_existing_table_1', $commandTester->getDisplay());
+ self::assertStringContainsString('.sql.gz', $commandTester->getDisplay());
/**
* Uncompressed
@@ -115,7 +115,7 @@ public function testWithStripOption()
$commandTester->execute(
['command' => $command->getName(), '--add-time' => true, '--only-command' => true, '--force' => true, '--strip' => '@development']
);
- self::assertStringNotContainsString(".sql.gz", $commandTester->getDisplay());
+ self::assertStringNotContainsString('.sql.gz', $commandTester->getDisplay());
}
public function testWithIncludeExcludeOptions()
diff --git a/tests/N98/Magento/Command/Developer/Module/Dependencies/FromCommandTest.php b/tests/N98/Magento/Command/Developer/Module/Dependencies/FromCommandTest.php
index ff5ed7a66..36788a55e 100644
--- a/tests/N98/Magento/Command/Developer/Module/Dependencies/FromCommandTest.php
+++ b/tests/N98/Magento/Command/Developer/Module/Dependencies/FromCommandTest.php
@@ -14,7 +14,7 @@ class FromCommandTest extends TestCase
{
public static function dataProviderTestExecute()
{
- return ['Not existing module, no --all' => ['$moduleName' => 'NotExistentModule', '$all' => 0, '$expectations' => ["Module NotExistentModule was not found"], '$notContains' => []], 'Not existing module, with --all' => ['$moduleName' => 'NotExistentModule', '$all' => 1, '$expectations' => ["Module NotExistentModule was not found"], '$notContains' => []], 'Not existing module, with -a' => ['$moduleName' => 'NotExistentModule', '$all' => 2, '$expectations' => ["Module NotExistentModule was not found"], '$notContains' => []], 'Mage_Admin module, no --all' => ['$moduleName' => 'Mage_Admin', '$all' => 0, '$expectations' => ['Mage_Adminhtml'], '$notContains' => ['Mage_AdminNotification']], 'Mage_Admin module, with --all' => ['$moduleName' => 'Mage_Admin', '$all' => 1, '$expectations' => ['Mage_AdminNotification', 'Mage_Adminhtml'], '$notContains' => ['Mage_Compiler', 'Mage_Customer']], 'Mage_Admin module, with -a' => ['$moduleName' => 'Mage_Admin', '$all' => 2, '$expectations' => ['Mage_AdminNotification', 'Mage_Adminhtml'], '$notContains' => ['Mage_Compiler', 'Mage_Customer']]];
+ return ['Not existing module, no --all' => ['$moduleName' => 'NotExistentModule', '$all' => 0, '$expectations' => ['Module NotExistentModule was not found'], '$notContains' => []], 'Not existing module, with --all' => ['$moduleName' => 'NotExistentModule', '$all' => 1, '$expectations' => ['Module NotExistentModule was not found'], '$notContains' => []], 'Not existing module, with -a' => ['$moduleName' => 'NotExistentModule', '$all' => 2, '$expectations' => ['Module NotExistentModule was not found'], '$notContains' => []], 'Mage_Admin module, no --all' => ['$moduleName' => 'Mage_Admin', '$all' => 0, '$expectations' => ['Mage_Adminhtml'], '$notContains' => ['Mage_AdminNotification']], 'Mage_Admin module, with --all' => ['$moduleName' => 'Mage_Admin', '$all' => 1, '$expectations' => ['Mage_AdminNotification', 'Mage_Adminhtml'], '$notContains' => ['Mage_Compiler', 'Mage_Customer']], 'Mage_Admin module, with -a' => ['$moduleName' => 'Mage_Admin', '$all' => 2, '$expectations' => ['Mage_AdminNotification', 'Mage_Adminhtml'], '$notContains' => ['Mage_Compiler', 'Mage_Customer']]];
}
/**
diff --git a/tests/N98/Magento/Command/Developer/Module/Dependencies/OnCommandTest.php b/tests/N98/Magento/Command/Developer/Module/Dependencies/OnCommandTest.php
index f2607fae1..953360d8c 100644
--- a/tests/N98/Magento/Command/Developer/Module/Dependencies/OnCommandTest.php
+++ b/tests/N98/Magento/Command/Developer/Module/Dependencies/OnCommandTest.php
@@ -14,7 +14,7 @@ class OnCommandTest extends TestCase
{
public static function dataProviderTestExecute()
{
- return ['Not existing module, no --all' => ['$moduleName' => 'NotExistentModule', '$all' => 0, '$expectations' => ["Module NotExistentModule was not found"], '$notContains' => []], 'Not existing module, with --all' => ['$moduleName' => 'NotExistentModule', '$all' => 1, '$expectations' => ["Module NotExistentModule was not found"], '$notContains' => []], 'Not existing module, with -a' => ['$moduleName' => 'NotExistentModule', '$all' => 2, '$expectations' => ["Module NotExistentModule was not found"], '$notContains' => []], 'Mage_Core module, no --all' => ['$moduleName' => 'Mage_Core', '$all' => 0, '$expectations' => ["Module Mage_Core doesn't have dependencies"], '$notContains' => []], 'Mage_Core module, with --all' => ['$moduleName' => 'Mage_Core', '$all' => 1, '$expectations' => ["Module Mage_Core doesn't have dependencies"], '$notContains' => []], 'Mage_Core module, with -a' => ['$moduleName' => 'Mage_Core', '$all' => 2, '$expectations' => ["Module Mage_Core doesn't have dependencies"], '$notContains' => []], 'Mage_Customer module, no --all' => ['$moduleName' => 'Mage_Customer', '$all' => 0, '$expectations' => [
+ return ['Not existing module, no --all' => ['$moduleName' => 'NotExistentModule', '$all' => 0, '$expectations' => ['Module NotExistentModule was not found'], '$notContains' => []], 'Not existing module, with --all' => ['$moduleName' => 'NotExistentModule', '$all' => 1, '$expectations' => ['Module NotExistentModule was not found'], '$notContains' => []], 'Not existing module, with -a' => ['$moduleName' => 'NotExistentModule', '$all' => 2, '$expectations' => ['Module NotExistentModule was not found'], '$notContains' => []], 'Mage_Core module, no --all' => ['$moduleName' => 'Mage_Core', '$all' => 0, '$expectations' => ["Module Mage_Core doesn't have dependencies"], '$notContains' => []], 'Mage_Core module, with --all' => ['$moduleName' => 'Mage_Core', '$all' => 1, '$expectations' => ["Module Mage_Core doesn't have dependencies"], '$notContains' => []], 'Mage_Core module, with -a' => ['$moduleName' => 'Mage_Core', '$all' => 2, '$expectations' => ["Module Mage_Core doesn't have dependencies"], '$notContains' => []], 'Mage_Customer module, no --all' => ['$moduleName' => 'Mage_Customer', '$all' => 0, '$expectations' => [
'Mage_Dataflow',
/*'Mage_Directory',*/
'Mage_Eav',
diff --git a/tests/N98/Magento/Command/Eav/Attribute/Create/DummyCommandTest.php b/tests/N98/Magento/Command/Eav/Attribute/Create/DummyCommandTest.php
index e2bcad977..715cdd909 100644
--- a/tests/N98/Magento/Command/Eav/Attribute/Create/DummyCommandTest.php
+++ b/tests/N98/Magento/Command/Eav/Attribute/Create/DummyCommandTest.php
@@ -19,7 +19,7 @@ public function testExecute()
$commandTester = new CommandTester($command);
$commandTester->execute(
- ['command' => $command->getName(), 'locale' => "en_US", 'attribute-id' => 92, 'values-type' => 'int', 'values-number' => 1]
+ ['command' => $command->getName(), 'locale' => 'en_US', 'attribute-id' => 92, 'values-type' => 'int', 'values-number' => 1]
);
self::assertMatchesRegularExpression('/ATTRIBUTE VALUE: \'(.+)\' ADDED!/', $commandTester->getDisplay());
diff --git a/tests/N98/Magento/Command/Installer/InstallCommandTest.php b/tests/N98/Magento/Command/Installer/InstallCommandTest.php
index d953d6d28..05be3c506 100644
--- a/tests/N98/Magento/Command/Installer/InstallCommandTest.php
+++ b/tests/N98/Magento/Command/Installer/InstallCommandTest.php
@@ -19,7 +19,7 @@ class InstallCommandTest extends TestCase
*/
public function setup(): void
{
- $installDir = sys_get_temp_dir() . "/mageinstall";
+ $installDir = sys_get_temp_dir() . '/mageinstall';
if (is_readable($installDir)) {
$result = rmdir($installDir);
if (!$result) {
@@ -59,7 +59,7 @@ public function testInstallFailsWithInvalidDbConfigWhenAllOptionsArePassedIn()
]
);
} catch (InvalidArgumentException $e) {
- self::assertEquals("Database configuration is invalid", $e->getMessage());
+ self::assertEquals('Database configuration is invalid', $e->getMessage());
$display = $commandTester->getDisplay(true);
self::assertStringContainsString('SQLSTATE', $display);
diff --git a/tests/N98/Magento/Command/Installer/UninstallCommandTest.php b/tests/N98/Magento/Command/Installer/UninstallCommandTest.php
index ff0238d22..e88dc5fc5 100644
--- a/tests/N98/Magento/Command/Installer/UninstallCommandTest.php
+++ b/tests/N98/Magento/Command/Installer/UninstallCommandTest.php
@@ -31,7 +31,7 @@ public function testUninstallDoesNotUninstallIfConfirmationDenied()
$command->setHelperSet(new HelperSet([$dialog]));
$commandTester->execute(['command' => $command->getName(), '--installationFolder' => $this->getTestMagentoRoot()]);
- self::assertEquals("Really uninstall ? [n]: ", $commandTester->getDisplay());
+ self::assertEquals('Really uninstall ? [n]: ', $commandTester->getDisplay());
//check magento still installed
self::assertFileExists($this->getTestMagentoRoot() . '/app/etc/local.xml');
@@ -53,9 +53,9 @@ public function testUninstallForceActuallyRemoves()
['command' => $command->getName(), '--force' => true, '--installationFolder' => $this->getTestMagentoRoot()]
);
- self::assertStringContainsString("Dropped database", $commandTester->getDisplay());
- self::assertStringContainsString("Remove directory " . $this->getTestMagentoRoot(), $commandTester->getDisplay());
- self::assertStringContainsString("Done", $commandTester->getDisplay());
+ self::assertStringContainsString('Dropped database', $commandTester->getDisplay());
+ self::assertStringContainsString('Remove directory ' . $this->getTestMagentoRoot(), $commandTester->getDisplay());
+ self::assertStringContainsString('Done', $commandTester->getDisplay());
self::assertFileDoesNotExist($this->getTestMagentoRoot() . '/app/etc/local.xml');
}
diff --git a/tests/N98/Magento/Command/Script/Repository/RunCommandTest.php b/tests/N98/Magento/Command/Script/Repository/RunCommandTest.php
index 65ab4a9c8..e70133a4a 100644
--- a/tests/N98/Magento/Command/Script/Repository/RunCommandTest.php
+++ b/tests/N98/Magento/Command/Script/Repository/RunCommandTest.php
@@ -39,6 +39,6 @@ public function testExecute()
*/
private function normalizePathSeparators($string)
{
- return strtr($string, "\\", "/");
+ return strtr($string, '\\', '/');
}
}
diff --git a/tests/N98/Magento/Command/System/Check/Settings/CookieDomainCheckAbstractTest.php b/tests/N98/Magento/Command/System/Check/Settings/CookieDomainCheckAbstractTest.php
index 0257abe06..c1f71ffca 100644
--- a/tests/N98/Magento/Command/System/Check/Settings/CookieDomainCheckAbstractTest.php
+++ b/tests/N98/Magento/Command/System/Check/Settings/CookieDomainCheckAbstractTest.php
@@ -21,25 +21,25 @@ class CookieDomainCheckAbstractTest extends TestCase
public function provideCookieDomainsAndBaseUrls()
{
return [
- ["", "", false],
- ["https://www.example.com/", "", false],
- ["", ".example.com", false],
- ["https://www.example.com/", ".example.com", true],
- ["https://www.example.com/", "www.example.com", true],
- ["https://images.example.com/", "www.example.com", false],
- ["https://images.example.com/", "example.com", true],
- ["https://images.example.com/", ".example.com", true],
- ["https://example.com/", ".example.com", false],
- ["https://www.example.com/", ".www.example.com", false],
- ["https://www.example.com/", "wwww.example.com", false],
- ["https://www.example.com/", "ww.example.com", false],
- ["https://www.example.com/", ".ww.example.com", false],
- ["https://www.example.com/", ".w.example.com", false],
- ["https://www.example.com/", "..example.com", false],
+ ['', '', false],
+ ['https://www.example.com/', '', false],
+ ['', '.example.com', false],
+ ['https://www.example.com/', '.example.com', true],
+ ['https://www.example.com/', 'www.example.com', true],
+ ['https://images.example.com/', 'www.example.com', false],
+ ['https://images.example.com/', 'example.com', true],
+ ['https://images.example.com/', '.example.com', true],
+ ['https://example.com/', '.example.com', false],
+ ['https://www.example.com/', '.www.example.com', false],
+ ['https://www.example.com/', 'wwww.example.com', false],
+ ['https://www.example.com/', 'ww.example.com', false],
+ ['https://www.example.com/', '.ww.example.com', false],
+ ['https://www.example.com/', '.w.example.com', false],
+ ['https://www.example.com/', '..example.com', false],
// false-positives we know about, there is no check against public suffix list (the co.uk check)
- ["https://www.example.com/", ".com", false],
- ["https://www.example.co.uk/", ".co.uk", true],
- ["https://www.example.co.uk/", "co.uk", true],
+ ['https://www.example.com/', '.com', false],
+ ['https://www.example.co.uk/', '.co.uk', true],
+ ['https://www.example.co.uk/', 'co.uk', true],
// go cases
['http://go/', 'go', false],
['http://go/', '.go', false],
diff --git a/tests/N98/Magento/Command/System/Setup/IncrementalCommandTest.php b/tests/N98/Magento/Command/System/Setup/IncrementalCommandTest.php
index 42bc5b244..f547589ef 100644
--- a/tests/N98/Magento/Command/System/Setup/IncrementalCommandTest.php
+++ b/tests/N98/Magento/Command/System/Setup/IncrementalCommandTest.php
@@ -20,7 +20,7 @@ public function regression747()
{
$stub = new IncrementalCommandStub();
- $actual = $stub->callProtectedMethodFromObject('protectedMethod', $this, ["fooBar"]);
+ $actual = $stub->callProtectedMethodFromObject('protectedMethod', $this, ['fooBar']);
self::assertSame('barBaz', $actual);
}
@@ -29,6 +29,6 @@ protected function protectedMethod($arg)
self::assertSame('fooBar', $arg);
$this->addToAssertionCount(1);
- return "barBaz";
+ return 'barBaz';
}
}
diff --git a/tests/N98/Magento/Command/TestCase.php b/tests/N98/Magento/Command/TestCase.php
index d75222872..7bed51752 100644
--- a/tests/N98/Magento/Command/TestCase.php
+++ b/tests/N98/Magento/Command/TestCase.php
@@ -93,7 +93,7 @@ private function getMagerunTester($command)
* @param string $needle string within the display
* @param string $message [optional]
*/
- protected function assertDisplayContains($command, $needle, $message = "")
+ protected function assertDisplayContains($command, $needle, $message = '')
{
$display = $this->getMagerunTester($command)->getDisplay();
@@ -105,7 +105,7 @@ protected function assertDisplayContains($command, $needle, $message = "")
* @param string $needle string within the display
* @param string $message [optional]
*/
- protected function assertDisplayNotContains($command, $needle, $message = "")
+ protected function assertDisplayNotContains($command, $needle, $message = '')
{
$display = $this->getMagerunTester($command)->getDisplay();
@@ -117,7 +117,7 @@ protected function assertDisplayNotContains($command, $needle, $message = "")
* @param string $pattern
* @param string $message [optional]
*/
- protected function assertDisplayRegExp($command, $pattern, $message = "")
+ protected function assertDisplayRegExp($command, $pattern, $message = '')
{
$display = $this->getMagerunTester($command)->getDisplay();
@@ -131,7 +131,7 @@ protected function assertDisplayRegExp($command, $pattern, $message = "")
* @param string $message
* @return MagerunCommandTester
*/
- protected function assertExecute($command, $message = "")
+ protected function assertExecute($command, $message = '')
{
$tester = $this->getMagerunTester($command);
$status = $tester->getStatus();
@@ -140,7 +140,7 @@ protected function assertExecute($command, $message = "")
$message .= "\n";
}
- $message .= "Command executes with a status code of zero";
+ $message .= 'Command executes with a status code of zero';
self::assertSame(0, $status, $message);
diff --git a/tests/N98/Util/AutoloadHandlerTest.php b/tests/N98/Util/AutoloadHandlerTest.php
index 8ba547cd6..2564958cc 100644
--- a/tests/N98/Util/AutoloadHandlerTest.php
+++ b/tests/N98/Util/AutoloadHandlerTest.php
@@ -84,10 +84,10 @@ public function registrationAndDeregistration()
$handler = $this->create($assertAble);
self::assertTrue($handler->isEnabled());
- self::assertTrue($handler->__invoke("Fake"));
+ self::assertTrue($handler->__invoke('Fake'));
$handler->unregister();
- self::assertFalse($handler->__invoke("Fake"));
+ self::assertFalse($handler->__invoke('Fake'));
self::assertEquals(1, $calls->count['Fake']);
}
@@ -105,16 +105,16 @@ public function changingCallback()
};
$handler = $this->create(null, AutoloadHandler::NO_EXCEPTION);
- self::assertFalse($handler->__invoke("Test"));
+ self::assertFalse($handler->__invoke('Test'));
self::assertObjectNotHasAttribute('count', $calls);
$handler->setCallback($assertAble);
- self::assertTrue($handler->__invoke("Test"));
- self::assertEquals(1, $calls->count["Test"]);
+ self::assertTrue($handler->__invoke('Test'));
+ self::assertEquals(1, $calls->count['Test']);
$handler->setCallback(null);
- self::assertFalse($handler->__invoke("Test"));
- self::assertEquals(1, $calls->count["Test"]);
+ self::assertFalse($handler->__invoke('Test'));
+ self::assertEquals(1, $calls->count['Test']);
}
/**
@@ -124,10 +124,10 @@ public function disablingAndEnabling(): never
{
$handler = $this->create(null);
$handler->setEnabled(false);
- self::assertFalse($handler->__invoke("Test"));
+ self::assertFalse($handler->__invoke('Test'));
$handler->setEnabled(true);
$this->expectException(BadMethodCallException::class);
- self::assertFalse($handler->__invoke("Test"));
+ self::assertFalse($handler->__invoke('Test'));
self::fail('An expected exception has not been thrown');
}
diff --git a/tests/N98/Util/Console/Helper/Table/Renderer/TextRendererTest.php b/tests/N98/Util/Console/Helper/Table/Renderer/TextRendererTest.php
index 32fb0ab68..7f148e1f6 100644
--- a/tests/N98/Util/Console/Helper/Table/Renderer/TextRendererTest.php
+++ b/tests/N98/Util/Console/Helper/Table/Renderer/TextRendererTest.php
@@ -40,7 +40,7 @@ public function rendering()
$textRenderer = new TextRenderer();
$streamOutput = new StreamOutput(fopen('php://memory', 'wb', false));
- $rows = [['Column1' => 'Value A1', 'Column2' => 'A2 is another value that there is'], [1, "multi\nline\nftw"], ["C1 cell here!", new SimpleXMLElement('PHP Magic->toString() test')]];
+ $rows = [['Column1' => 'Value A1', 'Column2' => 'A2 is another value that there is'], [1, "multi\nline\nftw"], ['C1 cell here!', new SimpleXMLElement('PHP Magic->toString() test')]];
$expected = '+---------------+-----------------------------------+
| Column1 | Column2 |
diff --git a/tests/N98/Util/Console/Helper/Table/Renderer/XmlRendererTest.php b/tests/N98/Util/Console/Helper/Table/Renderer/XmlRendererTest.php
index 4d20be0fc..ff2a46e83 100644
--- a/tests/N98/Util/Console/Helper/Table/Renderer/XmlRendererTest.php
+++ b/tests/N98/Util/Console/Helper/Table/Renderer/XmlRendererTest.php
@@ -41,7 +41,7 @@ public function creation()
*/
public function provideTables()
{
- return [[[["column" => "Doors wide > open"], ["column" => "null \0 bytes FTW"]], '
+ return [[[['column' => 'Doors wide > open'], ['column' => "null \0 bytes FTW"]], '
@@ -55,7 +55,7 @@ public function provideTables()
'], [[], '
'], [[['Column1' => 'Value A1', 'Column2' => 'A2 is another value that there is'], [1, "multi\nline\nftw"], ["C1 cell here!", new SimpleXMLElement('PHP Magic->toString() test')]], '
+'], [[['Column1' => 'Value A1', 'Column2' => 'A2 is another value that there is'], [1, "multi\nline\nftw"], ['C1 cell here!', new SimpleXMLElement('PHP Magic->toString() test')]], '
@@ -75,7 +75,7 @@ public function provideTables()
C1 cell here!
PHP Magic->toString() test
-
'], [[["\x00" => "foo"]], '
+'], [[["\x00" => 'foo']], '
@@ -83,7 +83,7 @@ public function provideTables()
<_>foo
-
'], [[["foo" => "bar"], ["baz", "buz" => "here"]], '
+'], [[['foo' => 'bar'], ['baz', 'buz' => 'here']], '
@@ -107,7 +107,7 @@ public function invalidName()
$this->expectExceptionMessage("Invalid name '0'");
$xmlRenderer = new XmlRenderer();
$nullOutput = new NullOutput();
- $xmlRenderer->render($nullOutput, [["foo"]]);
+ $xmlRenderer->render($nullOutput, [['foo']]);
}
/**
@@ -119,7 +119,7 @@ public function invalidEncoding()
$this->expectExceptionMessage("Encoding error, only US-ASCII and UTF-8 supported, can not process '");
$xmlRenderer = new XmlRenderer();
$nullOutput = new NullOutput();
- $xmlRenderer->render($nullOutput, [["\xC1" => "foo"]]);
+ $xmlRenderer->render($nullOutput, [["\xC1" => 'foo']]);
}
/**
diff --git a/tests/N98/Util/FilesystemTest.php b/tests/N98/Util/FilesystemTest.php
index 343c9e561..2faa25133 100644
--- a/tests/N98/Util/FilesystemTest.php
+++ b/tests/N98/Util/FilesystemTest.php
@@ -31,12 +31,12 @@ public function testRecursiveCopy()
{
$this->expectException(RuntimeException::class);
$tmp = sys_get_temp_dir();
- $basePath = $tmp . "/n98_testdir";
- $folder1 = $basePath . "/folder1";
- $folder2 = $basePath . "/folder2";
- $file1 = $folder1 . "/file1.txt";
- $file2 = $folder2 . "/file2.txt";
- $dest = sys_get_temp_dir() . "/n98_copy_dest";
+ $basePath = $tmp . '/n98_testdir';
+ $folder1 = $basePath . '/folder1';
+ $folder2 = $basePath . '/folder2';
+ $file1 = $folder1 . '/file1.txt';
+ $file2 = $folder2 . '/file2.txt';
+ $dest = sys_get_temp_dir() . '/n98_copy_dest';
@mkdir($folder1, 0777, true);
@mkdir($folder2, 0777, true);
@@ -44,8 +44,8 @@ public function testRecursiveCopy()
touch($file2);
$this->fileSystem->recursiveCopy($basePath, $dest);
- self::assertFileExists($dest . "/folder1/file1.txt");
- self::assertFileExists($dest . "/folder2/file2.txt");
+ self::assertFileExists($dest . '/folder1/file1.txt');
+ self::assertFileExists($dest . '/folder2/file2.txt');
//cleanup
unlink($file1);
@@ -54,13 +54,13 @@ public function testRecursiveCopy()
rmdir($folder2);
rmdir($basePath);
- unlink($dest . "/folder1/file1.txt");
- unlink($dest . "/folder2/file2.txt");
- rmdir($dest . "/folder1");
- rmdir($dest . "/folder2");
+ unlink($dest . '/folder1/file1.txt');
+ unlink($dest . '/folder2/file2.txt');
+ rmdir($dest . '/folder1');
+ rmdir($dest . '/folder2');
rmdir($dest);
- self::assertFileDoesNotExist($dest . "/folder1/file1.txt");
+ self::assertFileDoesNotExist($dest . '/folder1/file1.txt');
self::assertFileDoesNotExist($dest);
if (!is_dir($tmp . '/a')) {
@@ -75,13 +75,13 @@ public function testRecursiveCopy()
public function testRecursiveCopyWithBlacklist()
{
$tmp = sys_get_temp_dir();
- $basePath = $tmp . "/n98_testdir";
- $folder1 = $basePath . "/folder1";
- $folder2 = $basePath . "/folder2";
- $file1 = $folder1 . "/file1.txt";
- $ignoreMe = $folder1 . "/ignore.me";
- $file2 = $folder2 . "/file2.txt";
- $dest = sys_get_temp_dir() . "/n98_copy_dest";
+ $basePath = $tmp . '/n98_testdir';
+ $folder1 = $basePath . '/folder1';
+ $folder2 = $basePath . '/folder2';
+ $file1 = $folder1 . '/file1.txt';
+ $ignoreMe = $folder1 . '/ignore.me';
+ $file2 = $folder2 . '/file2.txt';
+ $dest = sys_get_temp_dir() . '/n98_copy_dest';
$this->fileSystem->recursiveRemoveDirectory($dest, true);
@mkdir($folder1, 0777, true);
@@ -91,9 +91,9 @@ public function testRecursiveCopyWithBlacklist()
touch($file2);
$this->fileSystem->recursiveCopy($basePath, $dest, ['ignore.me']);
- self::assertFileExists($dest . "/folder1/file1.txt");
- self::assertFileDoesNotExist($dest . "/folder1/ignore.me");
- self::assertFileExists($dest . "/folder2/file2.txt");
+ self::assertFileExists($dest . '/folder1/file1.txt');
+ self::assertFileDoesNotExist($dest . '/folder1/ignore.me');
+ self::assertFileExists($dest . '/folder2/file2.txt');
//cleanup
unlink($file1);
@@ -103,10 +103,10 @@ public function testRecursiveCopyWithBlacklist()
rmdir($folder2);
rmdir($basePath);
- unlink($dest . "/folder1/file1.txt");
- unlink($dest . "/folder2/file2.txt");
- rmdir($dest . "/folder1");
- rmdir($dest . "/folder2");
+ unlink($dest . '/folder1/file1.txt');
+ unlink($dest . '/folder2/file2.txt');
+ rmdir($dest . '/folder1');
+ rmdir($dest . '/folder2');
rmdir($dest);
}
@@ -116,16 +116,16 @@ public function testRecursiveCopyWithBlacklist()
public function testRecursiveDirectoryRemoveUnLinksSymLinks()
{
$tmp = sys_get_temp_dir();
- $basePath = $tmp . "/n98_testdir";
- $symLinked = $tmp . "/n98_linked";
- $symLinkedFile = $symLinked . "/symlinkme.txt";
+ $basePath = $tmp . '/n98_testdir';
+ $symLinked = $tmp . '/n98_linked';
+ $symLinkedFile = $symLinked . '/symlinkme.txt';
@mkdir($basePath, 0777, true);
@mkdir($symLinked, 0777, true);
touch($symLinkedFile);
- $result = @symlink($symLinked, $basePath . "/symlink");
+ $result = @symlink($symLinked, $basePath . '/symlink');
self::assertTrue($result);
$this->fileSystem->recursiveRemoveDirectory($basePath);
@@ -137,11 +137,11 @@ public function testRecursiveDirectoryRemoveUnLinksSymLinks()
public function testRecursiveRemove()
{
$tmp = sys_get_temp_dir();
- $basePath = $tmp . "/n98_testdir";
- $folder1 = $basePath . "/folder1";
- $folder2 = $basePath . "/folder2";
- $file1 = $folder1 . "/file1.txt";
- $file2 = $folder2 . "/file2.txt";
+ $basePath = $tmp . '/n98_testdir';
+ $folder1 = $basePath . '/folder1';
+ $folder2 = $basePath . '/folder2';
+ $file1 = $folder1 . '/file1.txt';
+ $file2 = $folder2 . '/file2.txt';
@mkdir($folder1, 0777, true);
@mkdir($folder2, 0777, true);
@@ -155,30 +155,30 @@ public function testRecursiveRemove()
public function testRecursiveRemoveWithTrailingSlash()
{
$tmp = sys_get_temp_dir();
- $basePath = $tmp . "/n98_testdir";
- $folder1 = $basePath . "/folder1";
- $folder2 = $basePath . "/folder2";
- $file1 = $folder1 . "/file1.txt";
- $file2 = $folder2 . "/file2.txt";
+ $basePath = $tmp . '/n98_testdir';
+ $folder1 = $basePath . '/folder1';
+ $folder2 = $basePath . '/folder2';
+ $file1 = $folder1 . '/file1.txt';
+ $file2 = $folder2 . '/file2.txt';
@mkdir($folder1, 0777, true);
@mkdir($folder2, 0777, true);
touch($file1);
touch($file2);
- $this->fileSystem->recursiveRemoveDirectory($basePath . "/");
+ $this->fileSystem->recursiveRemoveDirectory($basePath . '/');
self::assertFileDoesNotExist($basePath);
}
public function testFalseIsReturnedIfDirectoryNotExist()
{
- self::assertFalse($this->fileSystem->recursiveRemoveDirectory("not-a-folder"));
+ self::assertFalse($this->fileSystem->recursiveRemoveDirectory('not-a-folder'));
}
public function testFalseIsReturnedIfDirectoryNotReadable()
{
$tmp = sys_get_temp_dir();
- $basePath = $tmp . "/n98_testdir-never-existed";
+ $basePath = $tmp . '/n98_testdir-never-existed';
self::assertFalse($this->fileSystem->recursiveRemoveDirectory($basePath));
}
@@ -186,11 +186,11 @@ public function testFalseIsReturnedIfDirectoryNotReadable()
public function testParentIsNotRemovedIfEmptyIsTrue()
{
$tmp = sys_get_temp_dir();
- $basePath = $tmp . "/n98_testdir";
- $folder1 = $basePath . "/folder1";
- $folder2 = $basePath . "/folder2";
- $file1 = $folder1 . "/file1.txt";
- $file2 = $folder2 . "/file2.txt";
+ $basePath = $tmp . '/n98_testdir';
+ $folder1 = $basePath . '/folder1';
+ $folder2 = $basePath . '/folder2';
+ $file1 = $folder1 . '/file1.txt';
+ $file2 = $folder2 . '/file2.txt';
@mkdir($folder1, 0777, true);
@mkdir($folder2, 0777, true);
diff --git a/tests/N98/Util/StringTypedTest.php b/tests/N98/Util/StringTypedTest.php
index 2c4af4eda..8045c94cc 100644
--- a/tests/N98/Util/StringTypedTest.php
+++ b/tests/N98/Util/StringTypedTest.php
@@ -22,7 +22,7 @@ class StringTypedTest extends TestCase
*/
public function scope()
{
- self::assertTrue(StringTyped::parseBoolOption("true"));
+ self::assertTrue(StringTyped::parseBoolOption('true'));
self::assertSame('inactive', StringTyped::formatActive(null));
self::assertSame('active', StringTyped::formatActive('1'));
diff --git a/tests/N98/Util/VerifyOrDieTest.php b/tests/N98/Util/VerifyOrDieTest.php
index d3b8ab650..7a609cdac 100644
--- a/tests/N98/Util/VerifyOrDieTest.php
+++ b/tests/N98/Util/VerifyOrDieTest.php
@@ -23,9 +23,9 @@ class VerifyOrDieTest extends TestCase
*/
public function portableFilename()
{
- self::assertSame("example.txt", VerifyOrDie::filename("example.txt"));
+ self::assertSame('example.txt', VerifyOrDie::filename('example.txt'));
- self::assertSame(".hidden", VerifyOrDie::filename(".hidden"));
+ self::assertSame('.hidden', VerifyOrDie::filename('.hidden'));
}
/**
diff --git a/tests/N98/Util/WindowsSystemTest.php b/tests/N98/Util/WindowsSystemTest.php
index c5078d1c4..841c3c78a 100644
--- a/tests/N98/Util/WindowsSystemTest.php
+++ b/tests/N98/Util/WindowsSystemTest.php
@@ -21,11 +21,11 @@ class WindowsSystemTest extends TestCase
*/
public function isProgramInstalled()
{
- self::assertTrue(WindowsSystem::isProgramInstalled("notepad"));
+ self::assertTrue(WindowsSystem::isProgramInstalled('notepad'));
- self::assertFalse(WindowsSystem::isProgramInstalled("notepad-that-never-made-it-into-windows-kernel"));
+ self::assertFalse(WindowsSystem::isProgramInstalled('notepad-that-never-made-it-into-windows-kernel'));
- self::assertFalse(WindowsSystem::isProgramInstalled("invalid\\command*name|thisis"));
+ self::assertFalse(WindowsSystem::isProgramInstalled('invalid\\command*name|thisis'));
}
/**
@@ -34,7 +34,7 @@ public function isProgramInstalled()
*/
public function provideExecutableNames()
{
- return [["notepad", false], ["notepad.com", true], ["notepad.exe", true], ["notepad.exe.exe", true], ["notepad.eXe", true], ["notepad.EXE", true], ["notepad.bat", true], ["notepad.txt", false]];
+ return [['notepad', false], ['notepad.com', true], ['notepad.exe', true], ['notepad.exe.exe', true], ['notepad.eXe', true], ['notepad.EXE', true], ['notepad.bat', true], ['notepad.txt', false]];
}
/**