Skip to content

Commit 42d0543

Browse files
author
igor-chepurnoi
committed
fix code style
1 parent 062fd0a commit 42d0543

17 files changed

+98
-60
lines changed

.php_cs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
$finder = Symfony\CS\Finder::create()
4+
->exclude('vendor')
5+
->in([__DIR__]);
6+
7+
$config = Symfony\CS\Config::create()
8+
->fixers([
9+
'-phpdoc_params',
10+
'-phpdoc_short_description',
11+
'-phpdoc_inline_tag',
12+
'-pre_increment',
13+
'-heredoc_to_nowdoc',
14+
'-spaces_cast',
15+
'-include',
16+
'-phpdoc_no_package',
17+
'concat_with_spaces',
18+
'ordered_use',
19+
'short_array_syntax',
20+
])
21+
->finder($finder);
22+
23+
return $config;

.travis.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ php:
55
- 5.5
66
- 5.6
77
- 7.0
8-
- hhvm
9-
10-
# run build against hhvm but allow them to fail
11-
# http://docs.travis-ci.com/user/build-configuration/#Rows-That-are-Allowed-To-Fail
12-
matrix:
13-
fast_finish: true
14-
allow_failures:
15-
- php: hhvm
168

179
# faster builds on new travis setup not using sudo
1810
sudo: false
@@ -21,6 +13,7 @@ sudo: false
2113
cache:
2214
directories:
2315
- $HOME/.composer/cache
16+
- vendor
2417

2518
install:
2619
- travis_retry composer self-update && composer --version
@@ -29,4 +22,5 @@ install:
2922
- travis_retry composer install --prefer-dist --no-interaction
3023

3124
script:
32-
- phpunit --verbose $PHPUNIT_FLAGS
25+
- vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --dry-run --diff
26+
- phpunit --verbose $PHPUNIT_FLAGS

actions/CronLogAction.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77

88
/**
99
* Class CronLogAction
10+
*
1011
* @package yii2mod\cron\actions
1112
*/
1213
class CronLogAction extends Action
1314
{
1415
/**
15-
* @var string name of the view, which should be rendered.
16+
* @var string name of the view, which should be rendered
1617
*/
1718
public $view = '@vendor/yii2mod/yii2-cron-log/views/index';
1819

@@ -31,7 +32,7 @@ public function run()
3132

3233
return $this->controller->render($this->view, [
3334
'searchModel' => $searchModel,
34-
'dataProvider' => $dataProvider
35+
'dataProvider' => $dataProvider,
3536
]);
3637
}
37-
}
38+
}

behaviors/CronLoggerBehavior.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class CronLoggerBehavior extends Behavior
4040
protected $schedule;
4141

4242
/**
43-
* @var array list of action names, which should be logged.
43+
* @var array list of action names, which should be logged
4444
*/
4545
public $actions = [];
4646

@@ -52,7 +52,7 @@ class CronLoggerBehavior extends Behavior
5252
/**
5353
* Declares event handlers for the [[owner]]'s events.
5454
*
55-
* @return array events (array keys) and the corresponding event handler methods (array values).
55+
* @return array events (array keys) and the corresponding event handler methods (array values)
5656
*/
5757
public function events()
5858
{
@@ -64,6 +64,7 @@ public function events()
6464

6565
/**
6666
* Before action
67+
*
6768
* @param $event \yii\base\ActionEvent
6869
*/
6970
public function beforeAction($event)
@@ -79,6 +80,7 @@ public function beforeAction($event)
7980

8081
/**
8182
* After action
83+
*
8284
* @param $event \yii\base\ActionEvent
8385
*/
8486
public function afterAction($event)
@@ -124,4 +126,4 @@ private function getActionParams()
124126

125127
return $result;
126128
}
127-
}
129+
}

