Review 12.1 Merged

77112[TASK] Introduce string fragment extraction

Oliver Hader CR +2 V +2 Hard +538 −0 updated 12/13/22, 11:16

Commit message

When working with variable interpolation and similar scenarios, in
most cases variables, constants, expressions, ... are embedded in
a solid string and can only be identified and extracted by the
corresponding "reader" or "parser".

This string fragment splitter aims to introduce a simpler way for
extracting and working with these embedded fragments.

Example:
    $pattern = new StringFragmentPattern(
      StringFragmentSplitter::TYPE_EXPRESSION,
      '%[^%]+%'
    );
    $splitter = new StringFragmentSplitter($pattern);
    $collection = $splitter->split(
      'Hello %variable% World!'
      FLAG_UNMATCHED_AS_NULL
    );

    // results in having
    // + StringFragment(type: 'raw', value: 'Hello ')
    // + StringFragment(type: 'expression', value: '%variable%')
    // + StringFragment(type: 'raw', value: ' World!')

Review

  • Code review CR +2 Done
    • Oliver Hader +2
    • Stefan Bürk +1
    • Benni Mack +1
  • Verified V +2 Done
    • Oliver Hader +2
    • Stefan Bürk +1
    • Benni Mack +1

Issues 1

Files 6

Review log 67

  1. Oliver Hader uploaded patch set 1 12/13/22, 11:07

  2. Benni Mack voted on patch set 1 V +1 CR +1 12/13/22, 11:09

  3. core-ci voted on patch set 1 V -1 12/13/22, 11:09 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/35024

  4. Stefan Bürk commented on patch set 1 V +1 CR +1 12/13/22, 11:13

    Locally unit-, functional (sqlite) tests green (and phpstan)
  5. Oliver Hader wrote 12/13/22, 11:16

    Removed Verified-1 by core-ci
  6. Oliver Hader voted on patch set 1 V +2 CR +2 12/13/22, 11:16

  7. Oliver Hader merged patch set 2 12/13/22, 11:16