Skip to content

Commit

Permalink
Merge pull request #82 from rollbar/next/5.x/main
Browse files Browse the repository at this point in the history
Release v5.0.0
  • Loading branch information
danielmorell authored Sep 16, 2022
2 parents a9d6cde + df70648 commit 3ce3513
Show file tree
Hide file tree
Showing 26 changed files with 227 additions and 454 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/code_checks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# .github/workflows/code_checks.yaml
name: Code_Checks

on: ["push", "pull_request"]

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['8.0', '8.1']
stability: [ prefer-lowest, prefer-stable ]

name: PHP ${{ matrix.php }} - ${{ matrix.stability }} tests
steps:
# basically git clone
- uses: actions/checkout@v2

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

# use PHP of specific version
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: pcov, dom, curl, libxml, mbstring
coverage: pcov

- name: Install dependencies
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction

- name: Execute tests
run: vendor/bin/phpunit --verbose
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/vendor/
/var/
!/var/.gitkeep
.phpunit.result.cache

composer.lock
clover.xml
59 changes: 59 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
## [v5.0.0] - 2019-01-02
* Added Symfony 6 support, and update tests by @art-cg in #73
* Added GitHub actions by @art-cg in #74
* Feature/remove unused language version by @Chris53897 in #77
* Fixed failing CI by @danielmorell in #78
* Fixed #51 To make catch statement broader by @danielmorell in #80
* Added CHANGELOG.md by @danielmorell in #81

## [v4.0.0] - 2020-02-15
* Update to symfony5 #61

## [v3.1.2] - 2019-01-02
* #39 Person data not loaded TokenStorage as documented

## [v3.1.1] - 2018-12-16
* #38: phpunit exits with a non-zero status
* Update README.md

## [v3.1.0] - 2018-10-16
* #34 Change the name of the report to rollbar-php-symfony-bundle
* #24 Point docs from README to Rollbar's site
* #37 Remove exception listeners, rely on Symfony...::logKernelException() to log uncaught exceptions
* readme updates

## [v3.0.0] - 2018-10-10
* Update README.md by @jessewgibbs in #30
* Add Symfony 4 support and ability to configure all Rollbar parameters by @javer in #27

## [v2.0.0] - 2018-04-17
* Major refactoring of the directory structure following Symfony's [best practices](http://symfony.com/doc/3.4/bundles/best_practices.html).
* Updated the `rollbar/rollbar` dependency to use the latest release.
* Added support for manual logging through the `LoggerInterface` injected logger.
* Utilized Symfony's Monolog Bundle to tap into Symfony's common logging mechanism.
* Updated `README.md` and `Resources/doc/index.rst`.
* Added Symfony's logged in user tracking by default.
* Added support for `person_fn` for modifying the user tracking data.
* Refactored the configuration options structure for `app/config/config.yml`.
* Added passing Rollbar's default config values as they are defined in `rollbar/rollbar` dependency instead of redefining them in the bundle.

## [v1.0.2] - 2018-02-16
* update: allow to work with php7

## [v1.0.1] - 2017-08-09
* Update ExceptionListener.php fix function access level

## [v1.0.0] - 2017-05-08
* coverage