behaviors/MutexConsoleCommandBehavior.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,18 @@
2727
* ```
2828
*
2929
* Class MutexConsoleCommandBehavior
30+
*
3031
* @package yii2mod\cron\behaviors
3132
*/
3233
class MutexConsoleCommandBehavior extends Behavior
3334
{
3435
/**
35-
* @var string name of the mutex application component.
36+
* @var string name of the mutex application component
3637
*/
3738
public $mutex = 'mutex';
3839

3940
/**
40-
* @var array list of action names, which mutex should be applied to.
41+
* @var array list of action names, which mutex should be applied to
4142
*/
4243
public $mutexActions = [];
4344

@@ -53,7 +54,7 @@ public function events()
5354
}
5455

5556
/**
56-
* @return Mutex mutex application component instance.
57+
* @return Mutex mutex application component instance
5758
*/
5859
public function getMutex()
5960
{
@@ -63,9 +64,9 @@ public function getMutex()
6364
/**
6465
* Composes the mutex name.
6566
*
66-
* @param string $action command action name.
67+
* @param string $action command action name
6768
*
68-
* @return string mutex name.
69+
* @return string mutex name
6970
*/
7071
protected function composeMutexName($action)
7172
{
@@ -75,9 +76,9 @@ protected function composeMutexName($action)
7576
/**
7677
* Checks if specified action is among mutex actions.
7778
*
78-
* @param string $action action name.
79+
* @param string $action action name
7980
*
80-
* @return boolean whether action should be under mutex.
81+
* @return bool whether action should be under mutex
8182
*/
8283
public function checkIsMutexAction($action)
8384
{
@@ -86,6 +87,7 @@ public function checkIsMutexAction($action)
8687

8788
/**
8889
* @param $event
90+
*
8991
* @return bool
9092
*/
9193
public function beforeAction($event)
@@ -95,6 +97,7 @@ public function beforeAction($event)
9597
if (!$this->getMutex()->acquire($mutexName)) {
9698
echo "Execution terminated: command is already running.\n";
9799
$event->isValid = false;
100+
98101
return false;
99102
}
100103
}
@@ -110,4 +113,4 @@ public function afterAction($event)
110113
$this->getMutex()->release($mutexName);
111114
}
112115
}
113-
}
116+
}

components/ErrorHandler.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
/**
1010
* Class ErrorHandler
11+
*
1112
* @package yii2mod\cron\components
1213
*/
1314
class ErrorHandler extends \yii\console\ErrorHandler
@@ -36,4 +37,4 @@ public function logException($exception)
3637
}
3738
\Yii::error((string)$exception, $category);
3839
}
39-
}
40+
}

composer.json

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,32 @@
22
"name": "yii2mod/yii2-cron-log",
33
"description": "Component for logging cron jobs",
44
"type": "yii2-extension",
5-
"keywords": ["yii2 cron log", "cron log", "logging cron jobs"],
5+
"keywords": [
6+
"yii2 cron log",
7+
"cron log",
8+
"logging cron jobs"
9+
],
610
"license": "MIT",
711
"authors": [
8-
{
9-
"name": "Dmitry Semenov",
10-
"email": "disemx@gmail.com"
11-
},
12-
{
13-
"name": "Igor Chepurnoy",
14-
"email": "igorzfort@gmail.com"
15-
}
12+
{
13+
"name": "Dmitry Semenov",
14+
"email": "disemx@gmail.com"
15+
},
16+
{
17+
"name": "Igor Chepurnoy",
18+
"email": "igorzfort@gmail.com"
19+
}
1620
],
1721
"require": {
18-
"yiisoft/yii2": ">=2.0.8",
19-
"yii2mod/yii2-enum": ">=1.1"
22+
"yiisoft/yii2": ">=2.0.8",
23+
"yii2mod/yii2-enum": ">=1.4"
24+
},
25+
"require-dev": {
26+
"friendsofphp/php-cs-fixer": "~1.7"
2027
},
2128
"autoload": {
22-
"psr-4": {
23-
"yii2mod\\cron\\": ""
24-
}
29+
"psr-4": {
30+
"yii2mod\\cron\\": ""
31+
}
2532
}
2633
}

messages/en/yii2mod-cron-log.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@
2727
'Status' => 'Status',
2828
'Success' => 'Success',
2929
'Error' => 'Error',
30-
'Run' => 'Run'
30+
'Run' => 'Run',
3131
];

messages/ru/yii2mod-cron-log.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@
2727
'Status' => 'Статус',
2828
'Success' => 'Успешное завершение',
2929
'Error' => 'Ошибка',
30-
'Run' => 'Выполняется'
30+
'Run' => 'Выполняется',
3131
];

models/CronScheduleModel.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public function attributeLabels()
6060
* @param string $jobCode
6161
* @param int $status
6262
* @param null $messages
63+
*
6364
* @return bool
6465
*/
6566
public function startCronSchedule($jobCode, $status = CronScheduleStatus::RUN, $messages = null)
@@ -78,7 +79,7 @@ public function startCronSchedule($jobCode, $status = CronScheduleStatus::RUN, $
7879
* @param string $status
7980
* @param null $messages
8081
*
81-
* @return boolean
82+
* @return bool
8283
*/
8384
public function endCronSchedule($status, $messages = null)
8485
{
@@ -92,4 +93,4 @@ public function endCronSchedule($status, $messages = null)
9293

9394
return false;
9495
}
95-
}
96+
}

0 commit comments

Comments
 (0)