Skip to content

[bug-report] move.php View\Attributes\State View\Attributes\StateOf re… #583

Description

@jessegall

Report:
move.php View\Attributes\State View\Attributes\StateOf rewrote the bare identifier State inside Component.php, whose namespace holds its own State class (View\Contracts\State) imported by nothing because it is a sibling; the tool resolved the unqualified name to the moved class instead of the same-namespace one

Where: tools/refactoring/move.php:1

Code (tools/refactoring/move.php:1):

1  <?php
   2  
   3  /**
   4   * Move or rename a class, with every reference to it — the import in each consumer, the namespace it
   5   * is declared under, and the import a former neighbour now needs.
   6   *
   7   *   php tools/refactoring/move.php Bone RenderNode
   8   *   php tools/refactoring/move.php Bone Renderer\\Skeleton\\RenderNode
   9   *   php tools/refactoring/move.php --namespace=View\\Enum Renderer\\Enum
  10   *   php tools/refactoring/move.php --list=tools/refactoring/renames.txt
  11   *   php tools/refactoring/move.php --list=… --dry-run
  12   *   php tools/refactoring/move.php --replace Modifiers\\Open Marks\\Open
  13   *
  14   * A line in a list file is `Old New`, or `Old New # why`. Blank lines and lines
  15   * starting with # are ignored.
  16   *
  17   * Give the new name alone to rename in place, or a namespace-qualified name
  18   * (relative to the package root namespace) to move it as well. `--namespace=` moves every class
  19   * declared under one namespace into another, and `--dry-run` reports without writing.
  20   *
  21   * `--replace` is the other operation: the destination ALREADY EXISTS, so nothing is relocated —
  22   * every reference to the source is repointed at the class that stays, and the source file is
  23   * deleted. That is a MERGE, and it is what you want whenever two classes say the same thing in two
  24   * mechanisms and one of them is being retired. Moving the loser somewhere tidier only relocates the
  25   * mechanism; replacing it removes one. It refuses when nothing declares the destination, because a

Where: src/View/Contracts/Component.php:59

Code (src/View/Contracts/Component.php:59):

  56  use JesseGall\Workflows\View\Attributes\Transition;
  57  
  58  /**
→ 59   * @template TState of State
  60   */
  61  abstract class Component implements Placeable, Embeddable, Controlling
  62  {
  63      public const string DEFAULT_SLOT = NodeId::DEFAULT_SLOT;
  64  
  65      /**
  66       * @var array<class-string, array<string, mixed>>
  67       */
  68      private static array $known = [];
  69  
  70      public string | null $alias = null;
  71  
  72      #[Slot]
  73      public array $children = [];
  74  
  75      public array $attributes = [];
  76  
  77      /**
  78       * @var array<string, string|bool|Matches>
  79       */
  80      public array $marks = [];
  81  
  82      /**
  83       * @var Closure(mixed): Component|null

Filed via commandments report from a consumer project.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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