Skip to content

[detector-report] ManualHydrationLoopDetector #341

Description

@jessegall

Detector: ManualHydrationLoopDetector

Report:
Legit cross-type transformation SelectOption->InputOption for the input builder's variadic options(); not re-hydration of a cast-owned nested collection.

Where: src/Editor/Ui/Hydration/InspectorHydrator.php:558

Code (src/Editor/Ui/Hydration/InspectorHydrator.php:558):

  555          return null;
  556      }
  557558      private function inputControl(FieldControl $control): InputControl
  559      {
  560          return match ($control)
  561          {
  562              FieldControl::Int, FieldControl::Float => InputControl::Number,
  563              FieldControl::Bool => InputControl::Toggle,
  564              FieldControl::Enum => InputControl::Select,
  565              FieldControl::String => InputControl::Text,
  566          };
  567      }
  568  
  569      /**
  570       * @return list<InputOption>
  571       */
  572      private function inputOptions(InlineFieldEditor $editor): array
  573      {
  574          return array_map(
  575              static fn (SelectOption $option): InputOption => InputOption::from(['value' => (string) $option->value, 'label' => $option->label]),
  576              $editor->options ?? [],
  577          );
  578      }
  579  
  580      /**
  581       * Whether the socket renders as a plain toggle the Flags card can absorb — an inline bool
  582       * that is neither wired nor bound to a variable.

Filed via commandments report from a consumer project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions