Skip to content

Commit 3ce3513

Browse files
authored
Merge pull request #82 from rollbar/next/5.x/main
Release v5.0.0
2 parents a9d6cde + df70648 commit 3ce3513

26 files changed

+227
-454
lines changed

.github/workflows/code_checks.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# .github/workflows/code_checks.yaml
2+
name: Code_Checks
3+
4+
on: ["push", "pull_request"]
5+
6+
jobs:
7+
tests:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
php: ['8.0', '8.1']
13+
stability: [ prefer-lowest, prefer-stable ]
14+
15+
name: PHP ${{ matrix.php }} - ${{ matrix.stability }} tests
16+
steps:
17+
# basically git clone
18+
- uses: actions/checkout@v2
19+
20+
- name: Cache dependencies
21+
uses: actions/cache@v1
22+
with:
23+
path: ~/.composer/cache/files
24+
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
25+
26+
# use PHP of specific version
27+
- uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php }}
30+
extensions: pcov, dom, curl, libxml, mbstring
31+
coverage: pcov
32+
33+
- name: Install dependencies
34+
run: composer update --${{ matrix.stability }} --prefer-dist --no-interaction
35+
36+
- name: Execute tests
37+
run: vendor/bin/phpunit --verbose

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/vendor/
44
/var/
55
!/var/.gitkeep
6+
.phpunit.result.cache
67

78
composer.lock
89
clover.xml