[v5.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v4.0.0...v5.0.0
[v4.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v3.1.2...v4.0.0
[v3.1.2]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v3.1.1...v3.1.2
[v3.1.1]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v3.1.0...v3.1.1
[v3.1.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v3.0.0...v3.1.0
[v3.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v2.0.0...v3.0.0
[v2.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v1.0.2...v2.0.0
[v1.0.2]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v1.0.1...v1.0.2
[v1.0.1]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v1.0.0...v1.0.1
[v1.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/releases/tag/v1.0.0
21 changes: 5 additions & 16 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
* Class Configuration
*
* @link https://rollbar.com/docs/notifier/rollbar-php/#configuration-reference
*
* @package Rollbar\Symfony\RollbarBundle\DependencyInjection
*/
class Configuration implements ConfigurationInterface
{
Expand All @@ -22,27 +20,18 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder(): TreeBuilder
{
$treeBuilder = new TreeBuilder(RollbarExtension::ALIAS);

if (method_exists($treeBuilder, 'getRootNode')) {
$rollbarConfigNode = $treeBuilder->getRootNode();
} else {
$rollbarConfigNode = $treeBuilder->root(RollbarExtension::ALIAS);
}
$rollbarConfigNode = $treeBuilder->getRootNode();

$rollbarConfigNodeChildren = $rollbarConfigNode->children();

$configOptions = Config::listOptions();
$rollbarDefaults = Defaults::get();

foreach ($configOptions as $option) {
switch ($option) {
case 'branch':
$method = 'gitBranch';
break;
default:
$method = $option;
break;
}
$method = match ($option) {
'branch' => 'gitBranch',
default => $option,
};

try {
$default = $rollbarDefaults->fromSnakeCase($method);
Expand Down
7 changes: 1 addition & 6 deletions DependencyInjection/RollbarExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,9 @@
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* Class RollbarExtension
*
* @package Rollbar\Symfony\RollbarBundle\DependencyInjection
*/
class RollbarExtension extends Extension
{
const ALIAS = 'rollbar';
public const ALIAS = 'rollbar';

/**
* {@inheritdoc}
Expand Down
21 changes: 3 additions & 18 deletions Factories/RollbarHandlerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,13 @@
namespace Rollbar\Symfony\RollbarBundle\Factories;

use Psr\Log\LogLevel;
use Rollbar\Monolog\Handler\RollbarHandler;
use Monolog\Handler\RollbarHandler;
use Rollbar\Rollbar;
use Rollbar\Symfony\RollbarBundle\DependencyInjection\RollbarExtension;
use Symfony\Component\DependencyInjection\ContainerInterface;

/**
* Class RollbarHandlerFactory
*
* @package Rollbar\Symfony\RollbarBundle\Factories
*/
class RollbarHandlerFactory
{
/**
* RollbarHandlerFactory constructor.
*
* @param ContainerInterface $container
*/
public function __construct(ContainerInterface $container)
{
$config = $container->getParameter(RollbarExtension::ALIAS . '.config');
Expand All @@ -38,9 +28,9 @@ public function __construct(ContainerInterface $container)
if ($token) {
$user = $token->getUser();
$serializer = $container->get('serializer');
return \json_decode($serializer->serialize($user, 'json'), true);
return \json_decode($serializer->serialize($user, 'json'), true, 512, JSON_THROW_ON_ERROR);
}
} catch (\Exception $exception) {
} catch (\Throwable $exception) {
// Ignore
}
};
Expand All @@ -49,11 +39,6 @@ public function __construct(ContainerInterface $container)
Rollbar::init($config, false, false, false);
}

/**
* Create RollbarHandler
*
* @return RollbarHandler
*/
public function createRollbarHandler(): RollbarHandler
{
return new RollbarHandler(Rollbar::logger(), LogLevel::ERROR);
Expand Down
30 changes: 6 additions & 24 deletions Payload/ErrorItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,15 @@

namespace Rollbar\Symfony\RollbarBundle\Payload;

/**
* Class ErrorItem
*
* @package Rollbar\Symfony\RollbarBundle\Payload
*/
use JetBrains\PhpStorm\ArrayShape;

class ErrorItem
{
/**
* List of map for human readable constants
* @link http://php.net/manual/en/errorfunc.constants.php
*
* @var array
*/
public static $map = [
public static array $map = [
E_ERROR => 'E_ERROR',
E_WARNING => 'E_WARNING',
E_PARSE => 'E_PARSE',
Expand All @@ -33,17 +28,8 @@ class ErrorItem
E_USER_DEPRECATED => 'E_USER_DEPRECATED',
];

/**
* Invoke.
*
* @param int $code
* @param string $message
* @param string $file
* @param int $line
*
* @return array
*/
public function __invoke($code, $message, $file, $line)
#[ArrayShape(['exception' => "array", 'frames' => "array[]"])]
public function __invoke(int $code, string $message, string $file, int $line): array
{
return [
'exception' => [
Expand All @@ -69,12 +55,8 @@ public function __invoke($code, $message, $file, $line)

/**
* Map error code to human format
*
* @param mixed $code
*
* @return string
*/
protected function mapError($code): string
protected function mapError(mixed $code): string
{
$code = (int) $code;

Expand Down
Loading

0 comments on commit 3ce3513

Please sign in to comment.