Skip to content

Commit

Permalink
sentry/sentry v3.6.1以上, sentry/sdk v3.2以上に更新
Browse files Browse the repository at this point in the history
- PHP8.1で composer update --prefer-lowest するとPHP警告のため symfony/options-resolver 依存も追加
(未指定だと v3.4.43 で解決されてしまう)。

MonitorInterceptorTest.php:14
Fatal error: During inheritance of ArrayAccess: Uncaught Return type of Symfony\Component\OptionsResolver\OptionsResolver::offsetExists($option) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

- 上記と同じ問題回避で bear/resource 依存追加
- 下記警告のため一部テストで警告を抑止
ResourceInterceptorTest::testInvokeCallsTransactionCaseFirstSpan
Ray\Di\Argument implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary)
vendor/ray/di/src/di/Argument.php:19
  • Loading branch information
YAMANE Nana committed Jul 18, 2022
1 parent b437e66 commit dc076ec
Show file tree
Hide file tree
Showing 3 changed files with 297 additions and 431 deletions.
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,21 @@
"require": {
"php": "^7.4 || ^8.0",
"ext-json": "*",
"http-interop/http-factory-guzzle": "^1.0",
"ray/aop": "^2.10",
"ray/di": "^2.12",
"sentry/sdk": "^3.1",
"sentry/sentry": "^3.3"
"sentry/sdk": "^3.2.0",
"sentry/sentry": "^3.6.1",
"symfony/http-client": "^4.3|^5.0|^6.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.5",
"bear/package": "^1.10",
"bear/resource": "^1.15",
"bear/resource": "^1.16.1",
"bear/sunday": "^1.5.4",
"phpunit/phpunit": "^9.5",
"roave/security-advisories": "dev-master"
"roave/security-advisories": "dev-master",
"symfony/options-resolver": "^5.4.0"
},
"autoload": {
"psr-4": {
Expand Down
30 changes: 30 additions & 0 deletions tests/ResourceInterceptorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,41 @@
use Ray\Aop\ReflectiveMethodInvocation;
use Ray\Di\Injector;

use function dirname;
use function restore_error_handler;
use function set_error_handler;
use function str_contains;

use const E_DEPRECATED;
use const PHP_VERSION_ID;

class ResourceInterceptorTest extends TestCase
{
private ?Transaction $transaction;
private ?ResourceTrace $trace;

protected function setUp(): void
{
parent::setUp();
if (PHP_VERSION_ID < 80100) {
return;
}

// Ray.Di 2.13.0後方互換のため refs. https://github.com/ray-di/Ray.Di/releases/tag/2.13.1
set_error_handler([$this, 'ignoreRayDiDeprecatedError']);
}

private function ignoreRayDiDeprecatedError(int $errno, string $s, string $file): bool
{
return $errno === E_DEPRECATED && str_contains($file, dirname(__DIR__) . '/vendor/ray/di');
}

protected function tearDown(): void
{
restore_error_handler();
parent::tearDown();
}

public function testInvokeThrowsExceptionCaseNotResource(): void
{
$this->expectException(UnsupportedTypeException::class);
Expand Down
Loading

0 comments on commit dc076ec

Please sign in to comment.