Skip to content

Commit bdb5c30

Browse files
authored
ci: use extension verifier (#315)
* ci: use extension verifier * fix: reported errors
1 parent fcb6816 commit bdb5c30

83 files changed

Lines changed: 1975 additions & 1683 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/code-style.yml

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,29 @@ on:
99
jobs:
1010
cs:
1111
if: github.event_name != 'schedule'
12-
uses: shopware/github-actions/.github/workflows/cs-fixer.yml@main
13-
phpstan:
14-
uses: shopware/github-actions/.github/workflows/phpstan.yml@main
15-
with:
16-
extensionName: FroshTools
17-
shopwareVersion: v6.6.0.0-rc1
12+
runs-on: ubuntu-24.04
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Pull verifier
18+
run: docker pull ghcr.io/shopwarelabs/extension-verifier:latest
19+
20+
- name: Run CS
21+
run: docker run --rm -e GITHUB_STEP_SUMMARY -e GITHUB_ACTIONS -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext --dry-run
22+
23+
check:
24+
runs-on: ubuntu-24.04
25+
strategy:
26+
fail-fast: false
27+
matrix:
28+
version-selection: [ 'lowest', 'highest']
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Pull verifier
34+
run: docker pull ghcr.io/shopwarelabs/extension-verifier:latest
35+
36+
- name: Run Check
37+
run: docker run --rm -e GITHUB_STEP_SUMMARY -e GITHUB_ACTIONS -v $GITHUB_STEP_SUMMARY:$GITHUB_STEP_SUMMARY -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext --check-against ${{ matrix.version-selection }}

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,16 @@
3737
"require": {
3838
"shopware/core": "~6.6.0"
3939
},
40+
"require-dev": {
41+
"shopware/elasticsearch": "~6.6.0"
42+
},
4043
"config": {
4144
"allow-plugins": {
4245
"symfony/runtime": true
4346
}
4447
},
4548
"scripts": {
46-
"cs-fix": "docker run --rm -v $(pwd):$(pwd) -w $(pwd) oskarstark/php-cs-fixer-ga --rules=@PER-CS2.0,no_unused_imports .",
47-
"phpstan": "docker run --rm -v $(pwd):/app aragon999/phpstan-shopware:v6.6.0 analyse --level max ."
49+
"format": "docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest format /ext",
50+
"check": "docker run --rm -v $(pwd):/ext ghcr.io/shopwarelabs/extension-verifier:latest check /ext"
4851
}
4952
}

phpstan.neon.dist

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,3 @@ parameters:
22
level: 8
33
paths:
44
- src
5-
type_coverage:
6-
return_type: 100
7-
param_type: 98
8-
property_type: 100

qodana.yaml

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

