Skip to content

Commit 502a98b

Browse files
authored
Merge pull request #51 from maximehuran/feature/use-patch
2 parents 7c8a3bc + ae012dc commit 502a98b

File tree

8 files changed

+42
-12
lines changed

8 files changed

+42
-12
lines changed

.php-cs-fixer.dist.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
->setRiskyAllowed(true)
3737
->setRules([
3838
'@DoctrineAnnotation' => true,
39-
'@PHP71Migration' => true,
40-
'@PHP71Migration:risky' => true,
41-
'@PHPUnit60Migration:risky' => true,
39+
'@PHP7x1Migration' => true,
40+
'@PHP7x1Migration:risky' => true,
41+
'@PHPUnit6x0Migration:risky' => true,
4242
'@Symfony' => true,
4343
'@Symfony:risky' => true,
4444
'align_multiline_comment' => [
@@ -256,7 +256,7 @@
256256
'trim_array_spaces' => true,
257257
'type_declaration_spaces' => true,
258258
'unary_operator_spaces' => true,
259-
'visibility_required' => [
259+
'modifier_keywords' => [
260260
'elements' => [
261261
'const',
262262
'property',

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ setup_application:
7373
(cd ${APP_DIR} && ${COMPOSER} config minimum-stability dev)
7474
(cd ${APP_DIR} && ${COMPOSER} config --no-plugins allow-plugins true)
7575
(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"]')
76+
cp -R ./patches ${APP_DIR}/patches
77+
(cd ${APP_DIR} && ${COMPOSER} config --json extra.patches "{\"huluti/altcha-bundle\":{\"Fix assets error with dist/altcha.i18n.js\":\"patches/fix-i18n-altcha.patch\"}}")
7678
(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
7779
$(MAKE) ${APP_DIR}/.php-version
7880
$(MAKE) ${APP_DIR}/php.ini

composer.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"description": "This plugins adds captcha and allows you to manage your spams.",
66
"license": "MIT",
77
"require": {
8+
"cweagans/composer-patches": "^1.7",
89
"karser/karser-recaptcha3-bundle": "~0.2.0",
910
"php": "^8.2",
1011
"sylius/sylius": "~2.0",
@@ -43,6 +44,11 @@
4344
"symfony": {
4445
"docker": false,
4546
"endpoint": ["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master", "flex://defaults"]
47+
},
48+
"patches": {
49+
"huluti/altcha-bundle": {
50+
"Fix assets error with dist/altcha.i18n.js": "patches/fix-i18n-altcha.patch"
51+
}
4652
}
4753
},
4854
"config": {
@@ -51,7 +57,8 @@
5157
"symfony/flex": true,
5258
"dealerdirect/phpcodesniffer-composer-installer": true,
5359
"ergebnis/composer-normalize": true,
54-
"php-http/discovery": true
60+
"php-http/discovery": true,
61+
"cweagans/composer-patches": true
5562
}
5663
}
5764
}

patches/fix-i18n-altcha.patch

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/assets/controllers/altcha_controller.js b/assets/controllers/altcha_controller.js
2+
index 4811795..102a3d9 100644
3+
--- a/assets/controllers/altcha_controller.js
4+
+++ b/assets/controllers/altcha_controller.js
5+
@@ -1,5 +1,4 @@
6+
import {Controller} from '@hotwired/stimulus';
7+
-import 'altcha/dist/altcha.i18n.js';
8+
9+
export default class extends Controller {
10+
11+
diff --git a/assets/package.json b/assets/package.json
12+
index 2f994b8..8bf1b00 100644
13+
--- a/assets/package.json
14+
+++ b/assets/package.json
15+
@@ -13,8 +13,7 @@
16+
}
17+
},
18+
"importmap": {
19+
- "@hotwired/stimulus": "^3.0.0",
20+
- "altcha/dist/altcha.i18n.js": "^2.0.0"
21+
+ "@hotwired/stimulus": "^3.0.0"
22+
}
23+
},
24+
"peerDependencies": {

src/DependencyInjection/Configuration.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ public function getConfigTreeBuilder(): TreeBuilder
3535

3636
private function addExpirationPeriodsSection(ArrayNodeDefinition $node): void
3737
{
38-
/** @phpstan-ignore-next-line */
3938
$node
4039
->children()
4140
->arrayNode('exceeded')

src/DependencyInjection/MonsieurBizSyliusAntiSpamExtension.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
namespace MonsieurBiz\SyliusAntiSpamPlugin\DependencyInjection;
1515

16-
use MonsieurBiz\SyliusAntiSpamPlugin\Validator\ValidatorInterface;
1716
use Sylius\Bundle\CoreBundle\DependencyInjection\PrependDoctrineMigrationsTrait;
1817
use Symfony\Component\Config\FileLocator;
1918
use Symfony\Component\DependencyInjection\ContainerBuilder;
@@ -30,11 +29,6 @@ final class MonsieurBizSyliusAntiSpamExtension extends Extension implements Prep
3029
*/
3130
public function load(array $configs, ContainerBuilder $container): void
3231
{
33-
$container
34-
->registerForAutoconfiguration(ValidatorInterface::class)
35-
->addTag('monsieurbiz_anti_spam.validator')
36-
;
37-
3832
$config = $this->processConfiguration($this->getConfiguration([], $container), $configs);
3933
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config'));
4034
$loader->load('services.yaml');

src/Validator/CustomerValidator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515

1616
use MonsieurBiz\SyliusAntiSpamPlugin\Helper\StringHelper;
1717
use Sylius\Component\Core\Model\CustomerInterface;
18+
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
1819

20+
#[AutoconfigureTag('monsieurbiz_anti_spam.validator')]
1921
final class CustomerValidator implements ValidatorInterface
2022
{
2123
public const STRING_MINIMUM_SCORE = '0.2';

src/Validator/ReCaptcha3Validator.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515

1616
use Karser\Recaptcha3Bundle\ReCaptcha\Response as RecaptchaResponse;
1717
use Karser\Recaptcha3Bundle\Validator\Constraints\Recaptcha3Validator as Recaptcha3ValidatorConstraints;
18+
use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag;
1819
use Symfony\Component\HttpFoundation\RequestStack;
1920

21+
#[AutoconfigureTag('monsieurbiz_anti_spam.validator')]
2022
final class ReCaptcha3Validator implements ValidatorInterface
2123
{
2224
public const CAPTCHA_MINIMUM_SCORE = 0.8;

0 commit comments

Comments
 (0)