Skip to content
This repository was archived by the owner on Sep 19, 2022. It is now read-only.

Commit 5d6cda4

Browse files
author
Dominik František Bučík
authored
Merge pull request #77 from CESNET/renovate/symplify-easy-coding-standard-11.x
chore(deps): update dependency symplify/easy-coding-standard to v11
2 parents 0442880 + 9c7b08a commit 5d6cda4

File tree

8 files changed

+37
-38
lines changed

8 files changed

+37
-38
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@
3737
},
3838
"require-dev": {
3939
"squizlabs/php_codesniffer": "*",
40-
"symplify/easy-coding-standard": "^10.0"
40+
"symplify/easy-coding-standard": "^11.0"
4141
}
4242
}

composer.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ecs.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66
use PhpCsFixer\Fixer\FunctionNotation\FunctionTypehintSpaceFixer;
77
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer;
88
use Symplify\EasyCodingStandard\Config\ECSConfig;
9-
use Symplify\EasyCodingStandard\ValueObject\Option;
109
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
1110

1211
return static function (ECSConfig $ecsConfig): void {
13-
$parameters = $ecsConfig->parameters();
14-
$parameters->set(Option::PATHS, [
12+
$ecsConfig->paths([
1513
__DIR__ . '/ecs.php',
1614
__DIR__ . '/config-templates',
1715
__DIR__ . '/hooks',
@@ -20,12 +18,13 @@
2018
__DIR__ . '/templates',
2119
__DIR__ . '/www',
2220
]);
23-
$parameters->set(Option::PARALLEL, true);
24-
$parameters->set(Option::SKIP, [NotOperatorWithSuccessorSpaceFixer::class, FunctionTypehintSpaceFixer::class]);
21+
22+
$ecsConfig->parallel();
23+
24+
$ecsConfig->skip([NotOperatorWithSuccessorSpaceFixer::class, FunctionTypehintSpaceFixer::class]);
2525

2626
$ecsConfig->sets(
2727
[
28-
SetList::PHP_CS_FIXER,
2928
SetList::CLEAN_CODE,
3029
SetList::SYMPLIFY,
3130
SetList::ARRAY,
@@ -37,7 +36,6 @@
3736
SetList::PHPUNIT,
3837
SetList::SPACES,
3938
SetList::STRICT,
40-
SetList::SYMFONY,
4139
SetList::PSR_12,
4240
]
4341
);

hooks/hook_cron.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
function proxystatistics_hook_cron(&$croninfo)
1414
{
15-
if ('daily' !== $croninfo['tag']) {
15+
if ($croninfo['tag'] !== 'daily') {
1616
Logger::debug('cron [proxystatistics]: Skipping cron in cron tag [' . $croninfo['tag'] . '] ');
1717

1818
return;

lib/Config.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ private function __clone()
7070

7171
public static function getInstance(): self
7272
{
73-
if (null === self::$instance) {
73+
if (self::$instance === null) {
7474
self::$instance = new self();
7575
}
7676

@@ -116,7 +116,7 @@ public function getSideInfo(string $side)
116116

117117
public function getRequiredAuthSource()
118118
{
119-
return$this->requiredAuthSource;
119+
return $this->requiredAuthSource;
120120
}
121121

122122
public function getKeepPerUser()

lib/DatabaseCommand.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
class DatabaseCommand
1414
{
1515
public const TABLE_SUM = 'statistics_sums';
16+
1617
private const DEBUG_PREFIX = 'proxystatistics:DatabaseCommand - ';
1718

1819
private const TABLE_PER_USER = 'statistics_per_user';
@@ -87,7 +88,7 @@ public function insertLogin($request, &$date)
8788
$ids[$tableId] = $this->getEntityDbIdFromEntityIdentifier($table, $entities[$side], $tableId);
8889
}
8990

90-
if (false === $this->writeLogin($date, $ids, $userId)) {
91+
if ($this->writeLogin($date, $ids, $userId) === false) {
9192
Logger::error(self::DEBUG_PREFIX . 'login record has not been inserted (data \'' . json_encode([
9293
'user' => $userId,
9394
'ids' => $ids,
@@ -171,7 +172,7 @@ public function aggregate()
171172
'day'
172173
) . '), EXTRACT(DAY FROM ' . $this->escape_col('day') . '), ';
173174
foreach ($ids as $id) {
174-
$query .= (null === $id ? '0' : $id) . ',';
175+
$query .= ($id === null ? '0' : $id) . ',';
175176
}
176177
$query .= 'SUM(logins), COUNT(DISTINCT ' . $this->escape_col('user') . ') '
177178
. 'FROM ' . $this->tables[self::TABLE_PER_USER] . ' '
@@ -221,7 +222,7 @@ public function aggregate()
221222
$written = $this->conn->write($query, $params);
222223
if (is_bool($written) && !$written) {
223224
Logger::warning(self::DEBUG_PREFIX . $msg . ' failed');
224-
} elseif (0 === $written) {
225+
} elseif ($written === 0) {
225226
Logger::warning(self::DEBUG_PREFIX . $msg . ' completed, but updated 0 rows.');
226227
} else {
227228
Logger::info(self::DEBUG_PREFIX . $msg . ' completed and updated ' . $written . ' rows.');
@@ -272,7 +273,7 @@ private function writeLogin($date, $ids, $user): bool
272273

273274
return false;
274275
}
275-
if (0 === $written) {
276+
if ($written === 0) {
276277
Logger::debug(self::DEBUG_PREFIX . 'login entry has been inserted, but has updated 0 rows.');
277278

278279
return false;
@@ -287,23 +288,23 @@ private function prepareEntitiesData($request): array
287288
Config::MODE_IDP => [],
288289
Config::MODE_SP => [],
289290
];
290-
if (Config::MODE_IDP !== $this->mode && Config::MODE_MULTI_IDP !== $this->mode) {
291+
if ($this->mode !== Config::MODE_IDP && $this->mode !== Config::MODE_MULTI_IDP) {
291292
$entities[Config::MODE_IDP][self::KEY_ID] = $this->getIdpIdentifier($request);
292293
$entities[Config::MODE_IDP][self::KEY_NAME] = $this->getIdpName($request);
293294
}
294-
if (Config::MODE_SP !== $this->mode) {
295+
if ($this->mode !== Config::MODE_SP) {
295296
$entities[Config::MODE_SP][self::KEY_ID] = $this->getSpIdentifier($request);
296297
$entities[Config::MODE_SP][self::KEY_NAME] = $this->getSpName($request);
297298
}
298299

299-
if (Config::MODE_PROXY !== $this->mode && Config::MODE_MULTI_IDP !== $this->mode) {
300+
if ($this->mode !== Config::MODE_PROXY && $this->mode !== Config::MODE_MULTI_IDP) {
300301
$entities[$this->mode] = $this->config->getSideInfo($this->mode);
301302
if (empty($entities[$this->mode][self::KEY_ID]) || empty($entities[$this->mode][self::KEY_NAME])) {
302303
Logger::error(self::DEBUG_PREFIX . 'Invalid configuration (id, name) for ' . $this->mode);
303304
}
304305
}
305306

306-
if (Config::MODE_MULTI_IDP === $this->mode) {
307+
if ($this->mode === Config::MODE_MULTI_IDP) {
307308
$entities[Config::MODE_IDP] = $this->config->getSideInfo(Config::MODE_IDP);
308309
if (empty($entities[Config::MODE_IDP][self::KEY_ID]) || empty($entities[Config::MODE_IDP][self::KEY_NAME])) {
309310
Logger::error(self::DEBUG_PREFIX . 'Invalid configuration (id, name) for ' . $this->mode);
@@ -346,7 +347,7 @@ private function addWhereId($where, &$query, &$params)
346347
$table = self::TABLE_SIDES[$side];
347348
$column = self::TABLE_IDS[$table];
348349
$part = $column;
349-
if (null === $value) {
350+
if ($value === null) {
350351
$part .= '=0';
351352
} else {
352353
$part .= '=:id';
@@ -363,8 +364,8 @@ private function addWhereId($where, &$query, &$params)
363364

364365
private function addDaysRange($days, &$query, &$params, $not = false)
365366
{
366-
if (0 !== $days) { // 0 = all time
367-
if (false === stripos($query, 'WHERE')) {
367+
if ($days !== 0) { // 0 = all time
368+
if (stripos($query, 'WHERE') === false) {
368369
$query .= 'WHERE';
369370
} else {
370371
$query .= 'AND';
@@ -408,7 +409,7 @@ private function getAggregateGroupBy($ids): string
408409
{
409410
$columns = ['day'];
410411
foreach ($ids as $id) {
411-
if (null !== $id) {
412+
if ($id !== null) {
412413
$columns[] = $id;
413414
}
414415
}
@@ -460,12 +461,12 @@ private function read($query, $params): PDOStatement
460461

461462
private function isPgsql(): bool
462463
{
463-
return 'pgsql' === $this->conn->getDriver();
464+
return $this->conn->getDriver() === 'pgsql';
464465
}
465466

466467
private function isMysql(): bool
467468
{
468-
return 'mysql' === $this->conn->getDriver();
469+
return $this->conn->getDriver() === 'mysql';
469470
}
470471

471472
private function unknownDriver()

lib/Templates.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,13 @@ public static function showIndex()
141141
'SP' => 'id="tab-3" href="' . self::getFullUrl('serviceProviders.php') . '?lastDays=' . $lastDays . '"',
142142
];
143143
$mode = $config->getMode();
144-
if (Config::MODE_PROXY !== $mode) {
144+
if ($mode !== Config::MODE_PROXY) {
145145
$t->data['tabsAttributes'][$mode] = 'class="hidden" ' . $t->data['tabsAttributes'][$mode];
146146
}
147147

148148
$t->data['header'] = $t->t('{proxystatistics:stats:statistics_header}');
149149
$instanceName = Configuration::getInstance()->getString(self::INSTANCE_NAME, null);
150-
if (null !== $instanceName) {
150+
if ($instanceName !== null) {
151151
$t->data['header'] = $instanceName . ' ' . $t->data['header'];
152152
} else {
153153
Logger::warning(
@@ -192,7 +192,7 @@ public static function showLegend($t, $side)
192192
'!side_on' => $t->t('{proxystatistics:stats:chart_legend_side_on_' . $side . '}'),
193193
]
194194
);
195-
if (Config::MODE_SP === $side && Config::MODE_SP !== $mode) {
195+
if ($side === Config::MODE_SP && $mode !== Config::MODE_SP) {
196196
echo ' ';
197197
echo $t->t(
198198
'{proxystatistics:stats:first_access_only}',
@@ -211,7 +211,7 @@ public static function showSummary()
211211
$mode = Config::getInstance()->getMode();
212212
$t->data['mode'] = $mode;
213213
$t->data['summaryGraphs'] = [];
214-
if (Config::MODE_PROXY === $mode || Config::MODE_MULTI_IDP === $mode) {
214+
if ($mode === Config::MODE_PROXY || $mode === Config::MODE_MULTI_IDP) {
215215
foreach (Config::SIDES as $side) {
216216
$t->data['summaryGraphs'][$side] = [];
217217
$t->data['summaryGraphs'][$side]['Providers'] = 'col-md-6 graph';

scripts/migrate_2.0.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
while (!feof($file)) {
3939
$line = fgetcsv($file);
40-
if (null !== $line) {
40+
if ($line !== null) {
4141
$lineInsert = 'INSERT INTO ' . $tableName . '(year, month, day, sourceIdp, service, count) ' .
4242
'VALUES(' . $line[0] . ', ' . $line[1] . ', ' . $line[2] . ', "' . $line[3] . '","" , ' . $line[4] . ');' .
4343
PHP_EOL;
@@ -52,7 +52,7 @@
5252

5353
while (!feof($file)) {
5454
$line = fgetcsv($file);
55-
if (null !== $line) {
55+
if ($line !== null) {
5656
$lineInsert = 'INSERT INTO ' . $tableName . '(year, month, day, sourceIdp, service, count) ' .
5757
'VALUES(' . $line[0] . ', ' . $line[1] . ', ' . $line[2] . ', "", "' . $line[3] . '", ' . $line[4] . ');' .
5858
PHP_EOL;

0 commit comments

Comments
 (0)