Skip to content

Commit

Permalink
DispatcherService fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rez1dent3 committed Aug 8, 2022
1 parent 094ef25 commit 3bb95fd
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@
},
"config": {
"process-timeout":0,
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"infection/extension-installer": true
}
}
}
4 changes: 2 additions & 2 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
use PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer;
use PhpCsFixer\Fixer\PhpUnit\PhpUnitTestClassRequiresCoversFixer;
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\Config\ECSConfig;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

return static function (ContainerConfigurator $containerConfigurator): void {
return static function (ECSConfig $containerConfigurator): void {
$services = $containerConfigurator->services();
$services->set(ArraySyntaxFixer::class)
->call('configure', [[
Expand Down
4 changes: 2 additions & 2 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

declare(strict_types=1);

use Rector\Config\RectorConfig;
use Rector\Core\Configuration\Option;
use Rector\Laravel\Set\LaravelSetList;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\PHPUnit\Set\PHPUnitSetList;
use Rector\Set\ValueObject\SetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
return static function (RectorConfig $containerConfigurator): void {
// get parameters
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
Expand Down
5 changes: 5 additions & 0 deletions src/Internal/Service/DispatcherService.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,18 @@ public function flush(): void
foreach ($this->events as $event) {
$this->dispatcher->flush($event);
}

$this->dispatcher->forgetPushed();
$this->events = [];
}

public function forgot(): void
{
foreach ($this->events as $event) {
$this->dispatcher->forget($event);
}

$this->events = [];
}

/** @throws UnknownEventException */
Expand Down
2 changes: 1 addition & 1 deletion tests/Units/Domain/WalletFloatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public function testMantissa(): void
self::assertSame($transaction->type, Transaction::TYPE_WITHDRAW);

self::assertSame($user->balanceInt, 1_000_000 - 255672);
self::assertSame((float) $user->balanceFloat, 10000.00 - 2556.72);
self::assertSame((float) $user->balanceFloat, 7443.28);

$transaction = $user->depositFloat(2556.72 * 2);
self::assertSame($transaction->amountInt, 255672 * 2);
Expand Down
4 changes: 2 additions & 2 deletions tests/Units/Service/MathTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,8 @@ public function testDiv(): void
self::assertSame(-0.2, (float) $provider->div(-1, 5));

// float
self::assertSame(0.24223602484472, (float) $provider->div(1.17, 4.83));
self::assertSame(-0.26519337016574, (float) $provider->div(-1.44, 5.43));
self::assertSame(0.24223602484472, (float) $provider->div(1.17, 4.83, 14));
self::assertSame(-0.26519337016574, (float) $provider->div(-1.44, 5.43, 14));

self::assertSame(
0,
Expand Down

0 comments on commit 3bb95fd

Please sign in to comment.