diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0cc56f5..4ac55d6 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -23,8 +23,11 @@ jobs:
strategy:
fail-fast: false
matrix:
- php: ["8.0"]
- symfony: ["^5.4", "^6.0"]
+ php: ["8.1", "8.2", "8.3"]
+ symfony: ["^5.4", "^6.4", "^7.0"]
+ exclude:
+ - php: "8.1"
+ symfony: "^7.0"
steps:
- uses: actions/checkout@v2
@@ -58,11 +61,16 @@ jobs:
- name: Install dependencies
run: composer install --ansi --no-interaction
- - name: Run Psalm
- run: vendor/bin/psalm
+ - name: Run PHPStan
+ run: vendor/bin/phpstan analyse
- name: Run PHPUnit
run: vendor/bin/phpunit
- name: Run Infection
+ if: ${{matrix.symfony == '^7.0' }}
+ run: phpdbg -qrr vendor/bin/infection --min-msi=82
+
+ - name: Run Infection
+ if: ${{matrix.symfony != '^7.0' }}
run: phpdbg -qrr vendor/bin/infection --min-msi=100
diff --git a/composer.json b/composer.json
index bcf5a0e..e22ef3e 100644
--- a/composer.json
+++ b/composer.json
@@ -10,18 +10,18 @@
}
],
"require": {
- "php": "^8.0",
+ "php": "^8.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/migrations": "^3.0",
"marcj/topsort": "^1.1",
- "symfony/framework-bundle": "^5.4 || ^6.0"
+ "symfony/framework-bundle": "^5.4 || ^6.4 || ^7.0"
},
"require-dev": {
- "infection/infection": "^0.26",
- "matthiasnoback/symfony-config-test": "^4.2",
- "matthiasnoback/symfony-dependency-injection-test": "^4.1",
- "phpunit/phpunit": "^9.5",
- "vimeo/psalm": "^4.23"
+ "infection/infection": "^0.28",
+ "matthiasnoback/symfony-config-test": "^5.1",
+ "matthiasnoback/symfony-dependency-injection-test": "^5.1",
+ "phpstan/phpstan": "^1.10",
+ "phpunit/phpunit": "^9.5"
},
"config": {
"allow-plugins": {
diff --git a/phpstan.neon b/phpstan.neon
new file mode 100644
index 0000000..327324c
--- /dev/null
+++ b/phpstan.neon
@@ -0,0 +1,10 @@
+parameters:
+ level: 6
+ paths:
+ - src
+ - tests
+
+ excludePaths:
+ - tests/Fixture/ContainerAwareMigration
+ - tests/Factory/ContainerAwareVersionFactoryTest.php
+
diff --git a/psalm.xml b/psalm.xml
deleted file mode 100644
index 3bb02f9..0000000
--- a/psalm.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/src/DependencyInjection/SyliusLabsDoctrineMigrationsExtraExtension.php b/src/DependencyInjection/SyliusLabsDoctrineMigrationsExtraExtension.php
index 3243c76..d140d4b 100644
--- a/src/DependencyInjection/SyliusLabsDoctrineMigrationsExtraExtension.php
+++ b/src/DependencyInjection/SyliusLabsDoctrineMigrationsExtraExtension.php
@@ -13,6 +13,11 @@
final class SyliusLabsDoctrineMigrationsExtraExtension extends Extension
{
+ /**
+ * @param array $configs
+ *
+ * @throws \Exception
+ */
public function load(array $configs, ContainerBuilder $container): void
{
$config = $this->processConfiguration($this->getConfiguration([], $container), $configs);
@@ -23,6 +28,9 @@ public function load(array $configs, ContainerBuilder $container): void
$container->getDefinition(TopologicalVersionComparator::class)->setArgument(0, $config['migrations']);
}
+ /**
+ * @param array $config
+ */
public function getConfiguration(array $config, ContainerBuilder $container): ConfigurationInterface
{
return new Configuration();
diff --git a/src/Factory/ContainerAwareVersionFactory.php b/src/Factory/ContainerAwareVersionFactory.php
index 311c393..d0b0a17 100644
--- a/src/Factory/ContainerAwareVersionFactory.php
+++ b/src/Factory/ContainerAwareVersionFactory.php
@@ -27,7 +27,10 @@ public function createVersion(string $migrationClassName): AbstractMigration
{
$instance = $this->migrationFactory->createVersion($migrationClassName);
- if ($instance instanceof ContainerAwareInterface) {
+ if (
+ interface_exists(ContainerAwareInterface::class)
+ && $instance instanceof ContainerAwareInterface
+ ) {
$instance->setContainer($this->container);
}
diff --git a/tests/Factory/ContainerAwareVersionFactoryTest.php b/tests/Factory/ContainerAwareVersionFactoryTest.php
index 287b6a9..1097369 100644
--- a/tests/Factory/ContainerAwareVersionFactoryTest.php
+++ b/tests/Factory/ContainerAwareVersionFactoryTest.php
@@ -11,6 +11,7 @@
use Psr\Log\LoggerInterface;
use SyliusLabs\DoctrineMigrationsExtraBundle\Factory\ContainerAwareVersionFactory;
use Symfony\Component\DependencyInjection\ContainerInterface;
+use Symfony\Component\HttpKernel\Kernel;
use Tests\SyliusLabs\DoctrineMigrationsExtraBundle\Fixture\ContainerAwareMigration;
use Tests\SyliusLabs\DoctrineMigrationsExtraBundle\Fixture\NotContainerAwareMigration;
@@ -19,6 +20,10 @@ final class ContainerAwareVersionFactoryTest extends TestCase
/** @test */
public function migrations_implementing_container_aware_interface_are_injected_with_container(): void
{
+ if (Kernel::MAJOR_VERSION >= 7) {
+ $this->markTestSkipped();
+ }
+
// Arrange
$decoratedFactory = $this->createMock(MigrationFactory::class);
$container = $this->createMock(ContainerInterface::class);