Skip to content

Update dependency phplrt/phplrt to v4.1.3 - #320

Open
renovate[bot] wants to merge 1 commit into
2.3.xfrom
renovate/phplrt-phplrt-4.x
Open

renovate[bot] wants to merge 1 commit into
2.3.xfrom
renovate/phplrt-phplrt-4.x

Conversation

@renovate

@renovate renovate Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
phplrt/phplrt (source) 4.0.0-rc14.1.3 age confidence

Release Notes

phplrt/phplrt (phplrt/phplrt)

v4.1.3

Compare Source

  • Remove readonly modifier for $parser in generated parser

v4.1.2

Compare Source

  • Fix phplrt runtime composer min dependencies

v4.1.1

Compare Source

What's Changed

Full Changelog: phplrt/phplrt@4.1.0...4.1.1

v4.1.0

Compare Source

TL;DR

A new sequence optimization has been added, and the parser now runs ~30% faster!

This could have been a patch release, however, version 4.1 reintroduces a feature from v3.x: the ability to start parsing from any rule you mark with a # symbol.


#ExampleRule : ...
^
here

Added

Full Changelog: phplrt/phplrt@4.0.3...4.1.0

v4.0.3

Compare Source

What's Changed

Full Changelog: phplrt/phplrt@4.0.2...4.0.3

v4.0.2

Compare Source

What's Changed

Full Changelog: phplrt/phplrt@4.0.1...4.0.2

v4.0.1

Compare Source

  • Fixed unnecessary compiler's optimization of a rule with a non-kept token and reducer by @​SerafimArts in #​33
    // Previously, this rule was removed/optimization and was never called
    ExampleRule -> { return 42; }
      : ::T_SKIPPED_TOKEN::
      ;
    

Full Changelog: phplrt/phplrt@4.0.0...4.0.1

v4.0.0

Compare Source

  • Fix tests

v4.0.0-rc3

Compare Source

BC

Support for PHP 8.1 required the removal of readonly classes, so:

  • A parser generated by RC2 has to be generated again

    // a file generated by 4.0-RC2
    readonly class SumParser extends \Phplrt\Parser\Parser { /* ... */ }
    
    // Fatal error: Readonly class SumParser cannot extend non-readonly
    //              class Phplrt\Parser\Parser
  • A generated parser implements ParserInterface rather than extending
    Phplrt\Parser\Parser

    // was
    readonly class SumParser extends \Phplrt\Parser\Parser { /* ... */ }
    
    // now
    readonly class SumParser implements \Phplrt\Contracts\Parser\ParserInterface
    {
        protected readonly \Phplrt\Contracts\Parser\ParserInterface $parser;
    
        protected readonly \Phplrt\Contracts\Lexer\LexerInterface $lexer;
    
        public function parse(\Phplrt\Contracts\Source\ReadableInterface $source): mixed
        {
            return $this->parser->parse($source);
        }
    }
    • A subclass reaches the runtime through $this->parser and $this->lexer
    • @template-extends CompiledParser<TResult> stays as it is, the template
      parameter is still there

Added

  • The PHP version a parser (using withTargetPhpVersion() method) is generated for
    use Phplrt\Compiler\Generator\TargetPhpVersion;
    
    (new Compiler())
        ->load(FileSource::createFromPathname(__DIR__ . '/grammar.pp3'))
        ->generate()
            ->withClassName('Parser')
            ->withTargetPhpVersion(TargetPhpVersion::Php81)
            ->save(__DIR__ . '/Parser.php');
    • Without one, the parser is written for the current PHP version
  • vendor/bin/phplrt compile is told the same version, and the way the parser
    is declared
    vendor/bin/phplrt compile grammar.pp3 src/Parser.php \
        --class Parser --php 8.1 --abstract --no-readonly
    • --php, --readonly/--no-readonly, --abstract and --final
  • The readonly declaration of a generated parser is dropped on request
    (new Compiler())
        ->load(FileSource::createFromPathname(__DIR__ . '/grammar.pp3'))
        ->generate()
            ->withClassName('Parser')
            ->withReadonly(false)
            ->save(__DIR__ . '/Parser.php');
    • A parser is readonly unless it is asked for otherwise
    • It is spelled as a declaration from PHP 8.2 up and as a @readonly
      annotation below it; an anonymous parser is readonly from PHP 8.3 up
  • The way a generated parser is declared
    use Phplrt\Compiler\Generator\ClassModifier;
    
    (new Compiler())
        ->load(FileSource::createFromPathname(__DIR__ . '/grammar.pp3'))
        ->generate()
            ->withClassName('CompiledParser')
            ->withClassModifier(ClassModifier::Abstract)
            ->save(__DIR__ . '/CompiledParser.php');
    • ClassModifier::Default, ClassModifier::Abstract and
      ClassModifier::Final
    • A modifier without a class name is reported as an
      UnsupportedClassModifierException
    • Phplrt\Compiler\Generator\ClassModifier

