Skip to content

Commit c2c0ad6

Browse files
committed
Merge branch 'feature-php-cs' into 'master'
phpcs implementation See merge request head.trackingsoft/micro-plugin-logger-monolog!2
2 parents 18edcc5 + 9d6796d commit c2c0ad6

File tree

10 files changed

+81
-19
lines changed

10 files changed

+81
-19
lines changed

phpcs.xml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ruleset name="pcsg-generated-ruleset">
3+
<file>src/</file>
4+
<arg name="basepath" value="."/>
5+
<arg name="colors"/>
6+
<arg name="no-cache"/>
7+
<description>
8+
Micro Framework - сode formatting rules.
9+
</description>
10+
<rule ref="Generic.CodeAnalysis.EmptyStatement"/>
11+
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
12+
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
13+
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
14+
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
15+
<rule ref="Generic.ControlStructures.InlineControlStructure"/>
16+
<rule ref="Generic.Files.ByteOrderMark"/>
17+
<rule ref="Generic.Files.LineEndings"/>
18+
<rule ref="Generic.Files.LineLength">
19+
<properties>
20+
<property name="lineLimit" value="120"/>
21+
<property name="absoluteLineLimit" value="150"/>
22+
</properties>
23+
</rule>
24+
<rule ref="Generic.Formatting.DisallowMultipleStatements"/>
25+
<rule ref="Generic.Formatting.MultipleStatementAlignment"/>
26+
<rule ref="Generic.Formatting.NoSpaceAfterCast"/>
27+
<rule ref="Generic.Functions.CallTimePassByReference"/>
28+
<rule ref="Generic.Functions.OpeningFunctionBraceBsdAllman"/>
29+
<rule ref="Generic.Metrics.CyclomaticComplexity"/>
30+
<rule ref="Generic.Metrics.NestingLevel"/>
31+
<rule ref="Generic.NamingConventions.ConstructorName"/>
32+
<rule ref="Generic.NamingConventions.UpperCaseConstantName"/>
33+
<rule ref="Generic.NamingConventions.CamelCapsFunctionName"/>
34+
<rule ref="Generic.PHP.DeprecatedFunctions"/>
35+
<rule ref="Generic.PHP.DisallowShortOpenTag"/>
36+
<rule ref="Generic.PHP.ForbiddenFunctions"/>
37+
<rule ref="Generic.PHP.LowerCaseConstant"/>
38+
<rule ref="Generic.PHP.NoSilencedErrors"/>
39+
<rule ref="Generic.Strings.UnnecessaryStringConcat"/>
40+
<rule ref="Generic.WhiteSpace.DisallowTabIndent"/>
41+
<rule ref="MySource.PHP.EvalObjectFactory"/>
42+
<rule ref="MySource.PHP.GetRequestData"/>
43+
<rule ref="PEAR.Classes.ClassDeclaration"/>
44+
<rule ref="PEAR.Commenting.InlineComment"/>
45+
<rule ref="PEAR.ControlStructures.MultiLineCondition"/>
46+
<rule ref="PEAR.Files.IncludingFile"/>
47+
<rule ref="PEAR.Formatting.MultiLineAssignment"/>
48+
<rule ref="PEAR.Functions.ValidDefaultValue"/>
49+
<rule ref="PEAR.NamingConventions.ValidClassName"/>
50+
<rule ref="PEAR.WhiteSpace.ObjectOperatorIndent"/>
51+
<rule ref="PEAR.WhiteSpace.ScopeClosingBrace"/>
52+
<rule ref="PEAR.WhiteSpace.ScopeIndent"/>
53+
<rule ref="PSR1.Classes.ClassDeclaration"/>
54+
<rule ref="PSR1.Files.SideEffects"/>
55+
<rule ref="PSR2.Classes.ClassDeclaration"/>
56+
<rule ref="PSR2.Classes.PropertyDeclaration"/>
57+
<rule ref="PSR2.ControlStructures.ControlStructureSpacing"/>
58+
<rule ref="PSR2.ControlStructures.ElseIfDeclaration"/>
59+
<rule ref="PSR2.ControlStructures.SwitchDeclaration"/>
60+
<rule ref="PSR2.Files.EndFileNewline"/>
61+
<rule ref="PSR2.Methods.MethodDeclaration"/>
62+
<rule ref="PSR2.Namespaces.NamespaceDeclaration"/>
63+
<rule ref="PSR2.Namespaces.UseDeclaration"/>
64+
</ruleset>

