Skip to content

Commit 69e03ba

Browse files
authored
Update StyleCI config + fixes
1 parent b6bb40b commit 69e03ba

4 files changed

Lines changed: 102 additions & 14 deletions

File tree

.styleci.yml

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,90 @@
11
preset: psr12
2+
risky: true
3+
4+
version: 8
25

36
finder:
4-
exclude:
5-
- docs
6-
- vendor
7+
exclude:
8+
- docs
9+
- vendor
10+
- resources
11+
- views
12+
- public
13+
not-name:
14+
- UnionCar.php
15+
16+
enabled:
17+
- alpha_ordered_imports
18+
- alpha_ordered_traits
19+
- array_indentation
20+
- array_push
21+
- combine_consecutive_issets
22+
- combine_consecutive_unsets
23+
- combine_nested_dirname
24+
- declare_strict_types
25+
- dir_constant
26+
- final_static_access
27+
- fully_qualified_strict_types
28+
- function_to_constant
29+
- hash_to_slash_comment
30+
- is_null
31+
- logical_operators
32+
- magic_constant_casing
33+
- magic_method_casing
34+
- method_separation
35+
- modernize_types_casting
36+
- native_function_casing
37+
- native_function_type_declaration_casing
38+
- no_alias_functions
39+
- no_alternative_syntax
40+
- no_empty_comment
41+
- no_empty_phpdoc
42+
- no_empty_statement
43+
- no_extra_block_blank_lines
44+
- no_short_bool_cast
45+
- no_short_echo_tag
46+
- no_superfluous_elseif
47+
- no_unneeded_control_parentheses
48+
- no_unneeded_curly_braces
49+
- no_unneeded_final_method
50+
- no_unset_cast
51+
- no_unused_imports
52+
- no_unused_lambda_imports
53+
- no_useless_else
54+
- no_useless_return
55+
- normalize_index_brace
56+
- php_unit_dedicate_assert
57+
- php_unit_dedicate_assert_internal_type
58+
- php_unit_expectation
59+
- php_unit_mock
60+
- php_unit_mock_short_will_return
61+
- php_unit_namespaced
62+
- php_unit_no_expectation_annotation
63+
- phpdoc_no_empty_return
64+
- phpdoc_no_useless_inheritdoc
65+
- phpdoc_order
66+
- phpdoc_property
67+
- phpdoc_scalar
68+
- phpdoc_separation
69+
- phpdoc_singular_inheritdoc
70+
- phpdoc_trim
71+
- phpdoc_trim_consecutive_blank_line_separation
72+
- phpdoc_type_to_var
73+
- phpdoc_types
74+
- phpdoc_types_order
75+
- phpdoc_var_without_name
76+
- print_to_echo
77+
- regular_callable_call
78+
- return_assignment
79+
- self_accessor
80+
- self_static_accessor
81+
- set_type_to_cast
82+
- short_array_syntax
83+
- short_list_syntax
84+
- simplified_if_return
85+
- single_quote
86+
- standardize_not_equals
87+
- ternary_to_null_coalescing
88+
- trailing_comma_in_multiline_array
89+
- unalign_double_arrow
90+
- unalign_equals

src/SyslogTarget.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ class SyslogTarget extends Target
2727
/**
2828
* @var int openlog options. This is a bitfield passed as the `$option` parameter to [openlog()](http://php.net/openlog).
2929
* Defaults to `LOG_ODELAY | LOG_PID`.
30+
*
3031
* @see http://php.net/openlog for available options.
3132
*/
3233
private int $options = LOG_ODELAY | LOG_PID;
@@ -66,6 +67,7 @@ public function setOptions(int $options): self
6667
/**
6768
* Writes log messages to syslog.
6869
* Starting from version 2.0.14, this method throws LogRuntimeException in case the log can not be exported.
70+
*
6971
* @throws LogRuntimeException
7072
* @throws \Throwable
7173
*/
@@ -82,6 +84,7 @@ public function export(): void
8284

