doctrine / lexer

Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
https://www.doctrine-project.org/projects/lexer.html
MIT License
11.05k stars 60 forks source link

Replace object-like array with class #79

Closed greg0ire closed 1 year ago

greg0ire commented 1 year ago

The new class is templatable, which should enable us to specify that the ORM Lexer is an Lexer<self::T_*>, and in the future, define an enum called TokenType in the ORM, and switch to Lexer<TokenType>.

derrabus commented 1 year ago

We should try to ship this change in 1.x. It would be unfortunate if we needed to ship 2.x with a BC layer.

greg0ire commented 1 year ago

We should try to ship this change in 1.x. It would be unfortunate if we needed to ship 2.x with a BC layer.

I think we are going to need a 3.x very soon, because inheritance is involved: the ORM lexer extends the AbstractLexer, which means that if we add return type hints on 3.x, we will make it impossible for doctrine/orm to be compatible with both v1 and v2 at the same time, just like here: https://github.com/doctrine/collections/pull/331

For that reason, I think it's not that big of a deal to have that BC layer on 2.x, since that series is supposed to be short-lived.

If you can think of a way to ship this change in 1.x, I'm still interested though.

greg0ire commented 1 year ago

I'm working on a solution to ship this in 1.x

greg0ire commented 1 year ago

ping @derrabus are you fine with this?