creof / geo-parser

Parser for geography coordinate strings
MIT License
61 stars 16 forks source link

Not compatible with doctrine/lexer v3 #21

Open mortenscheel opened 1 year ago

mortenscheel commented 1 year ago

In v3, doctrine/lexer's Token class, the value has to be either string or int. So it throws a type error when you pass it a float. A workaround is to downgrade doctrine/lexer to 2.1.0

Is this project still maintained?

captain-igloo commented 7 months ago

If you're not aware, @longitude-one has forked creof's wkt-parser and doctrine-spatial.

I have opened a PR to add support for doctrine/lexer 3 to wkt-parser. I would like to see doctrine-spatial updated as well but it depends on creof/geo-parser. Ideally longitude-one would fork creof/geo-parser as well (including your changes). Then wkt-parser, doctrine-spatial and geo-parser would be in one place.

https://github.com/longitude-one/wkt-parser/pull/5

Alexandre-T commented 7 months ago

I just forked the geo-parser. This week, I will attempt to update the code (namespaces, GitHub action, code climate, etc.). Once I've made the changes, could you please push your PR to the new repository's dev branch? I'll take a look at it. Feel free to provide me with some information about the differences between these versions of doctrine/lexer

captain-igloo commented 7 months ago

Thanks Alexandre. The differences between doctrine/lexer 2 and 3:

  1. In doctrine/lexer 2, Token implements ArrayAccess and properties can be accessed like this $token['value']. In version 3 this has been dropped so they must be accessed as properties: $token->value.
  2. Token::$value is now typed as string|int, so float cannot be passed.

https://github.com/doctrine/lexer/blob/3.0.x/UPGRADE.md

Alexandre-T commented 7 months ago

Thank you. I now understand your PR. I will release three versions (v1, v2, v3) of the geo-parser, with each version corresponding to a specific doctrine/lexer version, to prevent any confusion with doctrine-spatial.