Skip to content

Commit

Permalink
[TransactionalMessenger] Update dependencies, drop support for symfon…
Browse files Browse the repository at this point in the history
…y 5.* version, refactor, update CodeStyle, drop support for php 8.1
  • Loading branch information
fractalzombie committed Mar 3, 2024
1 parent da636bd commit 39b8f3a
Show file tree
Hide file tree
Showing 56 changed files with 728 additions and 159 deletions.
66 changes: 51 additions & 15 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,40 @@
<?php

/** @noinspection DuplicatedCode */

declare(strict_types=1);

$finder = PhpCsFixer\Finder::create()
->exclude('var')
->exclude('vendor')
->exclude('Documentation')
->notPath('#Enum#')
->in(__DIR__)
;
use PhpCsFixer\Config;
use PhpCsFixer\Finder;


$owner = 'Mykhailo Shtanko';
$email = 'fractalzombie@gmail.com';
$year = date('Y');
$projectDirectory = __DIR__;

$header = <<<'EOF'
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Copyright (c) {{YEAR}} {{OWNER}} {{EMAIL}}
For the full copyright and license information, please view the LICENSE.MD
file that was distributed with this source code.
EOF;

$finder = Finder::create()
->exclude([
'var',
'vendor',
'.github',
'.docker',
'Documentation',
])
->notName('*Configuration.*')
->ignoreDotFiles(true)
->in(__DIR__);

$rules = [
'@PSR2' => true,
Expand All @@ -17,20 +43,30 @@
'@Symfony:risky' => true,
'@PhpCsFixer' => true,
'@PHP80Migration' => true,
'@PHP81Migration' => true,
'@PHP80Migration:risky' => true,
'@PHPUnit84Migration:risky' => true,
'phpdoc_line_span' => ['const' => 'single', 'property' => 'single', 'method' => 'single'],
'comment_to_phpdoc' => ['ignored_tags' => ['scrutinizer']],
'phpdoc_to_comment' => ['ignored_tags' => ['scrutinizer']],
'date_time_immutable' => true,
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
'single_line_throw' => true,
'php_unit_internal_class' => false,
'phpdoc_align' => ['align' => 'left'],
'php_unit_test_case_static_method_calls' => false,
'php_unit_test_class_requires_covers' => false,
'php_unit_internal_class' => false,
'phpdoc_line_span' => ['const' => 'single', 'property' => 'single', 'method' => 'single'],
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
'header_comment' => [
'comment_type' => 'PHPDoc',
'header' => str_replace(
['{{YEAR}}', '{{OWNER}}', '{{EMAIL}}'],
[$year, $owner, $email],
$header,
),
'location' => 'after_declare_strict',
'separate' => 'top',
],
];

return (new PhpCsFixer\Config())
return (new Config())
->setRiskyAllowed(true)
->setRules($rules)
->setFinder($finder)
;
->setFinder($finder);
11 changes: 11 additions & 0 deletions Attribute/Transactional.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

declare(strict_types=1);

/**
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* Copyright (c) 2024 Mykhailo Shtanko fractalzombie@gmail.com
*
* For the full copyright and license information, please view the LICENSE.MD
* file that was distributed with this source code.
*/

namespace FRZB\Component\TransactionalMessenger\Attribute;

use FRZB\Component\TransactionalMessenger\Enum\CommitType;
Expand Down
13 changes: 13 additions & 0 deletions Enum/CommitType.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
<?php

declare(strict_types=1);

/**
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* Copyright (c) 2024 Mykhailo Shtanko fractalzombie@gmail.com
*
* For the full copyright and license information, please view the LICENSE.MD
* file that was distributed with this source code.
*/

namespace FRZB\Component\TransactionalMessenger\Enum;

enum CommitType
Expand Down
14 changes: 12 additions & 2 deletions Event/DispatchFailedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

declare(strict_types=1);

/**
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* Copyright (c) 2024 Mykhailo Shtanko fractalzombie@gmail.com
*
* For the full copyright and license information, please view the LICENSE.MD
* file that was distributed with this source code.
*/

namespace FRZB\Component\TransactionalMessenger\Event;

use FRZB\Component\TransactionalMessenger\ValueObject\FailedEnvelope;
Expand All @@ -13,6 +24,5 @@ final class DispatchFailedEvent extends Event
{
public function __construct(
public readonly FailedEnvelope $envelope,
) {
}
) {}
}
14 changes: 12 additions & 2 deletions Event/DispatchSucceedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

declare(strict_types=1);

/**
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* Copyright (c) 2024 Mykhailo Shtanko fractalzombie@gmail.com
*
* For the full copyright and license information, please view the LICENSE.MD
* file that was distributed with this source code.
*/

namespace FRZB\Component\TransactionalMessenger\Event;

use FRZB\Component\TransactionalMessenger\ValueObject\SucceedEnvelope;
Expand All @@ -13,6 +24,5 @@ final class DispatchSucceedEvent extends Event
{
public function __construct(
public readonly SucceedEnvelope $envelope,
) {
}
) {}
}
14 changes: 12 additions & 2 deletions EventListener/CommitTransactionOnMessageHandledEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

declare(strict_types=1);

/**
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* Copyright (c) 2024 Mykhailo Shtanko fractalzombie@gmail.com
*
* For the full copyright and license information, please view the LICENSE.MD
* file that was distributed with this source code.
*/

