feat: bump supported version range up to 8.2

This commit is contained in:
Laytan Laats 2023-03-25 16:12:19 +01:00
parent 375ccd136d
commit 702cadceab
2 changed files with 4 additions and 8 deletions

View File

@ -18,7 +18,7 @@ var (
php7RangeEnd = &version.Version{Major: 7, Minor: 4}
php8RangeStart = &version.Version{Major: 8}
php8RangeEnd = &version.Version{Major: 8, Minor: 1}
php8RangeEnd = &version.Version{Major: 8, Minor: 2}
)
// Parser interface

View File

@ -17,14 +17,11 @@ var (
// ErrUnsupportedVer is returned if a version out of supported range
ErrUnsupportedVer = errors.New("the version is out of supported range")
php5RangeStart = &Version{Major: 5}
php5RangeEnd = &Version{Major: 5, Minor: 6}
php7RangeStart = &Version{Major: 7}
php7RangeEnd = &Version{Major: 7, Minor: 4}
php8RangeStart = &Version{Major: 8}
php8RangeEnd = &Version{Major: 8, Minor: 1}
php8RangeEnd = &Version{Major: 8, Minor: 2}
)
func New(v string) (*Version, error) {
@ -34,7 +31,7 @@ func New(v string) (*Version, error) {
return nil, ErrInvalidSemVer
}
var ver = new(Version)
ver := new(Version)
var err error
ver.Major, err = strconv.ParseUint(parts[0], 10, 64)
@ -51,8 +48,7 @@ func New(v string) (*Version, error) {
}
func (v *Version) Validate() error {
if !v.InRange(php5RangeStart, php5RangeEnd) &&
!v.InRange(php7RangeStart, php7RangeEnd) &&
if !v.InRange(php7RangeStart, php7RangeEnd) &&
!v.InRange(php8RangeStart, php8RangeEnd) {
return ErrUnsupportedVer
}