Skip to content

Commit

Permalink
CS fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Seldaek committed Mar 1, 2015
1 parent 951f024 commit 995a61b
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 16 deletions.
15 changes: 15 additions & 0 deletions .php_cs
@@ -0,0 +1,15 @@
<?php

$finder = Symfony\CS\Finder\DefaultFinder::create()
->files()
->name('*.php')
->in(__DIR__.'/src')
->in(__DIR__.'/tests')
;

return Symfony\CS\Config\Config::create()
->fixers(array(
'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',
))
->finder($finder)
;
2 changes: 1 addition & 1 deletion src/Monolog/Handler/NewRelicHandler.php
Expand Up @@ -16,7 +16,7 @@
/**
* Class to record a log on a NewRelic application.
* Enabling New Relic High Security mode may prevent capture of useful information.
*
*
* @see https://docs.newrelic.com/docs/agents/php-agent
* @see https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security
*/
Expand Down
1 change: 0 additions & 1 deletion src/Monolog/Handler/SamplingHandler.php
Expand Up @@ -11,7 +11,6 @@

namespace Monolog\Handler;


/**
* Sampling handler
*
Expand Down
9 changes: 2 additions & 7 deletions src/Monolog/Handler/SlackHandler.php
Expand Up @@ -157,11 +157,8 @@ private function buildContent($record)
}

if ($this->includeExtra) {

if (!empty($record['extra'])) {

if ($this->useShortAttachment) {

$attachment['fields'][] = array(
'title' => "Extra",
'value' => $this->stringify($record['extra']),
Expand All @@ -170,7 +167,7 @@ private function buildContent($record)
} else {
// Add all extra fields as individual fields in attachment
foreach ($record['extra'] as $var => $val) {
$attachment['fields'][] = array(
$attachment['fields'][] = array(
'title' => $var,
'value' => $val,
'short' => $this->useShortAttachment
Expand All @@ -180,9 +177,7 @@ private function buildContent($record)
}

if (!empty($record['context'])) {

if ($this->useShortAttachment) {

$attachment['fields'][] = array(
'title' => "Context",
'value' => $this->stringify($record['context']),
Expand All @@ -191,7 +186,7 @@ private function buildContent($record)
} else {
// Add all context fields as individual fields in attachment
foreach ($record['context'] as $var => $val) {
$attachment['fields'][] = array(
$attachment['fields'][] = array(
'title' => $var,
'value' => $val,
'short' => $this->useShortAttachment
Expand Down
1 change: 1 addition & 0 deletions src/Monolog/Registry.php
Expand Up @@ -72,6 +72,7 @@ public static function hasLogger($logger)
{
if ($logger instanceof Logger) {
$index = array_search($logger, self::$loggers, true);

return false !== $index;
} else {
return isset(self::$loggers[$logger]);
Expand Down
4 changes: 2 additions & 2 deletions tests/Monolog/Handler/GelfHandlerLegacyTest.php
Expand Up @@ -24,7 +24,7 @@ public function setUp()
$this->markTestSkipped("mlehner/gelf-php not installed");
}

require_once __DIR__ . '/GelfMocks.php';
require_once __DIR__ . '/GelfMockMessagePublisher.php';
}

/**
Expand All @@ -45,7 +45,7 @@ protected function getHandler($messagePublisher)

protected function getMessagePublisher()
{
return new MockMessagePublisher('localhost');
return new GelfMockMessagePublisher('localhost');
}

public function testDebug()
Expand Down
Expand Up @@ -14,7 +14,7 @@
use Gelf\MessagePublisher;
use Gelf\Message;

class MockMessagePublisher extends MessagePublisher
class GelfMockMessagePublisher extends MessagePublisher
{
public function publish(Message $message)
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Monolog/Handler/RavenHandlerTest.php
Expand Up @@ -86,12 +86,12 @@ public function testTag()
}

public function testUserContext()
{
{
$ravenClient = $this->getRavenClient();
$handler = $this->getHandler($ravenClient);

$user = array(
'id' => '123',
'id' => '123',
'email' => 'test@test.com'
);
$record = $this->getRecord(Logger::INFO, "test", array('user' => $user));
Expand Down
3 changes: 1 addition & 2 deletions tests/Monolog/RegistryTest.php
Expand Up @@ -11,8 +11,6 @@

namespace Monolog;

use Monolog\Logger;
use Monolog\Registry;

class RegistryTest extends \PHPUnit_Framework_TestCase
{
Expand Down Expand Up @@ -40,6 +38,7 @@ public function hasLoggerProvider()
$logger1 = new Logger('test1');
$logger2 = new Logger('test2');
$logger3 = new Logger('test3');

return array(
// only instances
array(
Expand Down

0 comments on commit 995a61b

Please sign in to comment.