8385
/**
8486
* {@inheritdoc}
87+
*
8588
* @throws \Throwable
8689
*/
8790
public function formatMessage(array $message): string

tests/SyslogTargetTest.php

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
declare(strict_types=1);
44

55
namespace Yiisoft\Log\Target\Syslog {
6-
76
function openlog(...$args)
87
{
98
return \Yiisoft\Log\Target\Syslog\Tests\SyslogTargetTest::openlog($args);
@@ -21,7 +20,6 @@ function closelog(...$args)
2120
}
2221

2322
namespace Yiisoft\Log\Target\Syslog\Tests {
24-
2523
use Psr\Log\LogLevel;
2624
use Yiisoft\Log\LogRuntimeException;
2725
use Yiisoft\Log\Target\Syslog\SyslogTarget;
@@ -122,19 +120,19 @@ public function testExport(): void
122120

123121
$syslogTarget->expects($this->once())->method('closelog');
124122

125-
static::$functions['openlog'] = function ($arguments) use ($syslogTarget) {
123+
self::$functions['openlog'] = function ($arguments) use ($syslogTarget) {
126124
$this->assertCount(3, $arguments);
127125
[$identity, $option, $facility] = $arguments;
128126
return $syslogTarget->openlog($identity, $option, $facility);
129127
};
130128

131-
static::$functions['syslog'] = function ($arguments) use ($syslogTarget) {
129+
self::$functions['syslog'] = function ($arguments) use ($syslogTarget) {
132130
$this->assertCount(2, $arguments);
133131
[$priority, $message] = $arguments;
134132
return $syslogTarget->syslog($priority, $message);
135133
};
136134

137-
static::$functions['closelog'] = function ($arguments) use ($syslogTarget) {
135+
self::$functions['closelog'] = function ($arguments) use ($syslogTarget) {
138136
$this->assertCount(0, $arguments);
139137
return $syslogTarget->closelog();
140138
};
@@ -165,17 +163,17 @@ public function testFailedExport(): void
165163
[LogLevel::INFO, 'test', []],
166164
]);
167165

168-
static::$functions['openlog'] = function ($arguments) use ($syslogTarget) {
166+
self::$functions['openlog'] = function ($arguments) use ($syslogTarget) {
169167
$this->assertCount(3, $arguments);
170168
[$identity, $option, $facility] = $arguments;
171169
return $syslogTarget->openlog($identity, $option, $facility);
172170
};
173-
static::$functions['syslog'] = function ($arguments) use ($syslogTarget) {
171+
self::$functions['syslog'] = function ($arguments) use ($syslogTarget) {
174172
$this->assertCount(2, $arguments);
175173
[$priority, $message] = $arguments;
176174
return $syslogTarget->syslog($priority, $message);
177175
};
178-
static::$functions['closelog'] = function ($arguments) use ($syslogTarget) {
176+
self::$functions['closelog'] = function ($arguments) use ($syslogTarget) {
179177
$this->assertCount(0, $arguments);
180178
return $syslogTarget->closelog();
181179
};
@@ -187,15 +185,16 @@ public function testFailedExport(): void
187185
/**
188186
* @param $name
189187
* @param $arguments
188+
*
190189
* @return mixed
191190
*/
192191
public static function __callStatic($name, $arguments)
193192
{
194-
if (isset(static::$functions[$name]) && is_callable(static::$functions[$name])) {
193+
if (isset(self::$functions[$name]) && is_callable(self::$functions[$name])) {
195194
$arguments = $arguments[0] ?? $arguments;
196-
return forward_static_call(static::$functions[$name], $arguments);
195+
return forward_static_call(self::$functions[$name], $arguments);
197196
}
198-
static::fail("Function '$name' has not implemented yet!");
197+
self::fail("Function '$name' has not implemented yet!");
199198
}
200199

201200
/**

tests/bootstrap.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
/** @noinspection PhpIncludeInspection */
46

57
// ensure we get report on all possible php errors

0 commit comments

Comments
 (0)