Skip to content

Replace deprecated Extension class for Symfony 7.1+ compatibility #53

@HecFranco

Description

@HecFranco

Description

This bundle uses the deprecated Symfony\Component\HttpKernel\DependencyInjection\Extension class, which has been marked as internal since Symfony 7.1 and will be deprecated in Symfony 8.1.

Problem

When using the bundle with Symfony 7.1+, the following deprecation warning is generated:

The "Symfony\Component\HttpKernel\DependencyInjection\Extension" class is considered internal since Symfony 7.1, to be deprecated in 8.1; use Symfony\Component\DependencyInjection\Extension\Extension instead. It may change without further notice. You should not use it from "Anyx\LoginGateBundle\DependencyInjection\LoginGateExtension".

Expected Solution

The LoginGateExtension class should be updated to use the recommended Symfony\Component\DependencyInjection\Extension\Extension class instead of the deprecated one.

Required Changes

  • File to modify: DependencyInjection/LoginGateExtension.php
  • Change needed: Replace use Symfony\Component\HttpKernel\DependencyInjection\Extension; with use Symfony\Component\DependencyInjection\Extension\Extension;

Diff

--- a/DependencyInjection/LoginGateExtension.php
+++ b/DependencyInjection/LoginGateExtension.php
@@ -4,7 +4,7 @@ namespace Anyx\LoginGateBundle\DependencyInjection;
 
 use Symfony\Component\Config\FileLocator;
 use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\HttpKernel\DependencyInjection\Extension;
+use Symfony\Component\DependencyInjection\Extension\Extension;
 use Symfony\Component\DependencyInjection\Loader;
 
 /**

Impact

  • ⚠️ Currently generates deprecation warnings in Symfony 7.1+
  • ⚠️ Will break compatibility with Symfony 8.1+ if not fixed
  • ✅ The fix is backward compatible and will work with Symfony 5.x, 6.x, 7.x, and 8.0+

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions