Skip to content

Commit 48ef3cf

Browse files
committed
feat: add extension verifier
1 parent b9b6e6d commit 48ef3cf

File tree

24 files changed

+255
-207
lines changed

24 files changed

+255
-207
lines changed

.github/workflows/code-style.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Code Style
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches:
7+
- main
8+
9+
jobs:
10+
cs:
11+
if: github.event_name != 'schedule'
12+
runs-on: ubuntu-24.04
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Run CS
18+
uses: shopware/github-actions/extension-verifier@main
19+
with:
20+
action: format
21+
22+
check:
23+
runs-on: ubuntu-24.04
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
version-selection: [ 'lowest', 'highest']
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Run Check
33+
uses: shopware/github-actions/extension-verifier@main
34+
with:
35+
action: check
36+
check-against: ${{ matrix.version-selection }}

.github/workflows/js.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/php.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ on:
1414
- cron: '0 3 * * *'
1515

1616
jobs:
17-
cs:
18-
if: github.event_name != 'schedule'
19-
uses: shopware/github-actions/.github/workflows/cs-fixer.yml@main
20-
phpstan:
21-
uses: shopware/github-actions/.github/workflows/phpstan.yml@main
22-
with:
23-
extensionName: ${{ github.event.repository.name }}
24-
shopwareVersion: 6.6.x
2517
phpunit:
2618
strategy:
2719
fail-fast: false

biome.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"shopware/core": "~6.5.0 || ~6.6.0"
4949
},
5050
"scripts": {
51-
"fix-cs": "nix-shell -p php82Packages.php-cs-fixer --run 'php-cs-fixer fix --rules=@PER-CS2.0,no_unused_imports .'"
51+
"format": "docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext",
52+
"check": "docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext"
5253
}
5354
}

phpstan.neon.dist

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,3 @@ parameters:
1111
- tests
1212
symfony:
1313
constantHassers: false
14-
containerXmlPath: '../../../var/cache/static_phpstan_dev/Shopware_Core_DevOps_StaticAnalyze_StaticAnalyzeKernelPhpstan_devDebugContainer.xml'
15-
consoleApplicationLoader: ../../../src/Core/DevOps/StaticAnalyze/console-application.php
16-
17-
ignoreErrors:
18-
- # Direct container access
19-
message: '#Service ".*" is private#'
20-
path: tests

src/Command/ExportCommand.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,16 @@ public function __construct(private readonly Connection $connection)
2525
public function execute(InputInterface $input, OutputInterface $output): int
2626
{
2727
$directory = $input->getArgument('directory');
28-
if (!is_string($directory)) {
28+
if (!\is_string($directory)) {
2929
throw new \RuntimeException('Directory is not a string');
3030
}
3131

3232
$query = <<<'SQL'
33-
SELECT
34-
mail_template_translation.content_plain,
35-
mail_template_translation.content_html,
36-
mail_template_translation.subject,
37-
mail_template_type.technical_name,
33+
SELECT
34+
mail_template_translation.content_plain,
35+
mail_template_translation.content_html,
36+
mail_template_translation.subject,
37+
mail_template_type.technical_name,
3838
mail_template.id,
3939
locale.code AS locale
4040
FROM mail_template_translation
@@ -49,7 +49,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
4949

5050
/** @var array{content_plain: string, content_html: string, subject: string, technical_name: string, id: string, locale: string} $record */
5151
foreach ($records as $record) {
52-
$templateDir = sprintf('%s/%s/%s', $directory, $record['locale'], $record['technical_name']);
52+
$templateDir = \sprintf('%s/%s/%s', $directory, $record['locale'], $record['technical_name']);
5353

5454
$map = [
5555
'content_plain' => 'plain',
@@ -58,9 +58,9 @@ public function execute(InputInterface $input, OutputInterface $output): int
5858
];
5959
foreach ($map as $field => $name) {
6060
if ($input->getOption('template-id')) {
61-
$targetFile = sprintf('%s/%s/%s.twig', $templateDir, Uuid::fromBytesToHex($record['id']), $name);
61+
$targetFile = \sprintf('%s/%s/%s.twig', $templateDir, Uuid::fromBytesToHex($record['id']), $name);
6262
} else {
63-
$targetFile = sprintf('%s/%s.twig', $templateDir, $name);
63+
$targetFile = \sprintf('%s/%s.twig', $templateDir, $name);
6464
}
6565

6666
$fs->dumpFile($targetFile, $record[$field]);

src/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace Frosh\TemplateMail\DependencyInjection;
44

src/DependencyInjection/FroshPlatformTemplateMailExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?php
1+
<?php declare(strict_types=1);
22

33
namespace Frosh\TemplateMail\DependencyInjection;
44

@@ -11,6 +11,7 @@ public function load(array $configs, ContainerBuilder $container): void
1111
{
1212
$configuration = $this->getConfiguration($configs, $container);
1313
\assert($configuration instanceof Configuration);
14+
/** @var array{mjml_server: string} $config */
1415
$config = $this->processConfiguration($configuration, $configs);
1516
$container->setParameter('frosh_platform_template_mail.mjml_server', $config['mjml_server']);
1617
}

src/Exception/MjmlCompileError.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,6 @@
44

55
namespace Frosh\TemplateMail\Exception;
66

7-
class MjmlCompileError extends \RuntimeException {}
7+
class MjmlCompileError extends \RuntimeException
8+
{
9+
}

0 commit comments

Comments
 (0)