Skip to content

Commit 36b61f8

Browse files
committed
merge
2 parents 5ce87e3 + 2f0b247 commit 36b61f8

File tree

221 files changed

+9318
-871
lines changed

Some content is hidden

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

221 files changed

+9318
-871
lines changed

.github/workflows/integration-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ jobs:
106106
- if: matrix.php == '8.4' && matrix.database == 'sqlite' && matrix.os == 'ubuntu-latest' && matrix.stability == 'prefer-stable'
107107
name: Coveralls
108108
uses: coverallsapp/github-action@v2
109+
continue-on-error: true
109110
with:
110111
github-token: '${{ secrets.GITHUB_TOKEN }}'
111112
file: build/reports/clover.xml

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ tests/Unit/Log
1616
log/
1717
node_modules
1818
dist
19+
profile/

composer.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"ext-readline": "*",
1414
"ext-simplexml": "*",
1515
"filp/whoops": "^2.15",
16-
"giggsey/libphonenumber-for-php": "^8.13.40",
16+
"giggsey/libphonenumber-for-php-lite": "^9.0",
1717
"guzzlehttp/guzzle": "^7.8",
1818
"laminas/laminas-diactoros": "^3.3",
1919
"monolog/monolog": "^3.7.0",
@@ -39,9 +39,10 @@
3939
},
4040
"require-dev": {
4141
"aidan-casey/mock-client": "dev-master",
42-
"carthage-software/mago": "0.22.0",
42+
"carthage-software/mago": "0.22.2",
4343
"guzzlehttp/psr7": "^2.6.1",
4444
"illuminate/view": "~11.7.0",
45+
"masterminds/html5": "^2.9",
4546
"mikey179/vfsstream": "^2.0@dev",
4647
"nesbot/carbon": "^3.8",
4748
"nyholm/psr7": "^1.8",
@@ -178,8 +179,8 @@
178179
"scripts": {
179180
"phpunit": "vendor/bin/phpunit --display-warnings --display-skipped --display-deprecations --display-errors --display-notices",
180181
"coverage": "vendor/bin/phpunit --coverage-html build/reports/html --coverage-clover build/reports/clover.xml",
181-
"mago:fmt": "vendor/bin/mago fmt",
182-
"mago:lint": "vendor/bin/mago lint --fix --fmt && vendor/bin/mago lint",
182+
"mago:fmt": "vendor/bin/mago fmt && vendor/bin/mago lint --fix --potentially-unsafe --fmt",
183+
"mago:lint": "vendor/bin/mago lint --minimum-level=note",
183184
"phpstan": "vendor/bin/phpstan analyse src tests --memory-limit=1G",
184185
"rector": "vendor/bin/rector process --no-ansi",
185186
"merge": "php -d\"error_reporting = E_ALL & ~E_DEPRECATED\" vendor/bin/monorepo-builder merge",
@@ -191,7 +192,7 @@
191192
"composer mago:fmt",
192193
"composer merge",
193194
"./bin/validate-packages",
194-
"./tempest discovery:clear",
195+
"./tempest discovery:clear --no-interaction",
195196
"composer rector",
196197
"composer phpunit",
197198
"composer mago:lint",

phpstan.neon.dist

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ parameters:
2929
message: '#.*uninitialized readonly property \$composer*#'
3030
-
3131
message: '#.*uninitialized readonly property \$stubFileGenerator*#'
32-
-
33-
message: '#.*undefined property Dom*#'
3432
-
3533
message: '#.*undefined method Dom*#'
3634

rector.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
],
3838
])
3939
->withRules([
40-
ParenthesizeNestedTernaryRector::class,
4140
ExplicitNullableParamTypeRector::class,
4241
])
4342
->withSkip([

src/Tempest/Auth/src/AuthBootstrap.php

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

src/Tempest/Auth/src/AuthorizerMiddleware.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55
namespace Tempest\Auth;
66

77
use Tempest\Container\Container;
8+
use Tempest\Core\Priority;
89
use Tempest\Router\HttpMiddleware;
910
use Tempest\Router\HttpMiddlewareCallable;
1011
use Tempest\Router\MatchedRoute;
1112
use Tempest\Router\Request;
1213
use Tempest\Router\Response;
1314
use Tempest\Router\Responses\Forbidden;
1415

16+
#[Priority(Priority::HIGHEST)]
1517
final readonly class AuthorizerMiddleware implements HttpMiddleware
1618
{
1719
public function __construct(

src/Tempest/CommandBus/src/AsyncCommandMiddleware.php

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,16 @@
55
namespace Tempest\CommandBus;
66

77
use Symfony\Component\Uid\Uuid;
8-
use Tempest\Core\KernelEvent;
9-
use Tempest\EventBus\EventHandler;
8+
use Tempest\Core\Priority;
109
use Tempest\Reflection\ClassReflector;
1110

11+
#[Priority(Priority::FRAMEWORK)]
1212
final readonly class AsyncCommandMiddleware implements CommandBusMiddleware
1313
{
1414
public function __construct(
15-
private CommandBusConfig $commandBusConfig,
1615
private CommandRepository $repository,
1716
) {}
1817

19-
#[EventHandler(KernelEvent::BOOTED)]
20-
public function onBooted(): void
21-
{
22-
$this->commandBusConfig->addMiddleware(self::class);
23-
}
24-
2518
public function __invoke(object $command, CommandBusMiddlewareCallable $next): void
2619
{
2720
$reflector = new ClassReflector($command);

src/Tempest/CommandBus/src/CommandBusConfig.php

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace Tempest\CommandBus;
66

77
use Tempest\CommandBus\AsyncCommandRepositories\FileCommandRepository;
8+
use Tempest\Core\Middleware;
89
use Tempest\Reflection\MethodReflector;
910

1011
final class CommandBusConfig
@@ -13,8 +14,8 @@ public function __construct(
1314
/** @var \Tempest\CommandBus\CommandHandler[] */
1415
public array $handlers = [],
1516

16-
/** @var array<array-key, class-string<\Tempest\CommandBus\CommandBusMiddleware>> */
17-
public array $middleware = [],
17+
/** @var Middleware<\Tempest\CommandBus\CommandBusMiddleware> */
18+
public Middleware $middleware = new Middleware(),
1819

1920
/** @var class-string<\Tempest\CommandBus\CommandRepository> $commandRepositoryClass */
2021
public string $commandRepositoryClass = FileCommandRepository::class,
@@ -35,12 +36,4 @@ public function addHandler(CommandHandler $commandHandler, string $commandName,
3536

3637
return $this;
3738
}
38-
39-
/** @param class-string<\Tempest\CommandBus\CommandBusMiddleware> $middlewareClass */
40-
public function addMiddleware(string $middlewareClass): self
41-
{
42-
$this->middleware[] = $middlewareClass;
43-
44-
return $this;
45-
}
4639
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
namespace Tempest\CommandBus;
4+
5+
use Tempest\Discovery\Discovery;
6+
use Tempest\Discovery\DiscoveryLocation;
7+
use Tempest\Discovery\IsDiscovery;
8+
use Tempest\Reflection\ClassReflector;
9+
10+
final class CommandBusMiddlewareDiscovery implements Discovery
11+
{
12+
use IsDiscovery;
13+
14+
public function __construct(
15+
private readonly CommandBusConfig $commandBusConfig,
16+
) {}
17+
18+
public function discover(DiscoveryLocation $location, ClassReflector $class): void
19+
{
20+
if ($class->implements(CommandBusMiddleware::class)) {
21+
$this->discoveryItems->add($location, $class->getName());
22+
}
23+
}
24+
25+
public function apply(): void
26+
{
27+
$this->commandBusConfig->middleware->add(...$this->discoveryItems);
28+
}
29+
}

0 commit comments

Comments
 (0)