Skip to content

Commit

Permalink
Merge pull request #143 from alps-asd/exception-name
Browse files Browse the repository at this point in the history
Change exception name
  • Loading branch information
koriym committed Dec 18, 2021
2 parents 175c97a + d3d589e commit 537afb0
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 66 deletions.
4 changes: 2 additions & 2 deletions src/DrawDiagram.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use JetBrains\PhpStorm\Immutable;
use Koriym\AppStateDiagram\Exception\InvalidHrefException;
use Koriym\AppStateDiagram\Exception\SharpMissingInHrefException;
use Koriym\AppStateDiagram\Exception\MissingHashSignInHrefException;
use stdClass;

use function assert;
Expand Down Expand Up @@ -174,7 +174,7 @@ private function isSemanticHref(stdClass $item, array $descriptors): bool

$pos = strpos($item->href, '#');
if ($pos === false) {
throw new SharpMissingInHrefException($item->href); // @codeCoverageIgnore
throw new MissingHashSignInHrefException($item->href); // @codeCoverageIgnore
}

$id = substr($item->href, $pos + 1);
Expand Down
5 changes: 0 additions & 5 deletions src/Exception/InvalidDirPathException.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

use RuntimeException;

class InvalidJsonException extends RuntimeException
class MissingHashSignInHrefException extends RuntimeException
{
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

use RuntimeException;

class RtMissingException extends RuntimeException
class MissingRtException extends RuntimeException
{
}
11 changes: 0 additions & 11 deletions src/Exception/NonSemanticLinkException.php

This file was deleted.

9 changes: 0 additions & 9 deletions src/Exception/RtDescriptorMissingException.php

This file was deleted.

5 changes: 0 additions & 5 deletions src/Exception/RtNotRefException.php

This file was deleted.

11 changes: 0 additions & 11 deletions src/Exception/SharpMissingInHrefException.php

This file was deleted.

11 changes: 0 additions & 11 deletions src/Exception/TypeSemanticException.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/HyperReference.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace Koriym\AppStateDiagram;

use Generator;
use Koriym\AppStateDiagram\Exception\SharpMissingInHrefException;
use Koriym\AppStateDiagram\Exception\MissingHashSignInHrefException;
use stdClass;

use function array_shift;
Expand Down Expand Up @@ -38,7 +38,7 @@ public function add(string $alpsFile, string $href): void
{
$fullPath = ($this->fullPath)($alpsFile, $href);
if (! is_int(strpos($fullPath, '#'))) {
throw new SharpMissingInHrefException($href);
throw new MissingHashSignInHrefException($href);
}

[, $id] = explode('#', $fullPath);
Expand Down
6 changes: 3 additions & 3 deletions src/TransDescriptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Koriym\AppStateDiagram;

use Koriym\AppStateDiagram\Exception\RtMissingException;
use Koriym\AppStateDiagram\Exception\MissingRtException;
use stdClass;

use function assert;
Expand All @@ -31,14 +31,14 @@ public function __construct(stdClass $descriptor, SemanticDescriptor $parent)
if (! isset($descriptor->rt) || ! is_string($descriptor->rt)) {
assert(is_string($descriptor->id));

throw new RtMissingException($descriptor->id);
throw new MissingRtException($descriptor->id);
}

assert(is_string($descriptor->id));

$pos = strpos($descriptor->rt, '#');
if ($pos === false) {
throw new RtMissingException($descriptor->id);
throw new MissingRtException($descriptor->id);
}

$this->rt = substr($descriptor->rt, $pos + 1);
Expand Down
4 changes: 2 additions & 2 deletions tests/AlpsProfileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Koriym\AppStateDiagram\Exception\AlpsFileNotReadableException;
use Koriym\AppStateDiagram\Exception\DescriptorNotFoundException;
use Koriym\AppStateDiagram\Exception\InvalidLinkRelationException;
use Koriym\AppStateDiagram\Exception\SharpMissingInHrefException;
use Koriym\AppStateDiagram\Exception\MissingHashSignInHrefException;
use PHPUnit\Framework\TestCase;

use function stream_wrapper_register;
Expand Down Expand Up @@ -99,7 +99,7 @@ public function testNoRelLink(): void

public function testNoRtTransDescriptor(): void
{
$this->expectException(SharpMissingInHrefException::class);
$this->expectException(MissingHashSignInHrefException::class);
new Profile(__DIR__ . '/Fake/invalid_rt_descriptor.json', new LabelName());
}
}
6 changes: 3 additions & 3 deletions tests/ErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Koriym\AppStateDiagram\Exception\InvalidDescriptorException;
use Koriym\AppStateDiagram\Exception\InvalidLabelOptionException;
use Koriym\AppStateDiagram\Exception\InvalidSemanticsException;
use Koriym\AppStateDiagram\Exception\RtMissingException;
use Koriym\AppStateDiagram\Exception\MissingRtException;
use PHPUnit\Framework\TestCase;
use Seld\JsonLint\ParsingException;

Expand All @@ -36,7 +36,7 @@ public function testInvalidDescriptorInDescriptor(): void

public function testMissingRt(): void
{
$this->expectException(RtMissingException::class);
$this->expectException(MissingRtException::class);
(new DrawDiagram())(new Profile(__DIR__ . '/Fake/invalid_missing_rt.json', new LabelName()), new LabelName());
}

Expand Down Expand Up @@ -67,7 +67,7 @@ public function testInvalidDescriptor(): void

public function testRtMissing(): void
{
$this->expectException(RtMissingException::class);
$this->expectException(MissingRtException::class);
$invalidTrans = (object) ['id' => 'id', 'type' => 'safe', 'rt' => ''];
$semantic = new SemanticDescriptor(new class {
/** @var string */
Expand Down

0 comments on commit 537afb0

Please sign in to comment.