From b019c548bd1651a45616bd3d49d3963ac7d0f569 Mon Sep 17 00:00:00 2001 From: Baptiste Langlade Date: Sat, 7 Feb 2026 11:46:32 +0100 Subject: [PATCH] remove useless Shape named constructors --- CHANGELOG.md | 4 ++ src/Edge/Shape.php | 99 ---------------------------------------- tests/Edge/ShapeTest.php | 4 +- tests/EdgeTest.php | 16 +++---- 4 files changed, 14 insertions(+), 109 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e739d19..7314517 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ - Requires PHP `8.4` - Requires `innmind/filesystem:~9.0` +### Removed + +- `Innmind\Graphviz\Edge\Shape` named constructors, use the cases directly + ## 4.0.0 - 2025-04-18 ### Added diff --git a/src/Edge/Shape.php b/src/Edge/Shape.php index ec194b1..5374c04 100644 --- a/src/Edge/Shape.php +++ b/src/Edge/Shape.php @@ -20,105 +20,6 @@ enum Shape case tee; case vee; - /** - * @psalm-pure - */ - #[\NoDiscard] - public static function box(): self - { - return self::box; - } - - /** - * @psalm-pure - */ - #[\NoDiscard] - public static function crow(): self - { - return self::crow; - } - - /** - * @psalm-pure - */ - #[\NoDiscard] - public static function curve(): self - { - return self::curve; - } - - /** - * @psalm-pure - */ - #[\NoDiscard] - public static function icurve(): self - { - return self::icurve; - } - - /** - * @psalm-pure - */ - #[\NoDiscard] - public static function diamond(): self - { - return self::diamond; - } - - /** - * @psalm-pure - */ - #[\NoDiscard] - public static function dot(): self - { - return self::dot; - } - - /** - * @psalm-pure - */ - #[\NoDiscard] - public static function inv(): self - { - return self::inv; - } - - /** - * @psalm-pure - */ - #[\NoDiscard] - public static function none(): self - { - return self::none; - } - - /** - * @psalm-pure - */ - #[\NoDiscard] - public static function normal(): self - { - return self::normal; - } - - /** - * @psalm-pure - */ - #[\NoDiscard] - public static function tee(): self - { - return self::tee; - } - - /** - * @psalm-pure - */ - #[\NoDiscard] - public static function vee(): self - { - return self::vee; - } - #[\NoDiscard] public function toString(): string { diff --git a/tests/Edge/ShapeTest.php b/tests/Edge/ShapeTest.php index b2c449f..0ac358f 100644 --- a/tests/Edge/ShapeTest.php +++ b/tests/Edge/ShapeTest.php @@ -19,8 +19,8 @@ public function testShape(): BlackBox\Proof return $this ->forAll($this->shapes()) ->prove(function(string $shape): void { - $this->assertInstanceOf(Shape::class, Shape::$shape()); - $this->assertSame($shape, Shape::$shape()->toString()); + $this->assertInstanceOf(Shape::class, Shape::{$shape}); + $this->assertSame($shape, Shape::{$shape}->toString()); }); } diff --git a/tests/EdgeTest.php b/tests/EdgeTest.php index 3d7db14..3ff3c53 100644 --- a/tests/EdgeTest.php +++ b/tests/EdgeTest.php @@ -71,10 +71,10 @@ public function testShaped() Name::of('b'), ) ->shaped( - Shape::box(), - Shape::vee(), - Shape::tee(), - Shape::dot(), + Shape::box, + Shape::vee, + Shape::tee, + Shape::dot, ); $this->assertSame(1, $edge->attributes()->size()); @@ -92,10 +92,10 @@ public function testShapedWhenBidirectional() ) ->asBidirectional() ->shaped( - Shape::box(), - Shape::vee(), - Shape::tee(), - Shape::dot(), + Shape::box, + Shape::vee, + Shape::tee, + Shape::dot, ); $this->assertSame(3, $edge->attributes()->size());