Skip to content

Commit c889fb2

Browse files
committed
CS fixes & upgrading cs fixer config
1 parent 75ca9e5 commit c889fb2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+288
-218
lines changed

.php_cs

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,58 @@
1-
<?php
2-
3-
$finder = Symfony\CS\Finder\DefaultFinder::create()
4-
->files()
5-
->name('*.php')
6-
->in(__DIR__.'/src')
7-
->in(__DIR__.'/tests')
8-
;
9-
10-
return Symfony\CS\Config\Config::create()
11-
->fixers(array(
12-
'psr0', 'encoding', 'short_tag', 'braces', 'elseif', 'eof_ending', 'function_declaration', 'indentation', 'line_after_namespace', 'linefeed', 'lowercase_constants', 'lowercase_keywords', 'multiple_use', 'php_closing_tag', 'trailing_spaces', 'visibility', 'duplicate_semicolon', 'extra_empty_lines', 'include', 'namespace_no_leading_whitespace', 'object_operator', 'operators_spaces', 'phpdoc_params', 'return', 'single_array_no_trailing_comma', 'spaces_cast', 'standardize_not_equal', 'ternary_spaces', 'unused_use', 'whitespacy_lines',
13-
))
14-
->finder($finder)
15-
;
1+
<?php
2+
3+
$header = <<<EOF
4+
This file is part of the Monolog package.
5+
6+
(c) Jordi Boggiano <[email protected]>
7+
8+
For the full copyright and license information, please view the LICENSE
9+
file that was distributed with this source code.
10+
EOF;
11+
12+
$finder = Symfony\CS\Finder\DefaultFinder::create()
13+
->files()
14+
->name('*.php')
15+
->exclude('Fixtures')
16+
->in(__DIR__.'/src')
17+
->in(__DIR__.'/tests')
18+
;
19+
20+
return Symfony\CS\Config\Config::create()
21+
->setUsingCache(true)
22+
->setRiskyAllowed(true)
23+
->setRules(array(
24+
'@PSR2' => true,
25+
'duplicate_semicolon' => true,
26+
'extra_empty_lines' => true,
27+
'header_comment' => array('header' => $header),
28+
'include' => true,
29+
'long_array_syntax' => true,
30+
'method_separation' => true,
31+
'multiline_array_trailing_comma' => true,
32+
'namespace_no_leading_whitespace' => true,
33+
'no_blank_lines_after_class_opening' => true,
34+
'no_empty_lines_after_phpdocs' => true,
35+
'object_operator' => true,
36+
'operators_spaces' => true,
37+
'phpdoc_align' => true,
38+
'phpdoc_indent' => true,
39+
'phpdoc_no_access' => true,
40+
'phpdoc_no_package' => true,
41+
'phpdoc_order' => true,
42+
'phpdoc_scalar' => true,
43+
'phpdoc_trim' => true,
44+
'phpdoc_type_to_var' => true,
45+
'psr0' => true,
46+
'return' => true,
47+
'remove_leading_slash_use' => true,
48+
'remove_lines_between_uses' => true,
49+
'single_array_no_trailing_comma' => true,
50+
'single_blank_line_before_namespace' => true,
51+
'spaces_cast' => true,
52+
'standardize_not_equal' => true,
53+
'ternary_spaces' => true,
54+
'unused_use' => true,
55+
'whitespacy_lines' => true,
56+
))
57+
->finder($finder)
58+
;

