Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Run tests against PHP 8.4 #893

Merged
merged 9 commits into from
Nov 19, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
php-version: '8.3'

- name: Install dependencies
uses: ramsey/composer-install@v3
Expand Down
16 changes: 9 additions & 7 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: Continuous Integration
name: CI

on:
pull_request: null
pull_request:
push:
branches:
- master
- develop
- release/**

permissions:
Expand All @@ -28,6 +27,7 @@ jobs:
- '8.1'
- '8.2'
- '8.3'
- '8.4'
symfony-version:
- 4.4.*
- 5.*
Expand All @@ -52,6 +52,8 @@ jobs:
symfony-version: 7.*
- php: '8.1'
symfony-version: 7.*
- php: '8.4'
symfony-version: 4.4.*
include:
- php: '7.2'
symfony-version: 4.4.*
Expand Down Expand Up @@ -82,9 +84,9 @@ jobs:
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

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

- name: Install dependencies
uses: ramsey/composer-install@v3
Expand Down Expand Up @@ -118,7 +120,7 @@ jobs:
- php: '8.0'
dependencies: lowest
symfony-version: 4.4.*
- php: '8.3'
- php: '8.4'
dependencies: highest

steps:
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"php": "^7.2||^8.0",
"guzzlehttp/psr7": "^2.1.1",
"jean85/pretty-package-versions": "^1.5||^2.0",
"sentry/sentry": "^4.9.0",
"sentry/sentry": "^4.10.0",
"symfony/cache-contracts": "^1.1||^2.4||^3.0",
"symfony/config": "^4.4.20||^5.0.11||^6.0||^7.0",
"symfony/console": "^4.4.20||^5.0.11||^6.0||^7.0",
Expand All @@ -36,7 +36,7 @@
"phpstan/phpstan": "1.12.5",
"phpstan/phpstan-phpunit": "1.4.0",
"phpstan/phpstan-symfony": "1.4.10",
"phpunit/phpunit": "^8.5.14||^9.3.9",
"phpunit/phpunit": "^8.5.40||^9.6.21",
"symfony/browser-kit": "^4.4.20||^5.0.11||^6.0||^7.0",
"symfony/cache": "^4.4.20||^5.0.11||^6.0||^7.0",
"symfony/dom-crawler": "^4.4.20||^5.0.11||^6.0||^7.0",
Expand Down
2 changes: 1 addition & 1 deletion src/Tracing/HttpClient/TraceableResponseForV5.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ final class TraceableResponseForV5 extends AbstractTraceableResponse implements
*
* @return mixed
*/
public function getInfo(string $type = null)
public function getInfo(?string $type = null)
{
return $this->response->getInfo($type);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/DependencyInjection/Fixtures/php/error_types.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/** @var ContainerBuilder $container */
$container->loadFromExtension('sentry', [
'options' => [
'error_types' => \E_ALL & ~(\E_NOTICE | \E_STRICT | \E_DEPRECATED),
// 2048 is \E_STRICT which has been deprecated in PHP 8.4 so we should not reference it directly to prevent deprecation notices
'error_types' => \E_ALL & ~(\E_NOTICE | 2048 | \E_DEPRECATED),
],
]);
2 changes: 1 addition & 1 deletion tests/DependencyInjection/Fixtures/xml/error_types.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
https://sentry.io/schema/dic/sentry-symfony https://sentry.io/schema/dic/sentry-symfony/sentry-1.0.xsd">

<sentry:config dsn="https://examplePublicKey@o0.ingest.sentry.io/0">
<sentry:options error-types="E_ALL &amp; ~(E_NOTICE|E_STRICT|E_DEPRECATED)" />
<sentry:options error-types="E_ALL &amp; ~(E_NOTICE|2048|E_DEPRECATED)" />
</sentry:config>
</container>
2 changes: 1 addition & 1 deletion tests/DependencyInjection/Fixtures/yml/error_types.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
sentry:
options:
error_types: E_ALL & ~(E_NOTICE|E_STRICT|E_DEPRECATED)
error_types: E_ALL & ~(E_NOTICE|2048|E_DEPRECATED)
3 changes: 2 additions & 1 deletion tests/DependencyInjection/SentryExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ public function testErrorTypesOptionIsParsedFromStringToIntegerValue(): void
$container = $this->createContainerFromFixture('error_types');
$optionsDefinition = $container->getDefinition('sentry.client.options');

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

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/End2End/App/Controller/TracingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TracingController
*/
private $connection;

public function __construct(HubInterface $hub, Connection $connection = null)
public function __construct(HubInterface $hub, ?Connection $connection = null)
{
$this->hub = $hub;
$this->connection = $connection;
Expand Down
Loading