src/Command/EnvGetCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
4646
if ($variable === null) {
4747
if ($mode === 'json') {
4848
$output->writeln(json_encode($file->values(), \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT));
49-
} elseif ($mode !== '' && $mode !== '0') {
49+
} elseif ($mode !== '') {
5050
$output->writeln($file->__toString());
5151
}
5252

@@ -60,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
6060
$var = $file->get($variable);
6161

6262
if (!$var instanceof EnvironmentKeyValue) {
63-
throw new \RuntimeException(sprintf('Cannot find variable with name: %s', $variable));
63+
throw new \RuntimeException(\sprintf('Cannot find variable with name: %s', $variable));
6464
}
6565

6666
if ($mode === 'json') {

src/Command/EnvListCommand.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
use Symfony\Component\Console\Attribute\AsCommand;
88

99
#[AsCommand('frosh:env:list')]
10-
class EnvListCommand extends EnvGetCommand {}
10+
class EnvListCommand extends EnvGetCommand
11+
{
12+
}

src/Command/MonitorCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ protected function configure(): void
4545

4646
protected function execute(InputInterface $input, OutputInterface $output): int
4747
{
48+
// @phpstan-ignore-next-line
4849
$context = Context::createDefaultContext();
4950

5051
if ($input->getOption(self::MONITOR_EMAIL_OPTION)) {

src/Components/CacheAdapter.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public function clear(): void
9090
}
9191

9292
break;
93-
case $this->adapter instanceof AdapterInterface:
93+
default:
9494
$this->adapter->clear();
9595

9696
break;
@@ -114,14 +114,15 @@ private function getCacheAdapter(AdapterInterface $adapter): AdapterInterface
114114
{
115115
if ($adapter instanceof CacheDecorator) {
116116
// Do not declare function as static
117-
$func = \Closure::bind(fn() => $adapter->decorated, $adapter, $adapter::class);
117+
// @phpstan-ignore-next-line
118+
$func = \Closure::bind(fn () => $adapter->decorated, $adapter, $adapter::class);
118119

119120
return $this->getCacheAdapter($func());
120121
}
121122

122123
if ($adapter instanceof TagAwareAdapter || $adapter instanceof TraceableAdapter) {
123124
// Do not declare function as static
124-
$func = \Closure::bind(fn() => $adapter->pool, $adapter, $adapter::class);
125+
$func = \Closure::bind(fn () => $adapter->pool, $adapter, $adapter::class);
125126

126127
return $this->getCacheAdapter($func());
127128
}
@@ -132,25 +133,25 @@ private function getCacheAdapter(AdapterInterface $adapter): AdapterInterface
132133
private function getRedis(AdapterInterface $adapter): \Redis
133134
{
134135
if ($adapter instanceof RedisTagAwareAdapter) {
135-
$redisProxyGetter = \Closure::bind(fn() => $adapter->redis, $adapter, RedisTagAwareAdapter::class);
136+
$redisProxyGetter = \Closure::bind(fn () => $adapter->redis, $adapter, RedisTagAwareAdapter::class);
136137
} else {
137138
// @phpstan-ignore-next-line
138-
$redisProxyGetter = \Closure::bind(fn() => $adapter->redis, $adapter, RedisAdapter::class);
139+
$redisProxyGetter = \Closure::bind(fn () => $adapter->redis, $adapter, RedisAdapter::class);
139140
}
140141

141142
return $redisProxyGetter();
142143
}
143144

144145
private function getPathFromFilesystemAdapter(FilesystemAdapter $adapter): string
145146
{
146-
$getter = \Closure::bind(fn() => $adapter->directory, $adapter, $adapter::class);
147+
$getter = \Closure::bind(fn () => $adapter->directory, $adapter, $adapter::class);
147148

148149
return $getter();
149150
}
150151

151152
private function getPathOfFilesAdapter(PhpFilesAdapter $adapter): string
152153
{
153-
$getter = \Closure::bind(fn() => $adapter->directory, $adapter, $adapter::class);
154+
$getter = \Closure::bind(fn () => $adapter->directory, $adapter, $adapter::class);
154155

155156
return $getter();
156157
}

src/Components/CacheHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public static function removeDir(string $path): void
3131
$blankDir = sys_get_temp_dir() . '/' . uniqid() . '/';
3232

3333
if (!mkdir($blankDir, 0o755, true) && !is_dir($blankDir)) {
34-
throw new \RuntimeException(sprintf('Directory "%s" was not created', $blankDir));
34+
throw new \RuntimeException(\sprintf('Directory "%s" was not created', $blankDir));
3535
}
3636

3737
$process = new Process(['rsync', '-qa', '--delete', $blankDir, $path . '/']);

src/Components/CacheRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function all(): array
2727
public function get(string $name): CacheAdapter
2828
{
2929
if (!isset($this->adapters[$name])) {
30-
throw new \OutOfBoundsException(sprintf('Cannot find adapter by name %s', $name));
30+
throw new \OutOfBoundsException(\sprintf('Cannot find adapter by name %s', $name));
3131
}
3232

3333
return $this->adapters[$name];

0 commit comments

Comments
 (0)