Detector: DuplicateFunctionDetector
Report (why the flagged code is CORRECT and the detector is wrong):
BlueprintCanvas::picking and ConsolePlane::stepped are fluent setters on two different compositions, each writing the same two fields of its own State class (BlueprintCanvasState and ConsolePlaneState). A composition's setter writes through to its own state by project rule, so two components that accept the same inputs have two setters of the same shape; BlueprintCanvas then hands both values on to the ConsolePlane it composes. There is no shared behaviour to extract.
Cleanest design the reporter can conceive:
Each composition declares its own fluent setter writing its own State, and the outer one passes the values to the inner one in compose, which is the flagged code.
⚖️ Maintainer litmus: a valid detector-report needs the flagged code to ALREADY BE the
cleanest design. If the design above differs from the flagged code at all, THAT design is
the owed fix — close this report; the fix is still owed.
Where: src/View/Scenes/Run/Components/Blueprint/BlueprintCanvas.php:67-76
Code (src/View/Scenes/Run/Components/Blueprint/BlueprintCanvas.php:67-76):
64 return $this;
65 }
66
→ 67 /**
→ 68 * @param Closure(string): mixed $picking
→ 69 */
→ 70 public function picking(StateRef $step, Closure $picking): static
→ 71 {
→ 72 $this->state->step = $step;
→ 73 $this->state->picking = $picking;
→ 74
→ 75 return $this;
→ 76 }
77
78 # ----------[ Factories ]----------
79
Where: src/View/Scenes/Run/Components/Console/ConsolePlane.php:42-51
Code (src/View/Scenes/Run/Components/Console/ConsolePlane.php:42-51):
39 return $plane;
40 }
41
→ 42 /**
→ 43 * @param Closure(string): mixed $picking
→ 44 */
→ 45 public function stepped(StateRef $step, Closure $picking): static
→ 46 {
→ 47 $this->state->step = $step;
→ 48 $this->state->picking = $picking;
→ 49
→ 50 return $this;
→ 51 }
52
53 /**
54 * @param array<string, Blueprint> $blueprints
Filed via commandments report from a consumer project.
Detector:
DuplicateFunctionDetectorReport (why the flagged code is CORRECT and the detector is wrong):
BlueprintCanvas::picking and ConsolePlane::stepped are fluent setters on two different compositions, each writing the same two fields of its own State class (BlueprintCanvasState and ConsolePlaneState). A composition's setter writes through to its own state by project rule, so two components that accept the same inputs have two setters of the same shape; BlueprintCanvas then hands both values on to the ConsolePlane it composes. There is no shared behaviour to extract.
Cleanest design the reporter can conceive:
Each composition declares its own fluent setter writing its own State, and the outer one passes the values to the inner one in compose, which is the flagged code.
Where:
src/View/Scenes/Run/Components/Blueprint/BlueprintCanvas.php:67-76Code (
src/View/Scenes/Run/Components/Blueprint/BlueprintCanvas.php:67-76):Where:
src/View/Scenes/Run/Components/Console/ConsolePlane.php:42-51Code (
src/View/Scenes/Run/Components/Console/ConsolePlane.php:42-51):Filed via
commandments reportfrom a consumer project.