diff --git a/.github/workflows/recipe.yaml b/.github/workflows/recipe.yaml
index d55ce85..86df41e 100644
--- a/.github/workflows/recipe.yaml
+++ b/.github/workflows/recipe.yaml
@@ -14,25 +14,25 @@ jobs:
strategy:
fail-fast: false
matrix:
- php: ['7.4', '8.0', '8.1']
- sylius: ['~1.9.0', '~1.10.0', '~1.11.0', '~1.12.0']
+ php: ['8.0', '8.1', '8.2']
+ sylius: ["~1.11.0", "~1.12.0", "~1.13.0"]
exclude:
- - php: '8.0'
- sylius: '~1.9.0'
- - php: '8.1'
- sylius: '~1.9.0'
- - php: '7.4'
+ - php: '8.2'
sylius: '~1.11.0'
- - php: '7.4'
+ - php: '8.0'
sylius: '~1.12.0'
+ - php: '8.0'
+ sylius: '~1.13.0'
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
+ extensions: gd, intl, json
ini-values: date.timezone=UTC
-
+ tools: symfony-cli
+
- name: Set project php-version
run: |
echo ${{ matrix.php }} > .php-version
@@ -41,15 +41,22 @@ jobs:
with:
path: plugin
- - run: mkdir -p /home/runner/{.composer/cache,.config/composer}
+ - name: Determine composer cache directory
+ id: composer-cache-directory
+ working-directory: plugin
+ run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT
- - uses: actions/cache@v3
+ - name: Cache dependencies installed with composer
+ uses: actions/cache@v3
id: cache-composer
with:
- path: /home/runner/.composer/cache
- key: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-${{ github.sha }}
+ path: ${{ steps.composer-cache-directory.outputs.directory }}
+ key: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-${{ hashFiles('**/composer.json') }}
restore-keys: composer2-php:${{ matrix.php }}-sylius:${{ matrix.sylius }}-
+ - name: Ensure that composer cache directory exists
+ run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }}
+
- name: Composer Github Auth
run: composer config -g github-oauth.github.com ${{ github.token }}
@@ -74,7 +81,7 @@ jobs:
composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
composer config repositories.plugin '{"type": "path", "url": "../plugin/"}'
- - name: Require plugin & install all
+ - name: Require plugin & install all dependencies
working-directory: ./sylius
run: |
composer require monsieurbiz/sylius-no-commerce-plugin="*@dev"
diff --git a/.github/workflows/security.yaml b/.github/workflows/security.yaml
index 687299a..c100cfa 100644
--- a/.github/workflows/security.yaml
+++ b/.github/workflows/security.yaml
@@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- php: ['7.4', '8.0', '8.1']
+ php: ['8.1', '8.2']
steps:
- uses: actions/checkout@v3
@@ -22,26 +22,32 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- ini-values: date.timezone=UTC
+ extensions: gd, intl, json
- name: Set project php-version
run: |
- echo ${{ matrix.php }} > .php-version
+ echo "${{ matrix.php }}" > .php-version
- - uses: actions/cache@v3
+ - name: Determine composer cache directory
+ id: composer-cache-directory
+ run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT
+
+ - name: Cache dependencies installed with composer
+ uses: actions/cache@v3
id: cache-composer
with:
- path: /home/runner/.composer/cache
+ path: ${{ steps.composer-cache-directory.outputs.directory }}
key: composer2-php:${{ matrix.php }}-${{ github.sha }}
restore-keys: composer2-php:${{ matrix.php }}-
- - run: mkdir -p /home/runner/{.composer/cache,.config/composer}
- if: steps.cache-composer.outputs.cache-hit != 'true'
+ - name: Ensure that composer cache directory exists
+ run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }}
- name: Composer Github Auth
run: composer config -g github-oauth.github.com ${{ github.token }}
- name: Install PHP dependencies
- run: composer update --no-scripts --no-plugins --prefer-dist
+ run: composer update --prefer-dist
- uses: symfonycorp/security-checker-action@v4
+
diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml
index d087aae..877ce6a 100644
--- a/.github/workflows/tests.yaml
+++ b/.github/workflows/tests.yaml
@@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- php: ['8.0', '8.1']
+ php: ['8.1', '8.2']
env:
SYMFONY_ARGS: --no-tls
@@ -22,41 +22,39 @@ jobs:
DOCKER_INTERACTIVE_ARGS: -t
steps:
- - uses: actions/checkout@v3
-
- - uses: actions/setup-node@v3
+ - uses: actions/checkout@v2
+ - uses: actions/setup-node@v2
with:
node-version: '14'
-
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
+ extensions: gd, intl, json
ini-values: date.timezone=UTC
-
+ tools: symfony-cli
+
- name: Set project php-version
run: |
- echo ${{ matrix.php }} > .php-version
+ echo "${{ matrix.php }}" > .php-version
- - name: Install symfony CLI
- run: |
- curl https://get.symfony.com/cli/installer | bash
- echo "${HOME}/.symfony5/bin" >> $GITHUB_PATH
+ - name: Determine composer cache directory
+ id: composer-cache-directory
+ run: echo "directory=$(composer config cache-dir)" >> $GITHUB_OUTPUT
- - uses: actions/cache@v3
+ - name: Cache dependencies installed with composer
+ uses: actions/cache@v3
id: cache-composer
with:
- path: /home/runner/.composer/cache
+ path: ${{ steps.composer-cache-directory.outputs.directory }}
key: composer2-php:${{ matrix.php }}-${{ github.sha }}
restore-keys: composer2-php:${{ matrix.php }}-
- - run: mkdir -p /home/runner/{.composer/cache,.config/composer}
+ - name: Ensure that composer cache directory exists
+ run: mkdir -p ${{ steps.composer-cache-directory.outputs.directory }}
- name: Composer Github Auth
run: composer config -g github-oauth.github.com ${{ github.token }}
-
- - name: Disallow Composer plugins for testing purposes
- run: composer config allow-plugins false
- run: make install
@@ -64,6 +62,8 @@ jobs:
- run: make test.phpcs
+ - run: make test.phpunit
+
- run: make test.phpstan
- run: make test.phpmd
diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php
index 324d568..4f0e35f 100644
--- a/.php-cs-fixer.dist.php
+++ b/.php-cs-fixer.dist.php
@@ -51,9 +51,6 @@
'blank_line_after_namespace' => true,
'blank_lines_before_namespace' => true,
'blank_line_before_statement' => true,
- 'braces' => [
- 'allow_single_line_closure' => true,
- ],
'cast_spaces' => true,
'class_attributes_separation' => true,
'class_definition' => [
@@ -63,7 +60,7 @@
'combine_consecutive_issets' => true,
'combine_consecutive_unsets' => true,
'comment_to_phpdoc' => true,
- 'compact_nullable_typehint' => true,
+ 'compact_nullable_type_declaration' => true,
'concat_space' => [
'spacing' => 'one',
],
@@ -89,7 +86,6 @@
'fully_qualified_strict_types' => true,
'function_declaration' => true,
'function_to_constant' => true,
- 'function_typehint_space' => true,
'general_phpdoc_tag_rename' => true,
'global_namespace_import' => [
'import_classes' => true,
@@ -124,7 +120,7 @@
],
'native_constant_invocation' => true,
'native_function_casing' => true,
- 'new_with_braces' => true,
+ 'new_with_parentheses' => true,
'no_alias_functions' => true,
'no_alternative_syntax' => true,
'no_blank_lines_after_class_opening' => true,
@@ -163,14 +159,14 @@
'no_short_bool_cast' => true,
'no_spaces_after_function_name' => true,
'no_spaces_around_offset' => true,
- 'no_spaces_inside_parenthesis' => true,
+ 'spaces_inside_parentheses' => true,
'no_superfluous_elseif' => true,
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => true,
],
'no_unset_cast' => true,
'no_unneeded_control_parentheses' => true,
- 'no_unneeded_curly_braces' => true,
+ 'no_unneeded_braces' => true,
'no_unneeded_final_method' => true,
'no_unset_on_property' => true,
'no_unused_imports' => true,
@@ -183,6 +179,7 @@
'no_whitespace_in_blank_line' => true,
'non_printable_character' => true,
'normalize_index_brace' => true,
+ 'nullable_type_declaration_for_default_null_value' => false,
'object_operator_without_whitespace' => true,
'ordered_imports' => [
'imports_order' => [
@@ -217,7 +214,9 @@
'phpdoc_order' => true,
'phpdoc_return_self_reference' => true,
'phpdoc_scalar' => true,
- 'phpdoc_separation' => ['groups' => [['ORM\\*'], ['Assert\\*']]],
+ 'phpdoc_separation' => ['groups' => [
+ ['ORM\\*'], ['Assert\\*'],
+ ]],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_tag_type' => true,
'phpdoc_to_comment' => false,
@@ -253,6 +252,7 @@
'elements' => ['arrays'],
],
'trim_array_spaces' => true,
+ 'type_declaration_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => [
'elements' => [
diff --git a/.php-version.dist b/.php-version.dist
index b8eb026..2983cad 100644
--- a/.php-version.dist
+++ b/.php-version.dist
@@ -1 +1 @@
-8.1
+8.2
diff --git a/Makefile b/Makefile
index 90113df..4df5513 100644
--- a/Makefile
+++ b/Makefile
@@ -1,13 +1,15 @@
.DEFAULT_GOAL := help
SHELL=/bin/bash
APP_DIR=tests/Application
-SYLIUS_VERSION=1.12.0
+SYLIUS_VERSION=1.13.0
SYMFONY=cd ${APP_DIR} && symfony
COMPOSER=symfony composer
CONSOLE=${SYMFONY} console
export COMPOSE_PROJECT_NAME=no-commerce
+export MIGRATIONS_NAMESPACE=MonsieurBiz\\SyliusNoCommercePlugin\\Migrations
+export USER_UID=$(shell id -u)
PLUGIN_NAME=sylius-${COMPOSE_PROJECT_NAME}-plugin
-COMPOSE=docker-compose
+COMPOSE=docker compose
YARN=yarn
###
@@ -68,22 +70,23 @@ setup_application:
rm -f ${APP_DIR}/yarn.lock
(cd ${APP_DIR} && ${COMPOSER} config repositories.plugin '{"type": "path", "url": "../../"}')
(cd ${APP_DIR} && ${COMPOSER} config extra.symfony.allow-contrib true)
- (cd ${APP_DIR} && ${COMPOSER} config extra.symfony.docker false)
- (cd ${APP_DIR} && ${COMPOSER} config --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]')
- (cd ${APP_DIR} && ${COMPOSER} config allow-plugins true)
(cd ${APP_DIR} && ${COMPOSER} config minimum-stability dev)
+ (cd ${APP_DIR} && ${COMPOSER} config --no-plugins allow-plugins true)
+ (cd ${APP_DIR} && ${COMPOSER} config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]')
(cd ${APP_DIR} && ${COMPOSER} require --no-install --no-scripts --no-progress sylius/sylius="~${SYLIUS_VERSION}") # Make sure to install the required version of sylius because the sylius-standard has a soft constraint
$(MAKE) ${APP_DIR}/.php-version
$(MAKE) ${APP_DIR}/php.ini
(cd ${APP_DIR} && ${COMPOSER} install --no-interaction)
$(MAKE) apply_dist
- (cd ${APP_DIR} && ${COMPOSER} require --no-progress monsieurbiz/${PLUGIN_NAME}="*@dev")
+ (cd ${APP_DIR} && ${COMPOSER} require --no-progress --no-interaction monsieurbiz/${PLUGIN_NAME}="*@dev")
rm -rf ${APP_DIR}/var/cache
${APP_DIR}/docker-compose.yaml:
rm -f ${APP_DIR}/docker-compose.yml
rm -f ${APP_DIR}/docker-compose.yaml
+ rm -f ${APP_DIR}/compose.yml # Remove Sylius file about Docker
+ rm -f ${APP_DIR}/compose.override.dist.yml # Remove Sylius file about Docker
ln -s ../../docker-compose.yaml.dist ${APP_DIR}/docker-compose.yaml
.PHONY: ${APP_DIR}/docker-compose.yaml
@@ -98,14 +101,15 @@ apply_dist:
ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))); \
for i in `cd dist && find . -type f`; do \
FILE_PATH=`echo $$i | sed 's|./||'`; \
- FILENAME=`basename $$FILE_PATH` \
FOLDER_PATH=`dirname $$FILE_PATH`; \
echo $$FILE_PATH; \
(cd ${APP_DIR} && rm -f $$FILE_PATH); \
(cd ${APP_DIR} && mkdir -p $$FOLDER_PATH); \
- if [[ "$$FILENAME" != "Kernel.php" ]]; then \
+ if [[ $$FILE_PATH != 'src/Kernel.php' ]]; then \
+ echo "Link $$FILE_PATH"; \
(cd ${APP_DIR} && ln -s $$ROOT_DIR/dist/$$FILE_PATH $$FILE_PATH); \
else \
+ echo "Copy $$FILE_PATH"; \
(cd ${APP_DIR} && cp $$ROOT_DIR/dist/$$FILE_PATH $$FILE_PATH); \
fi \
done
@@ -114,10 +118,10 @@ apply_dist:
### TESTS
### ¯¯¯¯¯
-test.all: test.composer test.phpstan test.phpmd test.phpspec test.phpcs test.yaml test.schema test.twig test.container ## Run all tests in once
+test.all: test.composer test.phpstan test.phpmd test.phpunit test.phpspec test.phpcs test.yaml test.schema test.twig test.container ## Run all tests in once
test.composer: ## Validate composer.json
- ${COMPOSER} validate --strict --no-plugins
+ ${COMPOSER} validate --strict
test.phpstan: ## Run PHPStan
${COMPOSER} phpstan
@@ -125,6 +129,9 @@ test.phpstan: ## Run PHPStan
test.phpmd: ## Run PHPMD
${COMPOSER} phpmd
+test.phpunit: ## Run PHPUnit
+ ${COMPOSER} phpunit
+
test.phpspec: ## Run PHPSpec
${COMPOSER} phpspec
@@ -138,7 +145,7 @@ test.container: ## Lint the symfony container
${CONSOLE} lint:container
test.yaml: ## Lint the symfony Yaml files
- ${CONSOLE} lint:yaml ../../recipes ../../src/Resources/config
+ ${CONSOLE} lint:yaml ../../src/Resources/config --parse-tags
test.schema: ## Validate MySQL Schema
${CONSOLE} doctrine:schema:validate
@@ -169,6 +176,9 @@ sylius.assets: ## Install all assets with symlinks
messenger.setup: ## Setup Messenger transports
${CONSOLE} messenger:setup-transports
+doctrine.diff: ## Doctrine diff
+ ${CONSOLE} doctrine:migration:diff --namespace="${MIGRATIONS_NAMESPACE}"
+
###
### PLATFORM
### ¯¯¯¯¯¯¯¯
diff --git a/composer.json b/composer.json
index e776214..b45e013 100644
--- a/composer.json
+++ b/composer.json
@@ -5,43 +5,18 @@
"description": "Disable the e-commerce on your Sylius.",
"license": "MIT",
"require": {
- "php": "~7.4|~8.0|~8.1",
- "sylius/sylius": ">=1.8 <1.13",
- "monsieurbiz/sylius-settings-plugin": "^1.0.9"
+ "monsieurbiz/sylius-settings-plugin": "^1.2.0",
+ "php": "^8.0",
+ "sylius/sylius": ">=1.11 <1.14"
},
"require-dev": {
- "behat/behat": "^3.6.1",
- "behat/mink-selenium2-driver": "^1.4",
- "dmore/behat-chrome-extension": "^1.3",
- "dmore/chrome-mink-driver": "^2.7",
- "doctrine/data-fixtures": "^1.4",
- "friends-of-behat/mink": "^1.8",
- "friends-of-behat/mink-browserkit-driver": "^1.4",
- "friends-of-behat/mink-extension": "^2.4",
- "friends-of-behat/page-object-extension": "^0.3",
- "friends-of-behat/symfony-extension": "^2.1",
- "friends-of-behat/variadic-extension": "^1.3",
- "hwi/oauth-bundle": "^1.1",
- "lchrusciel/api-test-case": "^5.0",
- "matthiasnoback/symfony-config-test": "^4.2",
- "matthiasnoback/symfony-dependency-injection-test": "^4.1",
- "mikey179/vfsstream": "^1.6",
- "mockery/mockery": "^1.4",
- "pamil/prophecy-common": "^0.1",
- "phpspec/phpspec": "@stable",
- "phpstan/phpstan": "@stable",
- "phpstan/phpstan-doctrine": "@stable",
- "phpstan/phpstan-webmozart-assert": "@stable",
- "psalm/plugin-mockery": "@stable",
- "psr/event-dispatcher": "@stable",
- "symfony/browser-kit": "@stable",
- "symfony/debug-bundle": "@stable",
- "symfony/dotenv": "@stable",
- "symfony/flex": "@stable",
- "symfony/routing": "^5.4",
- "symfony/web-profiler-bundle": "@stable",
- "phpmd/phpmd": "@stable",
- "friendsofphp/php-cs-fixer": "@stable"
+ "friendsofphp/php-cs-fixer": "^3.16",
+ "phpspec/phpspec": "^7.0",
+ "phpstan/phpstan": "^1.8.4",
+ "phpstan/phpstan-doctrine": "^1.3.2",
+ "phpstan/phpstan-webmozart-assert": "^1.1",
+ "phpunit/phpunit": "^10.5",
+ "phpmd/phpmd": "^2.15"
},
"prefer-stable": true,
"autoload": {
@@ -54,28 +29,28 @@
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
- "phpcs": "php-cs-fixer fix --using-cache=no",
- "phpstan": "phpstan analyse -c phpstan.neon src/ -vvv",
+ "phpcs": "PHP_CS_FIXER_IGNORE_ENV=1 php-cs-fixer fix --using-cache=no",
+ "phpstan": "phpstan analyse -c phpstan.neon src/",
"phpmd": "phpmd --exclude Migrations/* src/ ansi phpmd.xml",
"phpunit": "phpunit",
"phpspec": "phpspec run"
},
"extra": {
"branch-alias": {
- "dev-master": "1.0-dev"
+ "dev-master": "1.1-dev"
},
"symfony": {
"docker": false,
- "endpoint": [
- "https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master",
- "flex://defaults"
- ]
+ "endpoint": ["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master", "flex://defaults"]
}
},
"config": {
"allow-plugins": {
- "php-http/discovery": true,
- "symfony/flex": true
+ "symfony/thanks": true,
+ "symfony/flex": true,
+ "dealerdirect/phpcodesniffer-composer-installer": true,
+ "ergebnis/composer-normalize": true,
+ "php-http/discovery": true
}
}
}
diff --git a/dist/.env.local b/dist/.env.local
new file mode 100644
index 0000000..6c1a99e
--- /dev/null
+++ b/dist/.env.local
@@ -0,0 +1 @@
+SYLIUS_FIXTURES_HOSTNAME=${SYMFONY_DEFAULT_ROUTE_HOST:-localhost}
diff --git a/dist/src/Entity/Channel/Channel.php b/dist/src/Entity/Channel/Channel.php
index f7f912c..8a5810c 100644
--- a/dist/src/Entity/Channel/Channel.php
+++ b/dist/src/Entity/Channel/Channel.php
@@ -16,6 +16,15 @@
use Doctrine\ORM\Mapping as ORM;
use Sylius\Component\Core\Model\Channel as BaseChannel;
+#[ORM\Entity()]
+#[ORM\Table(name: 'sylius_channel')]
+#[ORM\AssociationOverrides(
+ [
+ new ORM\AssociationOverride(
+ name: 'baseCurrency',
+ joinColumns: new ORM\JoinColumn(name: 'base_currency_id', referencedColumnName: 'id', nullable: true)
+ )]
+)]
/**
* @ORM\Entity
* @ORM\Table(name="sylius_channel")
diff --git a/phpstan.neon b/phpstan.neon
index 7e8681f..4ca0c04 100644
--- a/phpstan.neon
+++ b/phpstan.neon
@@ -1,16 +1,8 @@
-includes:
- - vendor/phpstan/phpstan-doctrine/extension.neon
- - vendor/phpstan/phpstan-webmozart-assert/extension.neon
-
parameters:
- level: max
+ level: 8
paths:
- %rootDir%/src/
- checkMissingIterableValueType: false
-
- checkGenericClassInNonGenericObjectType: false
-
excludePaths:
# Makes PHPStan crash
- 'src/DependencyInjection/Configuration.php'
@@ -18,3 +10,6 @@ parameters:
# Test dependencies
- 'tests/Application/**/*'
+
+ ignoreErrors:
+ - identifier: missingType.iterableValue
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..da7719d
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,55 @@
+
+
+
+
+
+ tests/Unit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/recipes/1.0-dev b/recipes/1.0-dev
deleted file mode 120000
index c33aea4..0000000
--- a/recipes/1.0-dev
+++ /dev/null
@@ -1 +0,0 @@
-1.0/
\ No newline at end of file
diff --git a/recipes/1.0/config/packages/monsieurbiz_sylius_nocommerce_plugin.yaml b/recipes/1.0/config/packages/monsieurbiz_sylius_nocommerce_plugin.yaml
deleted file mode 100644
index 06b54b4..0000000
--- a/recipes/1.0/config/packages/monsieurbiz_sylius_nocommerce_plugin.yaml
+++ /dev/null
@@ -1,8 +0,0 @@
-imports:
- - { resource: "@MonsieurBizSyliusNoCommercePlugin/Resources/config/config.yaml" }
-
-monsieurbiz_sylius_nocommerce:
- config:
- allow_countries: false
- allow_customers: false
- allow_zones: false
diff --git a/recipes/1.0/manifest.json b/recipes/1.0/manifest.json
deleted file mode 100644
index 0cad005..0000000
--- a/recipes/1.0/manifest.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "bundles": {
- "MonsieurBiz\\SyliusNoCommercePlugin\\MonsieurBizSyliusNoCommercePlugin": [
- "all"
- ]
- },
- "copy-from-recipe": {
- "config/": "%CONFIG_DIR%/"
- },
- "copy-from-package": {
- "src/Resources/templates/": "templates/"
- }
-}
diff --git a/recipes/1.0/post-install.txt b/recipes/1.0/post-install.txt
deleted file mode 100644
index 575bdbb..0000000
--- a/recipes/1.0/post-install.txt
+++ /dev/null
@@ -1,21 +0,0 @@
- * Add these annotations to your src/Entity/Channel/Channel.php entity to prevent errors during Channel saving:
- /**
- * @ORM\Entity
- * @ORM\Table(name="sylius_channel")
- + * @ORM\AssociationOverrides({
- + * @ORM\AssociationOverride(name="baseCurrency",
- + * joinColumns=@ORM\JoinColumn(
- + * name="base_currency_id", referencedColumnName="id", nullable=true
- + * )
- + * )
- + * })>
- */
- class Channel extends BaseChannel
-
- * Use a different trait for your src/Kernel.php:
- - use MicroKernelTrait;>
- + use SyliusNoCommerceKernelTrait;>
- Don't forget the use MonsieurBiz\SyliusNoCommercePlugin\Kernel\SyliusNoCommerceKernelTrait; statement or course
-
- * Create the new migrations, and run them:
- ./bin/console doctrine:migrations:migrate
diff --git a/src/DependencyInjection/FirewallRegistryPass.php b/src/DependencyInjection/FirewallRegistryPass.php
index 0789c73..af90f1b 100644
--- a/src/DependencyInjection/FirewallRegistryPass.php
+++ b/src/DependencyInjection/FirewallRegistryPass.php
@@ -17,10 +17,14 @@
use Symfony\Component\DependencyInjection\ChildDefinition;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\Reference;
final class FirewallRegistryPass implements CompilerPassInterface
{
+ /**
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
+ */
public function process(ContainerBuilder $container): void
{
$registry = $container->findDefinition('MonsieurBiz\SyliusNoCommercePlugin\Firewall\RegistryInterface');
@@ -29,7 +33,13 @@ public function process(ContainerBuilder $container): void
if (!$configuration instanceof ChildDefinition) {
continue;
}
- $parent = $container->getDefinition($configuration->getParent());
+
+ try {
+ $parent = $container->getDefinition($configuration->getParent());
+ } catch (ServiceNotFoundException $e) {
+ continue;
+ }
+
if (FirewallContext::class !== $parent->getClass()) {
continue;
}
diff --git a/src/Form/Type/Settings/NoCommerceType.php b/src/Form/Type/Settings/NoCommerceType.php
index 42106e0..5f717c6 100644
--- a/src/Form/Type/Settings/NoCommerceType.php
+++ b/src/Form/Type/Settings/NoCommerceType.php
@@ -40,6 +40,9 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
$choices = [];
foreach ($this->firewallRegistry as $firewall) {
$firewallConfig = $firewall->getConfig();
+ if (null === $firewallConfig) {
+ continue;
+ }
$firewallName = $firewallConfig->getName();
if (\in_array($firewallName, self::FIREWALLS_NAMES_CANNOT_BE_DISABLED, true)) {
continue;
diff --git a/src/Registry/TemplateBlockRegistryDecorator.php b/src/Registry/TemplateBlockRegistryDecorator.php
index e061e9e..3a78051 100644
--- a/src/Registry/TemplateBlockRegistryDecorator.php
+++ b/src/Registry/TemplateBlockRegistryDecorator.php
@@ -92,7 +92,6 @@ public function findEnabledForEvents(array $eventNames): array
$templateBlocksPriorityQueue->insert($templateBlock, $templateBlock->getPriority());
}
- /** @phpstan-ignore-next-line */
return $templateBlocksPriorityQueue->toArray();
}
diff --git a/src/Routing/NoCommerceRequestContext.php b/src/Routing/NoCommerceRequestContext.php
index 288916b..90710c9 100644
--- a/src/Routing/NoCommerceRequestContext.php
+++ b/src/Routing/NoCommerceRequestContext.php
@@ -58,6 +58,6 @@ public function __call(string $name, array $arguments)
return \call_user_func($callback, ...$arguments);
}
- throw new Exception(sprintf('Method %s not found for class "%s"', $name, \get_class($this->decorated)));
+ throw new Exception(\sprintf('Method %s not found for class "%s"', $name, \get_class($this->decorated)));
}
}
diff --git a/tests/Unit/.gitkeep b/tests/Unit/.gitkeep
new file mode 100644
index 0000000..e69de29