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

Commit 490cb59

Browse files
authored
Merge pull request #53 from CESNET/ecs
chore: fix ECS, fix PSR-12, add lock files
2 parents 111e620 + bdb31ef commit 490cb59

File tree

16 files changed

+11330
-79
lines changed

16 files changed

+11330
-79
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
.idea
22
vendor
33
modules
4-
composer.lock
4+
node_modules

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
},
2424
"require-dev": {
2525
"squizlabs/php_codesniffer": "*",
26-
"symplify/easy-coding-standard": "^9.2"
26+
"symplify/easy-coding-standard": "^10.0"
2727
}
2828
}

composer.lock

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

config-templates/module_proxystatistics.php

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* This is an example configuration of SimpleSAMLphp Perun interface and additional features. Copy this file to default
77
* config directory and edit the properties.
88
*/
9-
109
$config = [
1110
/*
1211
* Choose one of the following modes: PROXY, IDP, SP, MULTI_IDP
@@ -45,9 +44,9 @@
4544
'database.username' => 'stats',
4645
'database.password' => 'stats',
4746

48-
/**
49-
* Configuration for SSL If you want to use SSL, fill these values and uncomment the block of code
50-
*/
47+
/*
48+
* Configuration for SSL If you want to use SSL, fill these values and uncomment the block of code
49+
*/
5150
//'database.driver_options' => [
5251
// PDO::MYSQL_ATTR_SSL_KEY => '', // Path for the ssl key file
5352
// PDO::MYSQL_ATTR_SSL_CERT => '', // Path for the ssl cert file
@@ -56,14 +55,14 @@
5655
//],
5756
],
5857

59-
/**
58+
/*
6059
* Which attribute should be used as user ID.
6160
*
6261
* @default uid
6362
*/
6463
//'userIdAttribute' => 'uid',
6564

66-
/**
65+
/*
6766
* Database table names. Default is to keep the name (as in `tables.sql`)
6867
*/
6968
'tableNames' => [
@@ -73,13 +72,13 @@
7372
//'statistics_sp' => 'statistics_sp',
7473
],
7574

76-
/**
77-
* Authentication source name if authentication should be required. Defaults to empty string.
78-
*/
75+
/*
76+
* Authentication source name if authentication should be required. Defaults to empty string.
77+
*/
7978
//'requireAuth.source' => 'default-sp',
8079

81-
/**
82-
* For how many days should the detailed statistics be kept. Minimum is 31.
83-
*/
80+
/*
81+
* For how many days should the detailed statistics be kept. Minimum is 31.
82+
*/
8483
//'keepPerUser' => 62,
8584
];

ecs.php

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,27 @@
33
declare(strict_types=1);
44

55
use PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer;
6+
use PhpCsFixer\Fixer\FunctionNotation\FunctionTypehintSpaceFixer;
7+
use PhpCsFixer\Fixer\Operator\NotOperatorWithSuccessorSpaceFixer;
68
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
79
use Symplify\EasyCodingStandard\ValueObject\Option;
810
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;
911

1012
return static function (ContainerConfigurator $containerConfigurator): void {
11-
$services = $containerConfigurator->services();
12-
$services->set(ArraySyntaxFixer::class)
13-
->call('configure', [[
14-
'syntax' => 'short',
15-
]])
16-
;
17-
1813
$parameters = $containerConfigurator->parameters();
1914
$parameters->set(Option::PATHS, [
2015
__DIR__ . '/ecs.php',
2116
__DIR__ . '/config-templates',
22-
__DIR__ . '/dictionaries',
2317
__DIR__ . '/hooks',
2418
__DIR__ . '/lib',
2519
__DIR__ . '/scripts',
2620
__DIR__ . '/templates',
2721
__DIR__ . '/www',
28-
__DIR__ . '/composer.json',
2922
]);
23+
$parameters->set(Option::PARALLEL, true);
24+
$parameters->set(Option::SKIP, [NotOperatorWithSuccessorSpaceFixer::class, FunctionTypehintSpaceFixer::class]);
3025

26+
$containerConfigurator->import(SetList::PHP_CS_FIXER);
3127
$containerConfigurator->import(SetList::CLEAN_CODE);
3228
$containerConfigurator->import(SetList::SYMPLIFY);
3329
$containerConfigurator->import(SetList::ARRAY);
@@ -38,5 +34,14 @@
3834
$containerConfigurator->import(SetList::NAMESPACES);
3935
$containerConfigurator->import(SetList::PHPUNIT);
4036
$containerConfigurator->import(SetList::SPACES);
37+
$containerConfigurator->import(SetList::STRICT);
38+
$containerConfigurator->import(SetList::SYMFONY);
4139
$containerConfigurator->import(SetList::PSR_12);
40+
41+
$services = $containerConfigurator->services();
42+
$services->set(ArraySyntaxFixer::class)
43+
->call('configure', [[
44+
'syntax' => 'short',
45+
]])
46+
;
4247
};

hooks/hook_cron.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
/**
99
* Hook to run a cron job.
1010
*
11-
* @param array $croninfo Output
11+
* @param array $croninfo Output
1212
*/
1313
function proxystatistics_hook_cron(&$croninfo)
1414
{
15-
if ($croninfo['tag'] !== 'daily') {
15+
if ('daily' !== $croninfo['tag']) {
1616
Logger::debug('cron [proxystatistics]: Skipping cron in cron tag [' . $croninfo['tag'] . '] ');
17+
1718
return;
1819
}
1920

lib/Config.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Config
3636

3737
private $mode;
3838

39-
private static $instance = null;
39+
private static $instance;
4040

4141
private function __construct()
4242
{
@@ -52,9 +52,10 @@ private function __clone()
5252

5353
public static function getInstance()
5454
{
55-
if (self::$instance === null) {
55+
if (null === self::$instance) {
5656
self::$instance = new self();
5757
}
58+
5859
return self::$instance;
5960
}
6061

@@ -81,6 +82,7 @@ public function getIdAttribute()
8182
public function getSideInfo($side)
8283
{
8384
assert(in_array($side, [self::SIDES], true));
85+
8486
return array_merge([
8587
'name' => '',
8688
'id' => '',

0 commit comments

Comments
 (0)