Skip to content

Commit a6b680e

Browse files
authored
Run tests against PHP 8.4 (#893)
1 parent 7820516 commit a6b680e

File tree

9 files changed

+20
-16
lines changed

9 files changed

+20
-16
lines changed

.github/workflows/static-analysis.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup PHP
2323
uses: shivammathur/setup-php@v2
2424
with:
25-
php-version: '8.2'
25+
php-version: '8.3'
2626

2727
- name: Install dependencies
2828
uses: ramsey/composer-install@v3

.github/workflows/tests.yaml

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
name: Continuous Integration
1+
name: CI
22

33
on:
4-
pull_request: null
4+
pull_request:
55
push:
66
branches:
77
- master
8-
- develop
98
- release/**
109

1110
permissions:
@@ -28,6 +27,7 @@ jobs:
2827
- '8.1'
2928
- '8.2'
3029
- '8.3'
30+
- '8.4'
3131
symfony-version:
3232
- 4.4.*
3333
- 5.*
@@ -52,6 +52,8 @@ jobs:
5252
symfony-version: 7.*
5353
- php: '8.1'
5454
symfony-version: 7.*
55+
- php: '8.4'
56+
symfony-version: 4.4.*
5557
include:
5658
- php: '7.2'
5759
symfony-version: 4.4.*
@@ -82,9 +84,9 @@ jobs:
8284
- name: Setup Problem Matchers for PHPUnit
8385
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
8486

85-
- name: Update PHPUnit
86-
run: composer require --dev phpunit/phpunit ^9.3.9 --no-update
87-
if: matrix.php == '8.0' && matrix.dependencies == 'lowest'
87+
# These dependencies are not used running the tests but can cause deprecation warnings so we remove them before running the tests
88+
- name: Remove unused dependencies
89+
run: composer remove vimeo/psalm phpstan/phpstan friendsofphp/php-cs-fixer --dev --no-interaction --no-update
8890

8991
- name: Install dependencies
9092
uses: ramsey/composer-install@v3
@@ -118,7 +120,7 @@ jobs:
118120
- php: '8.0'
119121
dependencies: lowest
120122
symfony-version: 4.4.*
121-
- php: '8.3'
123+
- php: '8.4'
122124
dependencies: highest
123125

124126
steps:

composer.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"php": "^7.2||^8.0",
1616
"guzzlehttp/psr7": "^2.1.1",
1717
"jean85/pretty-package-versions": "^1.5||^2.0",
18-
"sentry/sentry": "^4.9.0",
18+
"sentry/sentry": "^4.10.0",
1919
"symfony/cache-contracts": "^1.1||^2.4||^3.0",
2020
"symfony/config": "^4.4.20||^5.0.11||^6.0||^7.0",
2121
"symfony/console": "^4.4.20||^5.0.11||^6.0||^7.0",
@@ -36,7 +36,7 @@
3636
"phpstan/phpstan": "1.12.5",
3737
"phpstan/phpstan-phpunit": "1.4.0",
3838
"phpstan/phpstan-symfony": "1.4.10",
39-
"phpunit/phpunit": "^8.5.14||^9.3.9",
39+
"phpunit/phpunit": "^8.5.40||^9.6.21",
4040
"symfony/browser-kit": "^4.4.20||^5.0.11||^6.0||^7.0",
4141
"symfony/cache": "^4.4.20||^5.0.11||^6.0||^7.0",
4242
"symfony/dom-crawler": "^4.4.20||^5.0.11||^6.0||^7.0",

src/Tracing/HttpClient/TraceableResponseForV5.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ final class TraceableResponseForV5 extends AbstractTraceableResponse implements
1616
*
1717
* @return mixed
1818
*/
19-
public function getInfo(string $type = null)
19+
public function getInfo(?string $type = null)
2020
{
2121
return $this->response->getInfo($type);
2222
}

tests/DependencyInjection/Fixtures/php/error_types.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/** @var ContainerBuilder $container */
88
$container->loadFromExtension('sentry', [
99
'options' => [
10-
'error_types' => \E_ALL & ~(\E_NOTICE | \E_STRICT | \E_DEPRECATED),
10+
// 2048 is \E_STRICT which has been deprecated in PHP 8.4 so we should not reference it directly to prevent deprecation notices
11+
'error_types' => \E_ALL & ~(\E_NOTICE | 2048 | \E_DEPRECATED),
1112
],
1213
]);

tests/DependencyInjection/Fixtures/xml/error_types.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
https://sentry.io/schema/dic/sentry-symfony https://sentry.io/schema/dic/sentry-symfony/sentry-1.0.xsd">
88

99
<sentry:config dsn="https://[email protected]/0">
10-
<sentry:options error-types="E_ALL &amp; ~(E_NOTICE|E_STRICT|E_DEPRECATED)" />
10+
<sentry:options error-types="E_ALL &amp; ~(E_NOTICE|2048|E_DEPRECATED)" />
1111
</sentry:config>
1212
</container>
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
sentry:
22
options:
3-
error_types: E_ALL & ~(E_NOTICE|E_STRICT|E_DEPRECATED)
3+
error_types: E_ALL & ~(E_NOTICE|2048|E_DEPRECATED)

tests/DependencyInjection/SentryExtensionTest.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,8 @@ public function testErrorTypesOptionIsParsedFromStringToIntegerValue(): void
288288
$container = $this->createContainerFromFixture('error_types');
289289
$optionsDefinition = $container->getDefinition('sentry.client.options');
290290

291-
$this->assertSame(\E_ALL & ~(\E_NOTICE | \E_STRICT | \E_DEPRECATED), $optionsDefinition->getArgument(0)['error_types']);
291+
// 2048 is \E_STRICT which has been deprecated in PHP 8.4 so we should not reference it directly to prevent deprecation notices
292+
$this->assertSame(\E_ALL & ~(\E_NOTICE | 2048 | \E_DEPRECATED), $optionsDefinition->getArgument(0)['error_types']);
292293
}
293294

294295
/**

tests/End2End/App/Controller/TracingController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TracingController
2121
*/
2222
private $connection;
2323

24-
public function __construct(HubInterface $hub, Connection $connection = null)
24+
public function __construct(HubInterface $hub, ?Connection $connection = null)
2525
{
2626
$this->hub = $hub;
2727
$this->connection = $connection;

0 commit comments

Comments
 (0)