src/Monolog/Formatter/FluentdFormatter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
*
3333
* @author Andrius Putna <[email protected]>
3434
*/
35-
3635
class FluentdFormatter implements FormatterInterface
3736
{
3837
/**
@@ -46,7 +45,7 @@ public function __construct($levelTag = false)
4645
throw new \RuntimeException('PHP\'s json extension is required to use Monolog\'s FluentdUnixFormatter');
4746
}
4847

49-
$this->levelTag = (bool)$levelTag;
48+
$this->levelTag = (bool) $levelTag;
5049
}
5150

5251
public function isUsingLevelsInTag()
@@ -63,7 +62,7 @@ public function format(array $record)
6362

6463
$message = array(
6564
'message' => $record['message'],
66-
'extra' => $record['extra']
65+
'extra' => $record['extra'],
6766
);
6867

6968
if (!$this->levelTag) {
@@ -86,6 +85,7 @@ public function formatBatch(array $records)
8685
foreach ($records as $record) {
8786
$message .= $this->format($record);
8887
}
88+
8989
return $message;
9090
}
9191
}

src/Monolog/Formatter/HtmlFormatter.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ private function addRow($th, $td = ' ', $escapeTd = true)
6464
/**
6565
* Create a HTML h1 tag
6666
*
67-
* @param string $title Text to be in the h1
68-
* @param integer $level Error level
67+
* @param string $title Text to be in the h1
68+
* @param int $level Error level
6969
* @return string
7070
*/
7171
private function addTitle($title, $level)
@@ -74,6 +74,7 @@ private function addTitle($title, $level)
7474

7575
return '<h1 style="background: '.$this->logLevels[$level].';color: #ffffff;padding: 5px;" class="monolog-output">'.$title.'</h1>';
7676
}
77+
7778
/**
7879
* Formats a log record.
7980
*

src/Monolog/Formatter/LogglyFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class LogglyFormatter extends JsonFormatter
2222
* Overrides the default batch mode to new lines for compatibility with the
2323
* Loggly bulk API.
2424
*
25-
* @param integer $batchMode
25+
* @param int $batchMode
2626
*/
2727
public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false)
2828
{

src/Monolog/Formatter/LogstashFormatter.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,16 +45,16 @@ class LogstashFormatter extends NormalizerFormatter
4545
protected $contextPrefix;
4646

4747
/**
48-
* @var integer logstash format version to use
48+
* @var int logstash format version to use
4949
*/
5050
protected $version;
5151

5252
/**
53-
* @param string $applicationName the application that sends the data, used as the "type" field of logstash
54-
* @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine
55-
* @param string $extraPrefix prefix for extra keys inside logstash "fields"
56-
* @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_
57-
* @param integer $version the logstash format version to use, defaults to 0
53+
* @param string $applicationName the application that sends the data, used as the "type" field of logstash
54+
* @param string $systemName the system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine
55+
* @param string $extraPrefix prefix for extra keys inside logstash "fields"
56+
* @param string $contextPrefix prefix for context keys inside logstash "fields", defaults to ctxt_
57+
* @param int $version the logstash format version to use, defaults to 0
5858
*/
5959
public function __construct($applicationName, $systemName = null, $extraPrefix = null, $contextPrefix = 'ctxt_', $version = self::V0)
6060
{
@@ -92,7 +92,7 @@ protected function formatV0(array $record)
9292
$message = array(
9393
'@timestamp' => $record['datetime'],
9494
'@source' => $this->systemName,
95-
'@fields' => array()
95+
'@fields' => array(),
9696
);
9797
if (isset($record['message'])) {
9898
$message['@message'] = $record['message'];

src/Monolog/Formatter/NormalizerFormatter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ protected function toJson($data, $ignoreErrors = false)
165165
/**
166166
* Throws an exception according to a given code with a customized message
167167
*
168-
* @param int $code return code of json_last_error function
169-
* @param mixed $data data that was meant to be encoded
168+
* @param int $code return code of json_last_error function
169+
* @param mixed $data data that was meant to be encoded
170170
* @throws \RuntimeException
171171
*/
172172
private function throwEncodeError($code, $data)

src/Monolog/Handler/AbstractHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ abstract class AbstractHandler implements HandlerInterface
3232
protected $processors = array();
3333

3434
/**
35-
* @param integer $level The minimum logging level at which this handler will be triggered
35+
* @param int $level The minimum logging level at which this handler will be triggered
3636
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
3737
*/
3838
public function __construct($level = Logger::DEBUG, $bubble = true)
@@ -118,7 +118,7 @@ public function getFormatter()
118118
/**
119119
* Sets minimum logging level at which this handler will be triggered.
120120
*
121-
* @param integer $level
121+
* @param int $level
122122
* @return self
123123
*/
124124
public function setLevel($level)
@@ -131,7 +131,7 @@ public function setLevel($level)
131131
/**
132132
* Gets minimum logging level at which this handler will be triggered.
133133
*
134-
* @return integer
134+
* @return int
135135
*/
136136
public function getLevel()
137137
{

src/Monolog/Handler/AbstractSyslogHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ abstract class AbstractSyslogHandler extends AbstractProcessingHandler
5454

5555
/**
5656
* @param mixed $facility
57-
* @param integer $level The minimum logging level at which this handler will be triggered
57+
* @param int $level The minimum logging level at which this handler will be triggered
5858
* @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
5959
*/
6060
public function __construct($facility = LOG_USER, $level = Logger::DEBUG, $bubble = true)

src/Monolog/Handler/AmqpHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ protected function write(array $record)
7070
0,
7171
array(
7272
'delivery_mode' => 2,
73-
'Content-type' => 'application/json'
73+
'Content-type' => 'application/json',
7474
)
7575
);
7676
} else {
@@ -79,7 +79,7 @@ protected function write(array $record)
7979
(string) $data,
8080
array(
8181
'delivery_mode' => 2,
82-
'content_type' => 'application/json'
82+
'content_type' => 'application/json',
8383
)
8484
),
8585
$this->exchangeName,

src/Monolog/Handler/BrowserConsoleHandler.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ class BrowserConsoleHandler extends AbstractProcessingHandler
3131
* Example of formatted string:
3232
*
3333
* You can do [[blue text]]{color: blue} or [[green background]]{background-color: green; color: white}
34-
*
3534
*/
3635
protected function getDefaultFormatter()
3736
{

0 commit comments

Comments
 (0)