namespace FRZB\Component\TransactionalMessenger\EventListener;

use FRZB\Component\TransactionalMessenger\Attribute\Transactional;
Expand All @@ -15,8 +26,7 @@ class CommitTransactionOnMessageHandledEventListener
{
public function __construct(
private readonly CommitService $service,
) {
}
) {}

public function __invoke(): void
{
Expand Down
14 changes: 12 additions & 2 deletions EventListener/CommitTransactionOnResponseEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

declare(strict_types=1);

/**
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* Copyright (c) 2024 Mykhailo Shtanko fractalzombie@gmail.com
*
* For the full copyright and license information, please view the LICENSE.MD
* file that was distributed with this source code.
*/

namespace FRZB\Component\TransactionalMessenger\EventListener;

use FRZB\Component\TransactionalMessenger\Attribute\Transactional;
Expand All @@ -15,8 +26,7 @@ class CommitTransactionOnResponseEventListener
{
public function __construct(
private readonly CommitService $service,
) {
}
) {}

public function __invoke(): void
{
Expand Down
14 changes: 12 additions & 2 deletions EventListener/CommitTransactionOnTerminateEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

declare(strict_types=1);

/**
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* Copyright (c) 2024 Mykhailo Shtanko fractalzombie@gmail.com
*
* For the full copyright and license information, please view the LICENSE.MD
* file that was distributed with this source code.
*/

namespace FRZB\Component\TransactionalMessenger\EventListener;

use FRZB\Component\TransactionalMessenger\Attribute\Transactional;
Expand All @@ -17,8 +28,7 @@ class CommitTransactionOnTerminateEventListener
{
public function __construct(
private readonly CommitService $service,
) {
}
) {}

public function __invoke(): void
{
Expand Down
14 changes: 12 additions & 2 deletions EventListener/RollbackTransactionOnConsoleErrorEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

declare(strict_types=1);

/**
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* Copyright (c) 2024 Mykhailo Shtanko fractalzombie@gmail.com
*
* For the full copyright and license information, please view the LICENSE.MD
* file that was distributed with this source code.
*/

namespace FRZB\Component\TransactionalMessenger\EventListener;

use FRZB\Component\TransactionalMessenger\Attribute\Transactional;
Expand All @@ -15,8 +26,7 @@ class RollbackTransactionOnConsoleErrorEventListener
{
public function __construct(
private readonly RollbackService $service,
) {
}
) {}

public function __invoke(ConsoleErrorEvent $event): void
{
Expand Down
14 changes: 12 additions & 2 deletions EventListener/RollbackTransactionOnConsoleSignalEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

declare(strict_types=1);

/**
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* Copyright (c) 2024 Mykhailo Shtanko fractalzombie@gmail.com
*
* For the full copyright and license information, please view the LICENSE.MD
* file that was distributed with this source code.
*/

namespace FRZB\Component\TransactionalMessenger\EventListener;

use FRZB\Component\TransactionalMessenger\Attribute\Transactional;
Expand All @@ -16,8 +27,7 @@ class RollbackTransactionOnConsoleSignalEventListener
{
public function __construct(
private readonly RollbackService $service,
) {
}
) {}

public function __invoke(ConsoleSignalEvent $event): void
{
Expand Down
14 changes: 12 additions & 2 deletions EventListener/RollbackTransactionOnExceptionEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

declare(strict_types=1);

/**
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* Copyright (c) 2024 Mykhailo Shtanko fractalzombie@gmail.com
*
* For the full copyright and license information, please view the LICENSE.MD
* file that was distributed with this source code.
*/

namespace FRZB\Component\TransactionalMessenger\EventListener;

use FRZB\Component\TransactionalMessenger\Attribute\Transactional;
Expand All @@ -15,8 +26,7 @@ class RollbackTransactionOnExceptionEventListener
{
public function __construct(
private readonly RollbackService $service,
) {
}
) {}

public function __invoke(ExceptionEvent $event): void
{
Expand Down
14 changes: 12 additions & 2 deletions EventListener/RollbackTransactionOnMessageFailedEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

declare(strict_types=1);

/**
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* Copyright (c) 2024 Mykhailo Shtanko fractalzombie@gmail.com
*
* For the full copyright and license information, please view the LICENSE.MD
* file that was distributed with this source code.
*/

namespace FRZB\Component\TransactionalMessenger\EventListener;

use FRZB\Component\TransactionalMessenger\Attribute\Transactional;
Expand All @@ -14,8 +25,7 @@ class RollbackTransactionOnMessageFailedEventListener
{
public function __construct(
private readonly RollbackService $service,
) {
}
) {}

public function __invoke(WorkerMessageFailedEvent $event): void
{
Expand Down
11 changes: 11 additions & 0 deletions Exception/DispatchException.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

declare(strict_types=1);

/**
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
* Copyright (c) 2024 Mykhailo Shtanko fractalzombie@gmail.com
*
* For the full copyright and license information, please view the LICENSE.MD
* file that was distributed with this source code.
*/

namespace FRZB\Component\TransactionalMessenger\Exception;

use JetBrains\PhpStorm\Immutable;
Expand Down
Loading

0 comments on commit 39b8f3a

Please sign in to comment.