CHANGELOG.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
## [v5.0.0] - 2019-01-02
2+
* Added Symfony 6 support, and update tests by @art-cg in #73
3+
* Added GitHub actions by @art-cg in #74
4+
* Feature/remove unused language version by @Chris53897 in #77
5+
* Fixed failing CI by @danielmorell in #78
6+
* Fixed #51 To make catch statement broader by @danielmorell in #80
7+
* Added CHANGELOG.md by @danielmorell in #81
8+
9+
## [v4.0.0] - 2020-02-15
10+
* Update to symfony5 #61
11+
12+
## [v3.1.2] - 2019-01-02
13+
* #39 Person data not loaded TokenStorage as documented
14+
15+
## [v3.1.1] - 2018-12-16
16+
* #38: phpunit exits with a non-zero status
17+
* Update README.md
18+
19+
## [v3.1.0] - 2018-10-16
20+
* #34 Change the name of the report to rollbar-php-symfony-bundle
21+
* #24 Point docs from README to Rollbar's site
22+
* #37 Remove exception listeners, rely on Symfony...::logKernelException() to log uncaught exceptions
23+
* readme updates
24+
25+
## [v3.0.0] - 2018-10-10
26+
* Update README.md by @jessewgibbs in #30
27+
* Add Symfony 4 support and ability to configure all Rollbar parameters by @javer in #27
28+
29+
## [v2.0.0] - 2018-04-17
30+
* Major refactoring of the directory structure following Symfony's [best practices](http://symfony.com/doc/3.4/bundles/best_practices.html).
31+
* Updated the `rollbar/rollbar` dependency to use the latest release.
32+
* Added support for manual logging through the `LoggerInterface` injected logger.
33+
* Utilized Symfony's Monolog Bundle to tap into Symfony's common logging mechanism.
34+
* Updated `README.md` and `Resources/doc/index.rst`.
35+
* Added Symfony's logged in user tracking by default.
36+
* Added support for `person_fn` for modifying the user tracking data.
37+
* Refactored the configuration options structure for `app/config/config.yml`.
38+
* Added passing Rollbar's default config values as they are defined in `rollbar/rollbar` dependency instead of redefining them in the bundle.
39+
40+
## [v1.0.2] - 2018-02-16
41+
* update: allow to work with php7
42+
43+
## [v1.0.1] - 2017-08-09
44+
* Update ExceptionListener.php fix function access level
45+
46+
## [v1.0.0] - 2017-05-08
47+
* coverage
48+
49+
50+
[v5.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v4.0.0...v5.0.0
51+
[v4.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v3.1.2...v4.0.0
52+
[v3.1.2]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v3.1.1...v3.1.2
53+
[v3.1.1]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v3.1.0...v3.1.1
54+
[v3.1.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v3.0.0...v3.1.0
55+
[v3.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v2.0.0...v3.0.0
56+
[v2.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v1.0.2...v2.0.0
57+
[v1.0.2]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v1.0.1...v1.0.2
58+
[v1.0.1]: https://github.com/rollbar/rollbar-php-symfony-bundle/compare/v1.0.0...v1.0.1
59+
[v1.0.0]: https://github.com/rollbar/rollbar-php-symfony-bundle/releases/tag/v1.0.0

DependencyInjection/Configuration.php

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
* Class Configuration
1212
*
1313
* @link https://rollbar.com/docs/notifier/rollbar-php/#configuration-reference
14-
*
15-
* @package Rollbar\Symfony\RollbarBundle\DependencyInjection
1614
*/
1715
class Configuration implements ConfigurationInterface
1816
{
@@ -22,27 +20,18 @@ class Configuration implements ConfigurationInterface
2220
public function getConfigTreeBuilder(): TreeBuilder
2321
{
2422
$treeBuilder = new TreeBuilder(RollbarExtension::ALIAS);
25-
26-
if (method_exists($treeBuilder, 'getRootNode')) {
27-
$rollbarConfigNode = $treeBuilder->getRootNode();
28-
} else {
29-
$rollbarConfigNode = $treeBuilder->root(RollbarExtension::ALIAS);
30-
}
23+
$rollbarConfigNode = $treeBuilder->getRootNode();
3124

3225
$rollbarConfigNodeChildren = $rollbarConfigNode->children();
3326

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

3730
foreach ($configOptions as $option) {
38-
switch ($option) {
39-
case 'branch':
40-
$method = 'gitBranch';
41-
break;
42-
default:
43-
$method = $option;
44-
break;
45-
}
31+
$method = match ($option) {
32+
'branch' => 'gitBranch',
33+
default => $option,
34+
};
4635

4736
try {
4837
$default = $rollbarDefaults->fromSnakeCase($method);

DependencyInjection/RollbarExtension.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@
77
use Symfony\Component\DependencyInjection\Loader;
88
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
99

10-
/**
11-
* Class RollbarExtension
12-
*
13-
* @package Rollbar\Symfony\RollbarBundle\DependencyInjection
14-
*/
1510
class RollbarExtension extends Extension
1611
{
17-
const ALIAS = 'rollbar';
12+
public const ALIAS = 'rollbar';
1813

1914
/**
2015
* {@inheritdoc}

Factories/RollbarHandlerFactory.php

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,13 @@
33
namespace Rollbar\Symfony\RollbarBundle\Factories;
44

55
use Psr\Log\LogLevel;
6-
use Rollbar\Monolog\Handler\RollbarHandler;
6+
use Monolog\Handler\RollbarHandler;
77
use Rollbar\Rollbar;
88
use Rollbar\Symfony\RollbarBundle\DependencyInjection\RollbarExtension;
99
use Symfony\Component\DependencyInjection\ContainerInterface;
1010

11-
/**
12-
* Class RollbarHandlerFactory
13-
*
14-
* @package Rollbar\Symfony\RollbarBundle\Factories
15-
*/
1611
class RollbarHandlerFactory
1712
{
18-
/**
19-
* RollbarHandlerFactory constructor.
20-
*
21-
* @param ContainerInterface $container
22-
*/
2313
public function __construct(ContainerInterface $container)
2414
{
2515
$config = $container->getParameter(RollbarExtension::ALIAS . '.config');
@@ -38,9 +28,9 @@ public function __construct(ContainerInterface $container)
3828
if ($token) {
3929
$user = $token->getUser();
4030
$serializer = $container->get('serializer');
41-
return \json_decode($serializer->serialize($user, 'json'), true);
31+
return \json_decode($serializer->serialize($user, 'json'), true, 512, JSON_THROW_ON_ERROR);
4232
}
43-
} catch (\Exception $exception) {
33+
} catch (\Throwable $exception) {
4434
// Ignore
4535
}
4636
};
@@ -49,11 +39,6 @@ public function __construct(ContainerInterface $container)
4939
Rollbar::init($config, false, false, false);
5040
}
5141

52-
/**
53-
* Create RollbarHandler
54-
*
55-
* @return RollbarHandler
56-
*/
5742
public function createRollbarHandler(): RollbarHandler
5843
{
5944
return new RollbarHandler(Rollbar::logger(), LogLevel::ERROR);

Payload/ErrorItem.php

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,15 @@
22

33
namespace Rollbar\Symfony\RollbarBundle\Payload;
44

5-
/**
6-
* Class ErrorItem
7-
*
8-
* @package Rollbar\Symfony\RollbarBundle\Payload
9-
*/
5+
use JetBrains\PhpStorm\ArrayShape;
6+
107
class ErrorItem
118
{
129
/**
1310
* List of map for human readable constants
1411
* @link http://php.net/manual/en/errorfunc.constants.php
15-
*
16-
* @var array
1712
*/
18-
public static $map = [
13+
public static array $map = [
1914
E_ERROR => 'E_ERROR',
2015
E_WARNING => 'E_WARNING',
2116
E_PARSE => 'E_PARSE',
@@ -33,17 +28,8 @@ class ErrorItem
3328
E_USER_DEPRECATED => 'E_USER_DEPRECATED',
3429
];
3530

36-
/**
37-
* Invoke.
38-
*
39-
* @param int $code
40-
* @param string $message
41-
* @param string $file
42-
* @param int $line
43-
*
44-
* @return array
45-
*/
46-
public function __invoke($code, $message, $file, $line)
31+
#[ArrayShape(['exception' => "array", 'frames' => "array[]"])]
32+
public function __invoke(int $code, string $message, string $file, int $line): array
4733
{
4834
return [
4935
'exception' => [
@@ -69,12 +55,8 @@ public function __invoke($code, $message, $file, $line)
6955

7056
/**
7157
* Map error code to human format
72-
*
73-
* @param mixed $code
74-
*
75-
* @return string
7658
*/
77-
protected function mapError($code): string
59+
protected function mapError(mixed $code): string
7860
{
7961
$code = (int) $code;
8062

0 commit comments

Comments
 (0)