Skip to content

Commit

Permalink
Merge pull request #7 from petrknap/molireali
Browse files Browse the repository at this point in the history
Code style chores
  • Loading branch information
petrknap authored Apr 23, 2024
2 parents e0ecbd2 + cb172e2 commit babd6fc
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"WARNING": "This file is updated automatically. All keys will be overwritten, except of 'conflict', 'keywords', 'require', 'require-dev' and 'scripts'.",
"WARNING": "This file is updated automatically. All keys will be overwritten, except of 'conflict', 'keywords', 'require', 'require-dev', 'scripts' and 'suggest'.",
"autoload": {
"psr-4": {
"PetrKnap\\CriticalSection\\": "src"
Expand Down Expand Up @@ -34,19 +34,20 @@
"symfony/lock": "^6.0"
},
"require-dev": {
"nunomaduro/phpinsights": "^2.9",
"petrknap/shorts": "^1.3",
"nunomaduro/phpinsights": "^2.11",
"petrknap/shorts": "^2.1",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.6",
"squizlabs/php_codesniffer": "^3.7"
},
"scripts": {
"test": "phpunit --colors=always --testdox tests",
"validate": [
"phpcs --colors --standard=PSR12 --exclude=PSR12.Files.OpenTag,PSR12.Files.FileHeader,Generic.Files.LineLength src tests",
"composer outdated \"petrknap/*\" --major-only --strict --ansi --no-interaction",
"phpcs --colors --standard=PSR12 --exclude=Generic.Files.LineLength src tests",
"phpstan analyse --level max src",
"phpstan analyse --level 5 tests",
"phpinsights analyse src"
"phpinsights analyse src --ansi --no-interaction"
],
"ci-script": [
"@validate",
Expand Down
2 changes: 1 addition & 1 deletion tests/CriticalSectionTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @noinspection PhpUnhandledExceptionInspection */
<?php

declare(strict_types=1);

Expand Down
2 changes: 1 addition & 1 deletion tests/NonCriticalSectionTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @noinspection PhpUnhandledExceptionInspection */
<?php

declare(strict_types=1);

Expand Down
4 changes: 3 additions & 1 deletion tests/ReadmeTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<?php declare(strict_types=1);
<?php

declare(strict_types=1);

namespace PetrKnap\CriticalSection;

Expand Down
9 changes: 5 additions & 4 deletions tests/SymfonyLockCriticalSectionTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @noinspection PhpUnhandledExceptionInspection */
<?php

declare(strict_types=1);

Expand All @@ -8,6 +8,7 @@
use PetrKnap\CriticalSection\Exception\CouldNotEnterCriticalSection;
use PetrKnap\CriticalSection\Exception\CouldNotLeaveCriticalSection;
use PHPUnit\Framework\TestCase;
use stdClass;
use Symfony\Component\Lock\Exception\LockAcquiringException;
use Symfony\Component\Lock\Exception\LockConflictedException;
use Symfony\Component\Lock\Exception\LockReleasingException;
Expand All @@ -17,7 +18,7 @@ final class SymfonyLockCriticalSectionTest extends TestCase
{
public function testAcquiresLockBeforeCriticalSectionIsExecuted(): void
{
$shared = new \stdClass();
$shared = new stdClass();
$shared->isLocked = false;
$lock = self::createMock(LockInterface::class);
$lock->expects(self::once())
Expand All @@ -34,7 +35,7 @@ public function testAcquiresLockBeforeCriticalSectionIsExecuted(): void

public function testReleasesLockAfterCriticalSectionWasExecuted(): void
{
$shared = new \stdClass();
$shared = new stdClass();
$shared->isLocked = true;
$lock = self::createMock(LockInterface::class);
$lock->method('acquire')->willReturn(true);
Expand All @@ -53,7 +54,7 @@ public function testReleasesLockAfterCriticalSectionWasExecuted(): void

public function testReleasesLockAndThrowsWhenCriticalSectionThrows(): void
{
$shared = new \stdClass();
$shared = new stdClass();
$shared->isLocked = true;
$lock = self::createMock(LockInterface::class);
$lock->method('acquire')->willReturn(true);
Expand Down
3 changes: 2 additions & 1 deletion tests/WrappingCriticalSectionTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @noinspection PhpUnhandledExceptionInspection */
<?php

declare(strict_types=1);

Expand All @@ -10,6 +10,7 @@
final class WrappingCriticalSectionTest extends TestCase
{
private const FOO = 'bar';

public function testReturnsValueReturnedByExecutedCriticalSection(): void
{
self::assertSame(
Expand Down

0 comments on commit babd6fc

Please sign in to comment.