Skip to content

Commit

Permalink
Remove thecodingmachine/safe (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
ben-challis authored Sep 29, 2021
1 parent 475e04f commit 79b616b
Show file tree
Hide file tree
Showing 11 changed files with 13 additions and 211 deletions.
6 changes: 2 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
"require": {
"php": ">=7.4.0",
"beberlei/assert": "^3.3",
"ramsey/uuid": "^4.1",
"thecodingmachine/safe": "^1.0"
"ramsey/uuid": "^4.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
Expand All @@ -42,8 +41,7 @@
"phpstan/phpstan-strict-rules": "^0.12",
"phpunit/phpunit": "^9.5",
"qossmic/deptrac-shim": "^0.14 || ^0.15",
"rector/rector": "^0.11.5",
"thecodingmachine/phpstan-safe-rule": "^1.0"
"rector/rector": "^0.11.5"
},
"scripts": {
"security:check": [
Expand Down
198 changes: 1 addition & 197 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ includes:
- phar://vendor/phpstan/phpstan/phpstan.phar/conf/bleedingEdge.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-strict-rules/rules.neon
- vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon

parameters:
level: max
treatPhpDocTypesAsCertain: false
checkExplicitMixed: true
checkExplicitMixed: true

ignoreErrors:
- '#^Dynamic call to static method PHPUnit\\Framework\\(TestCase|Assert)::[a-zA-Z]+\(\)\.$#'
2 changes: 1 addition & 1 deletion src/CannotExtractAggregateId.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class CannotExtractAggregateId extends \RuntimeException
private function __construct(object $aggregateRoot, string $cause = '', ?\Throwable $previous = null)
{
parent::__construct(
\Safe\sprintf(
\sprintf(
'Cannot extract an aggregate id from aggregate root %s<%s>.',
\get_class($aggregateRoot),
\spl_object_hash($aggregateRoot)
Expand Down
2 changes: 1 addition & 1 deletion src/CannotResolveAggregateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ final class CannotResolveAggregateType extends \RuntimeException
private function __construct(object $aggregateRoot, string $cause = '', ?\Throwable $previous = null)
{
parent::__construct(
\Safe\sprintf(
\sprintf(
'Cannot resolve an aggregate type for aggregate root %s<%s>.',
\get_class($aggregateRoot),
\spl_object_hash($aggregateRoot)
Expand Down
2 changes: 1 addition & 1 deletion tests/fixture/Blog/Domain/UserId.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static function fromUuid4(UuidInterface $uuid): self

if (!$fields instanceof FieldsInterface || $fields->getVersion() !== 4) {
throw new \InvalidArgumentException(
\Safe\sprintf('UUID must be V4, the provided string %s does not conform.', $uuid)
\sprintf('UUID must be V4, the provided string %s does not conform.', $uuid)
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/fixture/Blog/Domain/Version.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class Version
private function __construct(int $value)
{
if ($value < 1) {
throw new \InvalidArgumentException(\Safe\sprintf('Value must be > 0, %d given.', $value));
throw new \InvalidArgumentException(\sprintf('Value must be > 0, %d given.', $value));
}

$this->value = $value;
Expand Down
3 changes: 2 additions & 1 deletion tests/helper/ValueObjectAssertions.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php


declare(strict_types=1);

namespace Tests\Helper\Lendable\Aggregate;
Expand All @@ -14,7 +15,7 @@ protected function makeSimpleAssertion(bool $assertion, string $expected, string
{
$this->assertTrue(
$assertion,
\Safe\sprintf('Expected "%s", got "%s".', $expected, $actual)
\sprintf('Expected "%s", got "%s".', $expected, $actual)
);
}

Expand Down
2 changes: 1 addition & 1 deletion tests/unit/CannotExtractAggregateIdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function it_constructs_as_expected(string $cause, ?\Throwable $previous):

private function createExpectedExceptionMessage(object $aggregateRoot, string $cause): string
{
return \Safe\sprintf(
return \sprintf(
'Cannot extract an aggregate id from aggregate root %s<%s>.',
\get_class($aggregateRoot),
\spl_object_hash($aggregateRoot)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/CannotResolveAggregateTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function it_constructs_as_expected(string $cause, ?\Throwable $previous):

private function createExpectedExceptionMessage(object $aggregateRoot, string $cause): string
{
return \Safe\sprintf(
return \sprintf(
'Cannot resolve an aggregate type for aggregate root %s<%s>.',
\get_class($aggregateRoot),
\spl_object_hash($aggregateRoot)
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/ClosureAggregateTypeResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ protected function createResolver(): AggregateTypeResolver
return new ClosureAggregateTypeResolver(
static function (object $user): AggregateType {
if (!$user instanceof User) {
throw CannotResolveAggregateType::of($user, \Safe\sprintf('Not an instance of %s.', User::class));
throw CannotResolveAggregateType::of($user, \sprintf('Not an instance of %s.', User::class));
}

return AggregateType::fromString('USER');
Expand Down

0 comments on commit 79b616b

Please sign in to comment.