rize / UriTemplate

PHP URI Template (RFC 6570) supports both URI expansion & extraction
MIT License
403 stars 15 forks source link

Syntax error/Parse error UriTemplate.php on line 20 #31

Open HeenaBansal20 opened 2 months ago

HeenaBansal20 commented 2 months ago

Version : 0.3.7 0.3.7 release requires php: >=5.3.0 , however the current commit in master broke compilation in PHP 7.

Regression: The change in this commit broke PHP 7.0 .

Error: Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in vendor/rize/uri-template/src/Rize/UriTemplate.php on line 20

Suggestion: If this version is not compatible with <=7.0 , I would suggest to update the requires php details for this version , so that composer can handle installing the versions properly based on PHP version.

HeenaBansal20 commented 2 months ago

@shyim If this version is not compatible with <=7.0 , I would suggest to update the requires php details for this version , so that composer can handle installing the versions properly based on PHP version.

ltrk2 commented 2 months ago

Like @HeenaBansal20 is suggesting, the syntax in that commit indeed seems to be using a feature introduced in PHP 7.1: https://www.php.net/manual/en/migration71.new-features.php.

shyim commented 2 months ago

whoopsie, i made a PR to revert https://github.com/rize/UriTemplate/pull/32

rezigned commented 2 months ago

I've published 0.3.8 that reverted this changes (Thanks @shyim). I think maybe we should bump version from 0.3.x to 0.4.0 for this new syntax? (although this doesn't match with semantic version)

Ideally, it should be a major version bump when there's breaking change but I'm not sure if we need 1.0.0 for this.

ltrk2 commented 2 months ago

Thanks @rezigned and @shyim for dealing with this so quickly!

Regarding versioning, I can offer my two cents: since this project has been around for a long time, I presume it wouldn't be premature to declare 1.0.0. However, semantic versioning explicitly deals with this scenario as follows (reference: https://semver.org/#spec-item-4):

Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.

Because of this, you could basically go with whatever version as long as you reflect the change in minimum required version of the PHP runtime in the project's composer.json.