diff --git a/composer.json b/composer.json index 31a950c8d..aed6a3674 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "symfony/error-handler": "^7.3.2 || ^8.0", "symfony/filesystem": "^5.0 || ^6.0 || ^7.0 || ^8.0", "symfony/finder": "^4.4 || ^5.0 || ^6.0 || ^7.0 || ^8.0", - "symfony/framework-bundle": "^5.4.45 || ^6.4.13 || ^7.1.6", + "symfony/framework-bundle": "^5.4.45 || ^6.4.13 || ^7.1.6 || ^8.0", "symfony/http-kernel": "^4.4 || ^5.0 || ^6.0 || ^7.0 || ^8.0", "symfony/phpunit-bridge": "^7.3.2 || ^8.0", "symfony/polyfill-uuid": "^1.13.1", diff --git a/phpstan.neon.dist b/phpstan.neon.dist index c157cd326..d32950323 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -14,3 +14,8 @@ parameters: - identifier: missingType.iterableValue - '#PHPDoc tag @throws with type Psr\\Cache\\CacheException is not subtype of Throwable$#' - '#^Dead catch - JsonException is never thrown in the try block\.$#' + # BaseBundle conditionally extends the modern AbstractBundle, which only exists on Symfony 8.1+. + # On older Symfony that parent is unknown, so PHPStan cannot resolve the inherited parent::build(). + - + message: '#^Call to an undefined static method AsyncAws\\Symfony\\Bundle\\BaseBundle::build\(\)\.$#' + path: src/Integration/Symfony/Bundle/src/AsyncAwsBundle.php diff --git a/src/Integration/Symfony/Bundle/CHANGELOG.md b/src/Integration/Symfony/Bundle/CHANGELOG.md index f9dc66063..323475b5a 100644 --- a/src/Integration/Symfony/Bundle/CHANGELOG.md +++ b/src/Integration/Symfony/Bundle/CHANGELOG.md @@ -4,6 +4,7 @@ ### Fixed +- Fixed deprecation warnings on Symfony 8.1 - Fixed tests on Symfony 8.1 ## 1.17.0 diff --git a/src/Integration/Symfony/Bundle/src/AsyncAwsBundle.php b/src/Integration/Symfony/Bundle/src/AsyncAwsBundle.php index 226f9ef56..edaf65840 100644 --- a/src/Integration/Symfony/Bundle/src/AsyncAwsBundle.php +++ b/src/Integration/Symfony/Bundle/src/AsyncAwsBundle.php @@ -4,16 +4,46 @@ namespace AsyncAws\Symfony\Bundle; +use AsyncAws\Symfony\Bundle\DependencyInjection\AsyncAwsExtension; use AsyncAws\Symfony\Bundle\DependencyInjection\Compiler\InjectCasterPass; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; +use Symfony\Component\DependencyInjection\Kernel\AbstractBundle; use Symfony\Component\HttpKernel\Bundle\Bundle; -class AsyncAwsBundle extends Bundle +if (class_exists(AbstractBundle::class)) { + /** + * @internal + */ + abstract class BaseBundle extends AbstractBundle + { + } +} else { + /** + * @internal + */ + abstract class BaseBundle extends Bundle + { + } +} + +class AsyncAwsBundle extends BaseBundle { + private ?ExtensionInterface $asyncAwsExtension = null; + public function build(ContainerBuilder $container): void { parent::build($container); $container->addCompilerPass(new InjectCasterPass()); } + + /** + * Return the conventional extension explicitly: the modern AbstractBundle base class would + * otherwise auto-register an empty BundleExtension and ignore AsyncAwsExtension. + */ + public function getContainerExtension(): ?ExtensionInterface + { + return $this->asyncAwsExtension ??= new AsyncAwsExtension(); + } }