Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Support PHP 8.1 and Symfony 6.1 (limiting BC to PHP 7.2) #281

Open
wants to merge 18 commits into
base: master
Choose a base branch
from
Open
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
15 changes: 9 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,19 @@ jobs:

build:
name: Build
runs-on: Ubuntu-20.04
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0']
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1']
composer: ['']
phpunit: ['']
deprecation: ['']
symfony: ['']
stability: ['']
include:
# Minimum supported dependencies with the latest and oldest PHP version
- php: 8.0
- php: 8.1
composer: --prefer-stable --prefer-lowest
deprecation: max[direct]=0
- php: 7.1
Expand All @@ -39,13 +39,16 @@ jobs:
# symfony version
- php: 8.0
symfony: '^3.0'
- php: 8.0
- php: 8.1
symfony: '^3.0'
deprecation: max[self]=0 # since Symfony 3 itself causes them...
- php: 8.1
symfony: '^4.0'
- php: 8.0
- php: 8.1
symfony: '^5.0'

# dev
- php: 8.0
- php: 8.1
stability: 'dev'

steps:
Expand Down
2 changes: 0 additions & 2 deletions Command/NotifyDeploymentCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ class NotifyDeploymentCommand extends Command
public const EXIT_UNAUTHORIZED = 2;
public const EXIT_HTTP_ERROR = 3;

protected static $defaultName = 'newrelic:notify-deployment';
jderusse marked this conversation as resolved.
Show resolved Hide resolved

private $newrelic;

public function __construct(Config $newrelic)
Expand Down
3 changes: 2 additions & 1 deletion Logging/AdaptiveHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Ekino\NewRelicBundle\Logging;

use Monolog\Handler\NewRelicHandler;
use Monolog\LogRecord;
use Psr\Log\LogLevel;

class AdaptiveHandler extends NewRelicHandler
Expand All @@ -28,7 +29,7 @@ public function __construct(
parent::__construct($level, $bubble, $appName, $explodeArrays, $transactionName);
}

protected function write(array $record): void
protected function write($record): void
{
if (!$this->isNewRelicEnabled()) {
return;
Expand Down
4 changes: 4 additions & 0 deletions Resources/config/services.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
<prototype namespace="Ekino\NewRelicBundle\NewRelic\" resource="../../NewRelic/*" />
<prototype namespace="Ekino\NewRelicBundle\TransactionNamingStrategy\" resource="../../TransactionNamingStrategy/*" />

<service id="Ekino\NewRelicBundle\Command\NotifyDeploymentCommand" autowire="true" autoconfigure="true">
<tag name="console.command" command="newrelic:notify-deployment" />
</service>

<service id="Ekino\NewRelicBundle\NewRelic\AdaptiveInteractor">
<argument type="service" id="Ekino\NewRelicBundle\NewRelic\NewRelicInteractor" />
<argument type="service" id="Ekino\NewRelicBundle\NewRelic\BlackholeInteractor" />
Expand Down
14 changes: 14 additions & 0 deletions Tests/AppKernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
'resource' => 'kernel:loadRoutes',
'type' => 'service',
],
'http_method_override' => false,
]);

// Not setting the router to utf8 is deprecated in symfony 5.1
Expand Down Expand Up @@ -158,4 +159,17 @@ public function process(ContainerBuilder $container)

return $container;
}

/**
* @throws \Exception
*/
public function __serialize(): array
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 why this change?

Copy link
Author

@CRC-Mismatch CRC-Mismatch Nov 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely sure right now (bear in mind that I did this more than 3 months ago), but AFAICR, it had something to do with something failing under Symfony 6.1

{
return unserialize($this->serialize());
}

public function __unserialize(array $data): void
{
$this->unserialize(serialize($data));
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"symfony/http-kernel": "^3.4|^4.0|^5.0|^6.0"
},
"require-dev": {
"matthiasnoback/symfony-dependency-injection-test": "^3.1|^4.0",
"matthiasnoback/symfony-dependency-injection-test": "^4.0",
"symfony/framework-bundle": "^3.4|^4.0|^5.0|^6.0",
"symfony/phpunit-bridge": "^5.3",
"symfony/debug": ">3.4.21",
Expand Down