src/Business/Factory/LoggerFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class LoggerFactory implements LoggerFactoryInterface
1313
* @param HandlerResolverFactoryInterface $handlerResolverFactory
1414
*/
1515
public function __construct(
16-
private HandlerResolverFactoryInterface $handlerResolverFactory
16+
private HandlerResolverFactoryInterface $handlerResolverFactory
1717
)
1818
{
1919
}
@@ -23,7 +23,7 @@ public function __construct(
2323
*/
2424
public function create(string $loggerName): LoggerInterface
2525
{
26-
$logger = new Logger($loggerName);
26+
$logger = new Logger($loggerName);
2727
$handlerCollectionGenerator = $this->handlerResolverFactory
2828
->create($loggerName)
2929
->resolve();

src/Business/Handler/HandlerFactory.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ class HandlerFactory implements HandlerFactoryInterface
1212
* @param HandlerConfigurationFactoryInterface $handlerConfigurationFactory
1313
*/
1414
public function __construct(
15-
private Container $container,
16-
private HandlerConfigurationFactoryInterface $handlerConfigurationFactory
15+
private Container $container,
16+
private HandlerConfigurationFactoryInterface $handlerConfigurationFactory
1717
)
1818
{
1919
}
@@ -25,7 +25,7 @@ public function __construct(
2525
public function create(string $handlerName): HandlerInterface
2626
{
2727
$handlerConfiguration = $this->handlerConfigurationFactory->create($handlerName);
28-
$handlerClassName = $handlerConfiguration->getHandlerClassName();
28+
$handlerClassName = $handlerConfiguration->getHandlerClassName();
2929

3030
return new $handlerClassName(
3131
$this->container,

src/Business/Handler/HandlerResolver.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ class HandlerResolver implements HandlerResolverInterface
1212
* @param string $loggerName
1313
*/
1414
public function __construct(
15-
private MonologPluginConfigurationInterface $pluginConfiguration,
16-
private HandlerProviderInterface $handlerProvider,
17-
private string $loggerName
15+
private MonologPluginConfigurationInterface $pluginConfiguration,
16+
private HandlerProviderInterface $handlerProvider,
17+
private string $loggerName
1818
)
1919
{
2020
}

src/Business/Handler/HandlerResolverFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class HandlerResolverFactory implements HandlerResolverFactoryInterface
1111
* @param HandlerProviderInterface $handlerProvider
1212
*/
1313
public function __construct(
14-
private MonologPluginConfigurationInterface $pluginConfiguration,
15-
private HandlerProviderInterface $handlerProvider
14+
private MonologPluginConfigurationInterface $pluginConfiguration,
15+
private HandlerProviderInterface $handlerProvider
1616
)
1717
{
1818
}

src/Business/Handler/Type/Amqp/AmqpHandler.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Micro\Plugin\Logger\Monolog\Business\Handler\Type\Amqp;
44

5-
65
use Micro\Plugin\Amqp\AmqpFacadeInterface;
76
use Micro\Plugin\Amqp\Business\Message\Message;
87
use Micro\Plugin\Amqp\Business\Message\MessageInterface;
@@ -36,7 +35,7 @@ protected function write(array $record): void
3635
$data = $record['formatted'];
3736
/** @var HandlerAmqpConfigurationInterface $configuration */
3837
$configuration = $this->handlerConfiguration;
39-
$message = $this->createMessage($data);
38+
$message = $this->createMessage($data);
4039

4140
$this->getAmqpFacade()->publish($message, $configuration->getPublisherName());
4241
}

src/Configuration/Handler/HandlerConfigurationFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class HandlerConfigurationFactory implements HandlerConfigurationFactoryInterfac
1111
* @param iterable $handlerConfigurationClassCollection
1212
*/
1313
public function __construct(
14-
private MonologPluginConfigurationInterface $pluginConfiguration,
15-
private iterable $handlerConfigurationClassCollection
14+
private MonologPluginConfigurationInterface $pluginConfiguration,
15+
private iterable $handlerConfigurationClassCollection
1616
)
1717
{
1818
}

src/Configuration/Handler/Type/HandlerAmqpConfiguration.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
namespace Micro\Plugin\Logger\Monolog\Configuration\Handler\Type;
44

5-
65
use Micro\Plugin\Logger\Monolog\Business\Handler\Type\Amqp\AmqpHandler;
76
use Micro\Plugin\Logger\Monolog\Configuration\Handler\HandlerConfiguration;
87

98
class HandlerAmqpConfiguration extends HandlerConfiguration implements HandlerAmqpConfigurationInterface
109
{
11-
protected const CFG_PUBLISHER_NAME= 'LOGGER_%s_PUBLISHER';
10+
protected const CFG_PUBLISHER_NAME = 'LOGGER_%s_PUBLISHER';
1211

1312
/**
1413
* @return string

src/Configuration/Handler/Type/HandlerStreamConfiguration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
class HandlerStreamConfiguration extends HandlerConfiguration implements HandlerStreamConfigurationInterface
99
{
10-
protected const CFG_LOG_FILE = 'LOGGER_%s_FILE';
10+
protected const CFG_LOG_FILE = 'LOGGER_%s_FILE';
1111
protected const CFG_USE_LOCKING = 'LOGGER_%s_USE_LOCKING';
1212

1313
public const LOGFILE_DEFAULT_PATH = '/var/log/micro/';

src/MonologPluginConfigurationInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
interface MonologPluginConfigurationInterface extends LoggerPluginConfigurationInterface
1111
{
12-
public const HANDLER_DEFAULT = 'default';
12+
public const HANDLER_DEFAULT = 'default';
1313
public const HANDLER_DEFAULT_TYPE = HandlerStreamConfigurationInterface::TYPE;
14-
public const LOGGER_DEFAULT = 'default';
14+
public const LOGGER_DEFAULT = 'default';
1515

1616

1717
/**

0 commit comments

Comments
 (0)