diff --git a/phpstan-doctrine-bug.neon b/phpstan-doctrine-bug.neon deleted file mode 100644 index 08417fe..0000000 --- a/phpstan-doctrine-bug.neon +++ /dev/null @@ -1,12 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Method loophp\\\\RepositoryMonadicHelper\\\\Doctrine\\\\MonadicRepository\\:\\:getClassName\\(\\) should return class\\-string\\ but returns string\\.$#" - count: 1 - path: src/Doctrine/MonadicRepository.php - - - - message: "#^Method loophp\\\\RepositoryMonadicHelper\\\\MonadicRepositoryFactory\\:\\:getEntityClass\\(\\) should return class\\-string\\ but returns string\\.$#" - count: 1 - path: src/MonadicRepositoryFactory.php - diff --git a/phpstan.neon.dist b/phpstan.neon.dist deleted file mode 100644 index 67ba6bd..0000000 --- a/phpstan.neon.dist +++ /dev/null @@ -1,2 +0,0 @@ -includes: - - phpstan-doctrine-bug.neon diff --git a/psalm-baseline.xml b/psalm-baseline.xml deleted file mode 100644 index af9ad27..0000000 --- a/psalm-baseline.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - $this->objectRepository->getClassName() - - - string - - - - - $objectRepository->getClassName() - - - class-string<R> - - - diff --git a/psalm.xml b/psalm.xml index e9503f0..2b52de1 100644 --- a/psalm.xml +++ b/psalm.xml @@ -3,7 +3,6 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" - errorBaseline="psalm-baseline.xml" > diff --git a/src/MonadicRepositoryFactory.php b/src/MonadicRepositoryFactory.php index dd7b596..e78cd4c 100644 --- a/src/MonadicRepositoryFactory.php +++ b/src/MonadicRepositoryFactory.php @@ -30,20 +30,6 @@ public function fromEntity(string $entityClass): MonadicRepositoryInterface public function fromRepository(ObjectRepository $objectRepository): MonadicRepositoryInterface { - return $this->fromEntity($this->getEntityClass($objectRepository)); - } - - /** - * @template R - * - * @param ObjectRepository $objectRepository - * - * @return class-string - * - * @see https://github.com/doctrine/persistence/pull/213 - */ - private function getEntityClass(ObjectRepository $objectRepository): string - { - return $objectRepository->getClassName(); + return $this->fromEntity($objectRepository->getClassName()); } } diff --git a/tests/unit/MonadicRepositoryHelperTest.php b/tests/unit/MonadicRepositoryHelperTest.php index a1feb04..1b2a38f 100644 --- a/tests/unit/MonadicRepositoryHelperTest.php +++ b/tests/unit/MonadicRepositoryHelperTest.php @@ -249,15 +249,15 @@ static function (CustomEntity $customEntity): string { ->eitherFind($repository->reveal(), 3) ->bind( static function (CustomEntity $customEntity): Either { - return ('' === $customEntity->getTitle()) + return ('' === $customEntity->getTitle()) ? Either::left(new Exception('Empty title')) : Either::right($customEntity); - } + } ) ->map( static function (CustomEntity $customEntity): string { - return sprintf('%s%s', $customEntity->getTitle(), $customEntity->getTitle()); - } + return sprintf('%s%s', $customEntity->getTitle(), $customEntity->getTitle()); + } ) ->eval( static fn (Throwable $i): string => $i->getMessage(),