diff --git a/composer.json b/composer.json index f77d2dd..9b03760 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,6 @@ }, "require-dev": { "phpunit/phpunit": "~4.3", - "squizlabs/php_codesniffer": "~1.5" + "squizlabs/php_codesniffer": "~2.0" } } diff --git a/composer.lock b/composer.lock index ea1c1fd..a3e6a6e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "8e2420d013fd288f34c13ffdcd7f5358", + "hash": "ee26bb63a7bd6ac9a349a3a23d6299af", "packages": [ { "name": "psr/log", @@ -952,32 +952,31 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "1.5.6", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5" + "reference": "5046b0e01c416fc2b06df961d0673c85bcdc896c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/6f3e42d311b882b25b4d409d23a289f4d3b803d5", - "reference": "6f3e42d311b882b25b4d409d23a289f4d3b803d5", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/5046b0e01c416fc2b06df961d0673c85bcdc896c", + "reference": "5046b0e01c416fc2b06df961d0673c85bcdc896c", "shasum": "" }, "require": { "ext-tokenizer": "*", + "ext-xmlwriter": "*", "php": ">=5.1.2" }, - "suggest": { - "phpunit/php-timer": "dev-master" - }, "bin": [ - "scripts/phpcs" + "scripts/phpcs", + "scripts/phpcbf" ], "type": "library", "extra": { "branch-alias": { - "dev-phpcs-fixer": "2.0.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { @@ -986,12 +985,12 @@ "CodeSniffer/CLI.php", "CodeSniffer/Exception.php", "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", "CodeSniffer/Report.php", "CodeSniffer/Reporting.php", "CodeSniffer/Sniff.php", "CodeSniffer/Tokens.php", "CodeSniffer/Reports/", - "CodeSniffer/CommentParser/", "CodeSniffer/Tokenizers/", "CodeSniffer/DocGenerators/", "CodeSniffer/Standards/AbstractPatternSniff.php", @@ -1017,13 +1016,13 @@ "role": "lead" } ], - "description": "PHP_CodeSniffer tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", "homepage": "http://www.squizlabs.com/php-codesniffer", "keywords": [ "phpcs", "standards" ], - "time": "2014-12-04 22:32:15" + "time": "2015-03-04 02:07:03" }, { "name": "symfony/yaml", diff --git a/src/Gelf/Logger.php b/src/Gelf/Logger.php index 7a68eea..ce0c5dc 100644 --- a/src/Gelf/Logger.php +++ b/src/Gelf/Logger.php @@ -63,8 +63,7 @@ public function log($level, $rawMessage, array $context = array()) $message = $this->initMessage($level, $rawMessage, $context); // add exception data if present - if ( - isset($context['exception']) + if (isset($context['exception']) && $context['exception'] instanceof Exception ) { $this->initExceptionData($message, $context['exception']); diff --git a/tests/Gelf/Test/Transport/HttpTransportTest.php b/tests/Gelf/Test/Transport/HttpTransportTest.php index 702bee9..eca6653 100644 --- a/tests/Gelf/Test/Transport/HttpTransportTest.php +++ b/tests/Gelf/Test/Transport/HttpTransportTest.php @@ -132,11 +132,17 @@ public function testFromUrlConstructor() $this->validateTransport($transport, 'localhost', 443, '', $sslOptions, null); } - public function validateTransport(HttpTransport $transport, $host, $port, $path, $sslOptions = null, $authentication = null) - { + public function validateTransport( + HttpTransport $transport, + $host, + $port, + $path, + $sslOptions = null, + $authentication = null + ) { $r = new \ReflectionObject($transport); - foreach(array('host', 'port', 'path', 'sslOptions', 'authentication') as $test) { + foreach (array('host', 'port', 'path', 'sslOptions', 'authentication') as $test) { $p = $r->getProperty($test); $p->setAccessible(true); $this->assertEquals(${$test}, $p->getValue($transport)); @@ -216,7 +222,7 @@ public function testAuthentication() $test = $this; $this->socketClient->expects($this->once()) ->method("write") - ->will($this->returnCallback(function($data) use ($test) { + ->will($this->returnCallback(function ($data) use ($test) { $test->assertContains("Authorization: Basic " . base64_encode("test:test"), $data); }));