Changed

  • PHP 8.1 or above is required, where it used to be PHP 8.4
  • A token constant of a generated parser is typed from PHP 8.3 up, and untyped
    below it
  • The laminas/laminas-code dependency is removed - it blocked the
    installation on PHP 8.6 and was redundant
  • symfony/console is accepted from ^6.4 again, next to ^7.0 and ^8.0
  • composer-runtime-api is accepted from ^2.0 (instead of ^2.2)
  • symplify/monorepo-builder is gone from the development dependencies

Full Changelog: phplrt/phplrt@4.0.0-rc2...4.0.0-rc3

v4.0.0-rc2

Compare Source

BC

  • A reducer is written of the place a rule is recognized at rather than of the last token it has read
    // was: the last token of the rule, and the offset it starts at
    Number -> { return new Node($token, $offset); } : <T_NUMBER> ;
    
    // now: the place the rule itself is recognized at
    Number -> { return new Node($begin, $length); } : <T_NUMBER> ;
    
    • $token is gone, $offset is now the offset the rule starts at
    • Context::$token is replaced by Context::$begin and Context::$length

Added

  • @error — the message a rule reports in case it cannot be recognized
    %token T_OPEN   \(
    %token T_CLOSE  \)
    %token T_NAME   [a-z]++
    
    Group 
      : ::T_OPEN::
          <T_NAME>
        ::T_CLOSE:: @error("a closing parenthesis is expected") 
      ;
    
    // "(abc" is now rejected as: a closing parenthesis is expected
    
  • A message is written of what the reading has broken on
    Group : ::T_OPEN:: <T_NAME> ::T_CLOSE:: @error("got {name} at {line}:{column}") ;
    
    // "(abc\n  ," is now rejected as: got T_COMMA at 2:3
    
    • {token}, {name}, {value}, {offset}, {line}, {column}, {expected} and {expected_list}
    • A brace of the message itself is written twice: "write {{name}} to name it"
    • An unrecognized placeholder breaks the compilation
    • Phplrt\Parser\Exception\MessagePlaceholder
  • RuleDefinition::setMessage() and $message
    $builder->addConcatenation([$open, $name, $close], 'Group')
        ->setMessage('a closing parenthesis is expected');
  • Compiler, LexerBuilder and ParserBuilder report to a PSR-3 logger
    $compiler = new Compiler();
    $compiler->setLogger($logger);
    $compiler->load(new \SplFileInfo(__DIR__ . '/grammar.pp3'));
    • Each of them is a Psr\Log\LoggerAwareInterface and carries a $logger
  • vendor/bin/phplrt reports what it does through the verbosity it is given
    vendor/bin/phplrt compile grammar.pp3 -vv
    • Both compile and check
  • $begin, $length and $end are written in a reducer
    Number -> { return \substr($content, $begin, $length); } : <T_NUMBER> ;
    

Changed

  • The size of a token is known the moment it is read, which is up to 10% faster to read
  • UserDefinedChannel is readonly by the annotation rather than by the declaration,
    so a channel of one's own is free to be written otherwise
  • phplrt/parser now requires phplrt/position
  • phplrt/compiler, phplrt/lexer-builder and phplrt/parser-builder now requires psr/log
  • The test suite is written for Testo instead of PHPUnit

Full Changelog: phplrt/phplrt@4.0.0-rc1...4.0.0-rc2


Configuration

📅 Schedule: (UTC)

  • Branch creation
    • Between 12:00 AM and 03:59 AM, only on Monday (* 0-3 * * 1)
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate
renovate Bot force-pushed the renovate/phplrt-phplrt-4.x branch from 0a438dc to f0e495f Compare September 14, 2026 13:34
@renovate renovate Bot changed the title Update dependency phplrt/phplrt to v4.1.2 Update dependency phplrt/phplrt to v4.1.3 Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants