diff --git a/.editorconfig b/.editorconfig
index 003d4988..ddd1cc31 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -15,64 +15,17 @@ charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
-[*.feature]
-indent_style = space
-indent_size = 4
-
[*.js]
-indent_style = space
indent_size = 2
[*.json]
-indent_style = space
indent_size = 2
[*.md]
-indent_style = space
-indent_size = 4
trim_trailing_whitespace = false
-[*.neon]
-indent_style = space
-indent_size = 4
-
-[*.php]
-indent_style = space
-indent_size = 4
-
-[*.sh]
-indent_style = space
-indent_size = 4
-
[*.{yaml,yml}]
-indent_style = space
-indent_size = 4
trim_trailing_whitespace = false
-[.babelrc]
-indent_style = space
-indent_size = 2
-
-[.gitmodules]
-indent_style = tab
-indent_size = 4
-
-[.php_cs{,.dist}]
-indent_style = space
-indent_size = 4
-
[composer.json]
-indent_style = space
-indent_size = 4
-
-[package.json]
-indent_style = space
-indent_size = 2
-
-[phpstan.neon]
-indent_style = space
-indent_size = 4
-
-[phpunit.xml{,.dist}]
-indent_style = space
indent_size = 4
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
index bab287ad..1e7a8dec 100644
--- a/.github/dependabot.yml
+++ b/.github/dependabot.yml
@@ -1,43 +1,49 @@
version: 2
updates:
-- package-ecosystem: composer
- directory: "/"
- schedule:
- interval: daily
- time: "10:00"
- open-pull-requests-limit: 10
- ignore:
- - dependency-name: vimeo/psalm
- versions:
- - 4.5.0
- - 4.5.1
- - 4.5.2
- - 4.6.0
- - 4.6.1
- - 4.6.2
- - 4.6.3
- - 4.7.0
- - 4.7.1
- - dependency-name: phpstan/phpstan
- versions:
- - 0.12.70
- - 0.12.71
- - 0.12.73
- - 0.12.75
- - 0.12.76
- - 0.12.77
- - 0.12.78
- - 0.12.80
- - 0.12.81
- - 0.12.83
- - 0.12.84
- - dependency-name: sylius-labs/coding-standard
- versions:
- - 4.0.2
- - dependency-name: phpstan/phpstan-doctrine
- versions:
- - 0.12.32
- - dependency-name: phpstan/phpstan-webmozart-assert
- versions:
- - 0.12.10
- - 0.12.11
+ -
+ package-ecosystem: composer
+ directory: "/"
+ schedule:
+ interval: daily
+ time: "10:00"
+ open-pull-requests-limit: 10
+ ignore:
+ -
+ dependency-name: vimeo/psalm
+ versions:
+ - 4.5.0
+ - 4.5.1
+ - 4.5.2
+ - 4.6.0
+ - 4.6.1
+ - 4.6.2
+ - 4.6.3
+ - 4.7.0
+ - 4.7.1
+ -
+ dependency-name: phpstan/phpstan
+ versions:
+ - 0.12.70
+ - 0.12.71
+ - 0.12.73
+ - 0.12.75
+ - 0.12.76
+ - 0.12.77
+ - 0.12.78
+ - 0.12.80
+ - 0.12.81
+ - 0.12.83
+ - 0.12.84
+ -
+ dependency-name: sylius-labs/coding-standard
+ versions:
+ - 4.0.2
+ -
+ dependency-name: phpstan/phpstan-doctrine
+ versions:
+ - 0.12.32
+ -
+ dependency-name: phpstan/phpstan-webmozart-assert
+ versions:
+ - 0.12.10
+ - 0.12.11
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index f486fcc3..78836c51 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -10,7 +10,7 @@ on:
paths-ignore:
- "*.md"
release:
- types: [created]
+ types: [ created ]
schedule:
-
cron: "0 1 * * 6" # Run at 1am every Saturday
@@ -29,47 +29,49 @@ jobs:
strategy:
fail-fast: false
matrix:
- php: ["8.3"]
- symfony: ["^6.4", "^7.4"]
- sylius: ["~2.0.0", "~2.1.0", "~2.2.0"]
- database: ["mysql:8.4"]
- node: ["22.x"]
-
- exclude:
- - sylius: "~2.0.0"
- symfony: "^7.4"
+ php: [ "8.3", "8.4" ]
+ symfony: [ "^6.4", "^7.4" ]
+ sylius: [ "~2.1.0", "~2.2.0" ]
+ database: [ "mysql:8.4" ]
+ node: [ "22.x" ]
include:
- - php: "8.3"
- symfony: "^7.4"
- sylius: "~2.2.0"
- database: "mysql:8.0"
- node: "22.x"
- - php: "8.3"
- symfony: "^7.4"
- sylius: "~2.2.0"
- database: "mariadb:10.11"
- node: "22.x"
- - php: "8.3"
- symfony: "^7.4"
- sylius: "~2.2.0"
- database: "mariadb:11.4"
- node: "22.x"
- - php: "8.3"
- symfony: "^7.4"
- sylius: "~2.2.0"
- database: "postgres:15"
- node: "22.x"
- - php: "8.3"
- symfony: "^7.4"
- sylius: "~2.2.0"
- database: "postgres:16"
- node: "22.x"
- - php: "8.3"
- symfony: "^7.4"
- sylius: "~2.2.0"
- database: "postgres:17"
- node: "22.x"
+ -
+ php: "8.3"
+ symfony: "^7.4"
+ sylius: "~2.2.0"
+ database: "mysql:8.0"
+ node: "22.x"
+ -
+ php: "8.3"
+ symfony: "^7.4"
+ sylius: "~2.2.0"
+ database: "mariadb:10.11"
+ node: "22.x"
+ -
+ php: "8.3"
+ symfony: "^7.4"
+ sylius: "~2.2.0"
+ database: "mariadb:11.4"
+ node: "22.x"
+ -
+ php: "8.3"
+ symfony: "^7.4"
+ sylius: "~2.2.0"
+ database: "postgres:15"
+ node: "22.x"
+ -
+ php: "8.3"
+ symfony: "^7.4"
+ sylius: "~2.2.0"
+ database: "postgres:16"
+ node: "22.x"
+ -
+ php: "8.3"
+ symfony: "^7.4"
+ sylius: "~2.2.0"
+ database: "postgres:17"
+ node: "22.x"
env:
APP_ENV: test
@@ -91,6 +93,14 @@ jobs:
sylius_version: "${{ matrix.sylius }}"
symfony_version: "${{ matrix.symfony }}"
+ -
+ name: Run ECS
+ run: vendor/bin/ecs check
+
+ -
+ name: Run PHPStan
+ run: vendor/bin/phpstan analyse
+
-
name: Run unit tests
run: vendor/bin/phpunit --colors=always --testsuite=unit
diff --git a/README.md b/README.md
index 8967a2c8..f499b57b 100644
--- a/README.md
+++ b/README.md
@@ -103,7 +103,7 @@ To be able to set up a plugin's database, remember to configure your database cr
- PHPStan
```bash
- vendor/bin/phpstan analyse -c phpstan.neon -l max src/
+ vendor/bin/phpstan analyse
```
- Coding Standard
diff --git a/assets/shop/js/greetings.js b/assets/shop/js/greetings.js
index 3d7adfd2..f89aad7f 100644
--- a/assets/shop/js/greetings.js
+++ b/assets/shop/js/greetings.js
@@ -1,3 +1,3 @@
setTimeout(function () {
- document.getElementById('greeting').innerHTML = document.getElementById('greeting').dataset.greeting;
+ document.getElementById('greeting').innerHTML = document.getElementById('greeting').dataset.greeting;
}, 1000);
diff --git a/compose.override.dist.yml b/compose.override.dist.yml
index f8fccb6b..1bb2bd62 100644
--- a/compose.override.dist.yml
+++ b/compose.override.dist.yml
@@ -63,7 +63,7 @@ services:
volumes:
- .:/srv/sylius:rw,cached
- ./public:/srv/sylius/public:rw,delegated
- mailhog:
+ mailpit:
ports:
- "8025:8025"
diff --git a/compose.yml b/compose.yml
index 067908bb..34fbcbf4 100644
--- a/compose.yml
+++ b/compose.yml
@@ -17,6 +17,6 @@ services:
image: ghcr.io/sylius/sylius-nginx:latest
depends_on:
- php
- mailhog:
+ mailpit:
# do not use in production!
- image: mailhog/mailhog:latest
+ image: axllent/mailpit:latest
diff --git a/composer.json b/composer.json
index bc392696..a0843bec 100644
--- a/composer.json
+++ b/composer.json
@@ -14,10 +14,10 @@
},
"require-dev": {
"behat/behat": "^3.16",
+ "behat/mink": "^1.13",
"dbrekelmans/bdi": "^1.4",
"dmore/behat-chrome-extension": "^1.4",
"dmore/chrome-mink-driver": "^2.9",
- "friends-of-behat/mink": "^1.11",
"friends-of-behat/mink-browserkit-driver": "^1.6",
"friends-of-behat/mink-debug-extension": "^2.1",
"friends-of-behat/mink-extension": "^2.7",
diff --git a/config/config.php b/config/config.php
new file mode 100644
index 00000000..e0c5c5ff
--- /dev/null
+++ b/config/config.php
@@ -0,0 +1,9 @@
+import('twig_hooks/**/*.php');
+};
diff --git a/config/config.yaml b/config/config.yaml
deleted file mode 100644
index 063a8094..00000000
--- a/config/config.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-# Put your plugin configuration here
-
-imports:
- - { resource: "twig_hooks/**/*.yaml" }
diff --git a/config/routes/admin.php b/config/routes/admin.php
new file mode 100644
index 00000000..46528cf3
--- /dev/null
+++ b/config/routes/admin.php
@@ -0,0 +1,8 @@
+add('acme_sylius_example_static_welcome', '/static-welcome/{name}')
+ ->defaults([
+ '_controller' => [GreetingController::class, 'staticallyGreetAction'],
+ 'name' => null,
+ ])
+ ;
+
+ $routes->add('acme_sylius_example_dynamic_welcome', '/dynamic-welcome/{name}')
+ ->defaults([
+ '_controller' => [GreetingController::class, 'dynamicallyGreetAction'],
+ 'name' => null,
+ ])
+ ;
+};
diff --git a/config/routes/shop.yaml b/config/routes/shop.yaml
deleted file mode 100644
index 7f47db1a..00000000
--- a/config/routes/shop.yaml
+++ /dev/null
@@ -1,13 +0,0 @@
-# Delete these routes and define your own shop routes here
-
-acme_sylius_example_static_welcome:
- path: /static-welcome/{name}
- defaults:
- _controller: Acme\SyliusExamplePlugin\Controller\GreetingController::staticallyGreetAction
- name: ~
-
-acme_sylius_example_dynamic_welcome:
- path: /dynamic-welcome/{name}
- defaults:
- _controller: Acme\SyliusExamplePlugin\Controller\GreetingController::dynamicallyGreetAction
- name: ~
diff --git a/config/services.php b/config/services.php
new file mode 100644
index 00000000..8cc3ee17
--- /dev/null
+++ b/config/services.php
@@ -0,0 +1,9 @@
+import('services/*.php');
+};
diff --git a/config/services.xml b/config/services.xml
deleted file mode 100644
index 738f1aa0..00000000
--- a/config/services.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/config/services/.gitkeep b/config/services/.gitkeep
deleted file mode 100644
index e69de29b..00000000
diff --git a/config/services/controller.php b/config/services/controller.php
new file mode 100644
index 00000000..b1255ad7
--- /dev/null
+++ b/config/services/controller.php
@@ -0,0 +1,17 @@
+services();
+
+ $services->set(GreetingController::class)
+ ->public()
+ ->autowire()
+ ->autoconfigure()
+ ;
+};
diff --git a/config/twig_hooks/shop.yaml b/config/twig_hooks/shop.yaml
deleted file mode 100644
index 33682f02..00000000
--- a/config/twig_hooks/shop.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-sylius_twig_hooks:
- hooks:
- 'app_shop.greeting.dynamic':
- content:
- template: '@AcmeSyliusExamplePlugin/shop/greeting/dynamic/content.html.twig'
- priority: 0
- 'app_shop.greeting.static':
- content:
- template: '@AcmeSyliusExamplePlugin/shop/greeting/static/content.html.twig'
- priority: 0
diff --git a/config/twig_hooks/shop/greeting.php b/config/twig_hooks/shop/greeting.php
new file mode 100644
index 00000000..798aff93
--- /dev/null
+++ b/config/twig_hooks/shop/greeting.php
@@ -0,0 +1,24 @@
+extension('sylius_twig_hooks', [
+ 'hooks' => [
+ 'app_shop.greeting.dynamic' => [
+ 'content' => [
+ 'template' => '@AcmeSyliusExamplePlugin/shop/greeting/dynamic/content.html.twig',
+ 'priority' => 0,
+ ],
+ ],
+ 'app_shop.greeting.static' => [
+ 'content' => [
+ 'template' => '@AcmeSyliusExamplePlugin/shop/greeting/static/content.html.twig',
+ 'priority' => 0,
+ ],
+ ],
+ ],
+ ]);
+};
diff --git a/ecs.php b/ecs.php
index 7c3d8f38..ff9ff19b 100644
--- a/ecs.php
+++ b/ecs.php
@@ -2,7 +2,6 @@
declare(strict_types=1);
-use PhpCsFixer\Fixer\ClassNotation\VisibilityRequiredFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;
return static function (ECSConfig $ecsConfig): void {
@@ -14,4 +13,3 @@
$ecsConfig->import('vendor/sylius-labs/coding-standard/ecs.php');
};
-
diff --git a/src/DependencyInjection/AcmeSyliusExampleExtension.php b/src/DependencyInjection/AcmeSyliusExampleExtension.php
index 10475196..19755db8 100644
--- a/src/DependencyInjection/AcmeSyliusExampleExtension.php
+++ b/src/DependencyInjection/AcmeSyliusExampleExtension.php
@@ -9,7 +9,7 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface;
-use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
+use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
final class AcmeSyliusExampleExtension extends AbstractResourceExtension implements PrependExtensionInterface
{
@@ -18,9 +18,9 @@ final class AcmeSyliusExampleExtension extends AbstractResourceExtension impleme
/** @psalm-suppress UnusedVariable */
public function load(array $configs, ContainerBuilder $container): void
{
- $loader = new XmlFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
+ $loader = new PhpFileLoader($container, new FileLocator(__DIR__ . '/../../config'));
- $loader->load('services.xml');
+ $loader->load('services.php');
}
public function prepend(ContainerBuilder $container): void
@@ -30,7 +30,7 @@ public function prepend(ContainerBuilder $container): void
protected function getMigrationsNamespace(): string
{
- return 'DoctrineMigrations';
+ return 'Acme\SyliusExamplePlugin';
}
protected function getMigrationsDirectory(): string
diff --git a/tests/Behat/Context/Ui/Shop/WelcomeContext.php b/tests/Behat/Context/Ui/Shop/WelcomeContext.php
index a0d95b08..3e13279f 100644
--- a/tests/Behat/Context/Ui/Shop/WelcomeContext.php
+++ b/tests/Behat/Context/Ui/Shop/WelcomeContext.php
@@ -8,26 +8,12 @@
use Tests\Acme\SyliusExamplePlugin\Behat\Page\Shop\WelcomePageInterface;
use Webmozart\Assert\Assert;
-final class WelcomeContext implements Context
+final readonly class WelcomeContext implements Context
{
- /**
- * @var WelcomePageInterface
- */
- private $staticWelcomePage;
-
- /**
- * @var WelcomePageInterface
- */
- private $dynamicWelcomePage;
-
- /**
- * @param WelcomePageInterface $staticWelcomePage
- * @param WelcomePageInterface $dynamicWelcomePage
- */
- public function __construct(WelcomePageInterface $staticWelcomePage, WelcomePageInterface $dynamicWelcomePage)
- {
- $this->staticWelcomePage = $staticWelcomePage;
- $this->dynamicWelcomePage = $dynamicWelcomePage;
+ public function __construct(
+ private WelcomePageInterface $staticWelcomePage,
+ private WelcomePageInterface $dynamicWelcomePage,
+ ) {
}
/**
diff --git a/tests/Behat/Page/Shop/DynamicWelcomePage.php b/tests/Behat/Page/Shop/DynamicWelcomePage.php
index 6bfc5fa3..3f2052cb 100644
--- a/tests/Behat/Page/Shop/DynamicWelcomePage.php
+++ b/tests/Behat/Page/Shop/DynamicWelcomePage.php
@@ -9,9 +9,6 @@
class DynamicWelcomePage extends SymfonyPage implements WelcomePageInterface
{
- /**
- * {@inheritdoc}
- */
public function getGreeting(): string
{
$greeting = $this->getSession()->getPage()->waitFor(3, function (): string {
@@ -29,17 +26,11 @@ public function getGreeting(): string
return $greeting;
}
- /**
- * {@inheritdoc}
- */
public function getRouteName(): string
{
return 'acme_sylius_example_dynamic_welcome';
}
- /**
- * {@inheritdoc}
- */
protected function getDefinedElements(): array
{
return array_merge(parent::getDefinedElements(), [
diff --git a/tests/Behat/Page/Shop/StaticWelcomePage.php b/tests/Behat/Page/Shop/StaticWelcomePage.php
index 14de7393..b2b1d6b4 100644
--- a/tests/Behat/Page/Shop/StaticWelcomePage.php
+++ b/tests/Behat/Page/Shop/StaticWelcomePage.php
@@ -8,25 +8,16 @@
class StaticWelcomePage extends SymfonyPage implements WelcomePageInterface
{
- /**
- * {@inheritdoc}
- */
public function getGreeting(): string
{
return $this->getElement('greeting')->getText();
}
- /**
- * {@inheritdoc}
- */
public function getRouteName(): string
{
return 'acme_sylius_example_static_welcome';
}
- /**
- * {@inheritdoc}
- */
protected function getDefinedElements(): array
{
return array_merge(parent::getDefinedElements(), [
diff --git a/tests/Behat/Page/Shop/WelcomePageInterface.php b/tests/Behat/Page/Shop/WelcomePageInterface.php
index 7cd873c0..a8f5bd30 100644
--- a/tests/Behat/Page/Shop/WelcomePageInterface.php
+++ b/tests/Behat/Page/Shop/WelcomePageInterface.php
@@ -8,8 +8,5 @@
interface WelcomePageInterface extends SymfonyPageInterface
{
- /**
- * @return string
- */
public function getGreeting(): string;
}
diff --git a/tests/Behat/Resources/services.php b/tests/Behat/Resources/services.php
new file mode 100644
index 00000000..8cc3ee17
--- /dev/null
+++ b/tests/Behat/Resources/services.php
@@ -0,0 +1,9 @@
+import('services/*.php');
+};
diff --git a/tests/Behat/Resources/services.xml b/tests/Behat/Resources/services.xml
deleted file mode 100644
index 8c823e9f..00000000
--- a/tests/Behat/Resources/services.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/tests/Behat/Resources/services/page.php b/tests/Behat/Resources/services/page.php
new file mode 100644
index 00000000..6c711256
--- /dev/null
+++ b/tests/Behat/Resources/services/page.php
@@ -0,0 +1,20 @@
+services();
+
+ $services->set('acme_sylius_example.page.shop.static_welcome', StaticWelcomePage::class)
+ ->parent('sylius.behat.symfony_page')
+ ;
+
+ $services->set('acme_sylius_example.page.shop.dynamic_welcome', DynamicWelcomePage::class)
+ ->parent('sylius.behat.symfony_page')
+ ;
+};
diff --git a/tests/Behat/Resources/services/ui.php b/tests/Behat/Resources/services/ui.php
new file mode 100644
index 00000000..e40e46d1
--- /dev/null
+++ b/tests/Behat/Resources/services/ui.php
@@ -0,0 +1,19 @@
+services();
+
+ $services->set('acme_sylius_example.context.ui.shop.welcome', WelcomeContext::class)
+ ->public()
+ ->args([
+ service('acme_sylius_example.page.shop.static_welcome'),
+ service('acme_sylius_example.page.shop.dynamic_welcome'),
+ ])
+ ;
+};
diff --git a/tests/TestApplication/config/config.yaml b/tests/TestApplication/config/config.yaml
index 6b880837..222bedaf 100644
--- a/tests/TestApplication/config/config.yaml
+++ b/tests/TestApplication/config/config.yaml
@@ -1,5 +1,5 @@
imports:
- - { resource: "@AcmeSyliusExamplePlugin/config/config.yaml" }
+ - { resource: "@AcmeSyliusExamplePlugin/config/config.php" }
- { resource: "services_test.php" }
twig:
diff --git a/tests/TestApplication/config/routes.yaml b/tests/TestApplication/config/routes.yaml
index a913ba4f..383c356a 100644
--- a/tests/TestApplication/config/routes.yaml
+++ b/tests/TestApplication/config/routes.yaml
@@ -1,5 +1,5 @@
acme_sylius_example_admin:
- resource: "@AcmeSyliusExamplePlugin/config/routes/admin.yaml"
+ resource: "@AcmeSyliusExamplePlugin/config/routes/admin.php"
acme_sylius_example_shop:
- resource: "@AcmeSyliusExamplePlugin/config/routes/shop.yaml"
+ resource: "@AcmeSyliusExamplePlugin/config/routes/shop.php"
diff --git a/tests/TestApplication/config/services_test.php b/tests/TestApplication/config/services_test.php
index 3b16fd7a..bab48563 100644
--- a/tests/TestApplication/config/services_test.php
+++ b/tests/TestApplication/config/services_test.php
@@ -7,6 +7,6 @@
return function (ContainerConfigurator $container) {
if (str_starts_with($container->env(), 'test')) {
$container->import('../../../vendor/sylius/sylius/src/Sylius/Behat/Resources/config/services.xml');
- $container->import('@AcmeSyliusExamplePlugin/tests/Behat/Resources/services.xml');
+ $container->import('@AcmeSyliusExamplePlugin/tests/Behat/Resources/services.php');
}
};