Skip to content

Increase minimum required PHP version to 7.4#14

Closed
haiduk-paysera wants to merge 5 commits intopaysera:masterfrom
haiduk-paysera:php7.4
Closed

Increase minimum required PHP version to 7.4#14
haiduk-paysera wants to merge 5 commits intopaysera:masterfrom
haiduk-paysera:php7.4

Conversation

@haiduk-paysera
Copy link
Contributor

@haiduk-paysera haiduk-paysera commented May 28, 2025

Dependencies versions changes:

  • "monolog/monolog": "^1.24" does not work anymore because SentryExtraInformationHandler uses ProcessableHandlerTrait, which is not present in this version
  • "monolog/monolog" increased from 2.0.0 to 2.1.0, because 2.0.0 does not have Utils::jsonEncode() which is used in \Paysera\LoggingExtraBundle\Service\Formatter\FormatterTrait::toJson
  • "symfony/http-kernel": "^3.4" is not supported anymore because it conflicts with other dependencies (symfony/monolog-bundle, symfony/monolog-bridge)

composer.json Outdated
},
"require": {
"php": "^7.2 || ^8.0",
"php": "^7.4 || ^8.0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Just set requirement to >=7.4, that way lib will be compatible with PHP 7, 8, 9, 10 etc. versions

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed ✅

@@ -38,7 +38,7 @@ class CorrelationIdListener
{
public const HEADER_NAME = 'Paysera-Correlation-Id';
Copy link
Contributor

Choose a reason for hiding this comment

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

there are differences between two declared classes, it would be better to just declare class once and fix different class problem via aliasing, eg.

use Symfony\Component\HttpKernel\Event\ResponseEvent as SymfonyResponseEvent;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent as SymfonyFilterResponseEvent;
use Symfony\Component\HttpKernel\HttpKernelInterface;

if (class_exists(SymfonyResponseEvent::class)) {
    class_alias(SymfonyResponseEvent::class, 'BaseResponseEvent');
} else {
    class_alias(SymfonyFilterResponseEvent::class, 'BaseResponseEvent');
}

class CorrelationIdListener
{

    public function onKernelResponse(BaseResponseEvent $event)
    {
        if (HttpKernelInterface::MASTER_REQUEST !== $event->getRequestType()) {
            return;
        }

        // ...
    }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I've found we can get rid of conditional classes at all.

The FilterResponseEvent is actual for symfony/http-kernel 3.x and till 4.3

The support of symfony/http-kernel ^3.4 is dropped because of conflicts in dependencies.
The minimum allowable 4.x version of symfony/http-kernel is ^4.4.11 because of "sentry/sentry-symfony": "^4.0"

sentry/sentry-symfony[4.0.0, ..., 4.0.3] require symfony/http-kernel ^3.4.43||^4.4.11||^5.0.11 -> found symfony/http-kernel[v3.4.43, ..., v3.4.49, v4.4.11, ..., v4.4.51, v5.0.11, ..., v5.4.48] but it conflicts with your root composer.json require (4.0.*).

So in the symfony/http-kernel 4.4.11, the ResponseEvent already exists, see repo and the article

@mSprunskas
Copy link
Contributor

Relevant changes implemented in #18

@mSprunskas mSprunskas closed this Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants