Skip to content
This repository has been archived by the owner on May 24, 2018. It is now read-only.

CS Fix #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ composer.lock
vendor
Tests/app/cache
Tests/app/logs
.php_cs.cache
18 changes: 18 additions & 0 deletions .php_cs.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

return PhpCsFixer\Config::create()
->setRules(array(
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => array('syntax' => 'long'),
'protected_to_private' => false,
))
->setRiskyAllowed(true)
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__)
->append(array(__FILE__))
->notPath('Tests')
->notPath('spec')
)
;
3 changes: 2 additions & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Staffim\RollbarBundle\DependencyInjection;

use Symfony\Component\Config\Definition\Builder\TreeBuilder;
Expand All @@ -10,7 +11,7 @@
class Configuration implements ConfigurationInterface
{
/**
* {@inheritDoc}
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
Expand Down
3 changes: 2 additions & 1 deletion DependencyInjection/StaffimRollbarExtension.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Staffim\RollbarBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand All @@ -12,7 +13,7 @@
class StaffimRollbarExtension extends Extension
{
/**
* {@inheritDoc}
* {@inheritdoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
Expand Down
6 changes: 4 additions & 2 deletions EventListener/RollbarListener.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Staffim\RollbarBundle\EventListener;

use Exception;
Expand Down Expand Up @@ -82,6 +83,7 @@ public function onConsoleException(ConsoleExceptionEvent $event)

/**
* @param \Exception $exception
*
* @return string
*/
private function reportException(Exception $exception)
Expand All @@ -90,15 +92,15 @@ private function reportException(Exception $exception)
}

/**
* Flush exception stack to Rollbar
* Flush exception stack to Rollbar.
*/
public function onKernelTerminate()
{
$this->exceptionReporter->flush();
}

/**
* Flush exception stack to Rollbar
* Flush exception stack to Rollbar.
*/
public function onConsoleTerminate()
{
Expand Down
4 changes: 2 additions & 2 deletions Resources/config/parameters.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

$container->setParameter('staffim_rollbar.rollbar.arguments', array(
'host' => php_uname('n'),
'host' => php_uname('n'),
'access_token' => '%staffim_rollbar.rollbar.access_token%',
'max_errno' => -1,
'max_errno' => -1,
'environment' => '%staffim_rollbar.rollbar.environment%',
));
26 changes: 14 additions & 12 deletions RollbarReporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ class RollbarReporter
/**
* Constructor.
*
* @param \RollbarNotifier $rollbarNotifier
* @param \RollbarNotifier $rollbarNotifier
* @param \Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $tokenStorage
* @param \Staffim\RollbarBundle\ReportDecisionManager $reportDecisionManager
* @param type $errorLevel
* @param array $scrubExceptions
* @param array $scrubParameters
* @param \Staffim\RollbarBundle\ReportDecisionManager $reportDecisionManager
* @param type $errorLevel
* @param array $scrubExceptions
* @param array $scrubParameters
*/
public function __construct(
RollbarNotifier $rollbarNotifier,
Expand All @@ -72,9 +72,10 @@ public function __construct(
/**
* Report an exception to the rollbar.
*
* @param \Exception $exception
* @param \Exception $exception
* @param \Symfony\Component\HttpFoundation\Request $request
* @param array $extraData
* @param array $extraData
*
* @return string UUID of rollbar item
*/
public function report(Exception $exception, Request $request = null, $extraData = null)
Expand All @@ -97,11 +98,12 @@ public function report(Exception $exception, Request $request = null, $extraData
/**
* Report an error to the rollbar.
*
* @param int $level
* @param string $message
* @param string $file
* @param int $line
* @param int $level
* @param string $message
* @param string $file
* @param int $line
* @param \Symfony\Component\HttpFoundation\Request $request
*
* @return bool
*/
public function reportError($level, $message, $file, $line, Request $request = null)
Expand Down Expand Up @@ -152,7 +154,7 @@ private function scrubException($originalException)
foreach ($trace as $key => $item) {
array_walk_recursive($item['args'], function (&$value, $key, $params) {
if (is_string($value) && $key = array_search($value, $params)) {
$value = '%' . $key . '%';
$value = '%'.$key.'%';
}
}, $this->scrubParameters);

Expand Down
3 changes: 2 additions & 1 deletion StaffimRollbarBundle.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace Staffim\RollbarBundle;

use Staffim\RollbarBundle\DependencyInjection\CompilerPass\RegisterDecisionVoterPass;
Expand All @@ -11,7 +12,7 @@
class StaffimRollbarBundle extends Bundle
{
/**
* {@inheritDoc}
* {@inheritdoc}
*/
public function build(ContainerBuilder $container)
{
Expand Down