Skip to content
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions src/Integration/Symfony/Bundle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Fixed

- Fixed deprecation warnings on Symfony 8.1
- Fixed tests on Symfony 8.1

## 1.17.0
Expand Down
32 changes: 31 additions & 1 deletion src/Integration/Symfony/Bundle/src/AsyncAwsBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'm a bit rusty with BC layer. Is this the right way to do it?

/**
* @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();
}
}
Loading