Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix soft BC break with Uuid::fromString() signature #383

Merged
merged 2 commits into from
Aug 11, 2021
Merged

Fix soft BC break with Uuid::fromString() signature #383

merged 2 commits into from
Aug 11, 2021

Conversation

cs278
Copy link
Contributor

@cs278 cs278 commented Aug 9, 2021

The $uuid parameter on Uuid::fromString() was changed from string to non-empty-string this breaks BC for people using static analysis in their downstream projects.

Description

I've reverted the change to the docblock and used an assertion to teach static analysis tools when the $uuid variable is a non empty string instead.

Motivation and context

Whilst this isn't a language level backwards compatibility break, it does break when consumers are using static analysis tools on their own code base because they'd need to add checks to test if the input is non empty before calling Uuid::fromString().

How has this been tested?

I've added a unit test covering the call to Uuid::fromString('').

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

PR checklist

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING.md document.
  • I have added tests to cover my changes.

Uses an assertion to indicate the `$uuid` variable cannot be an empty
string, satisfying docblock on `LazyUuidFromString`.
@cs278 cs278 requested a review from ramsey as a code owner August 9, 2021 12:21
@codecov
Copy link

codecov bot commented Aug 11, 2021

Codecov Report

Merging #383 (ef1eb74) into main (7231612) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##               main     #383   +/-   ##
=========================================
  Coverage     96.91%   96.91%           
  Complexity      533      533           
=========================================
  Files            64       64           
  Lines          1522     1522           
=========================================
  Hits           1475     1475           
  Misses           47       47           
Impacted Files Coverage Δ
src/Uuid.php 96.38% <ø> (ø)

@ramsey
Copy link
Owner

ramsey commented Aug 11, 2021

Thanks for catching this, and thank you for contributing! 🎉

@ramsey ramsey merged commit 55256bc into ramsey:main Aug 11, 2021
@cs278 cs278 deleted the empty-string branch August 11, 2021 10:35
aurelien-reeves added a commit to cucumber/common that referenced this pull request Jul 4, 2022
ciaranmcnulty pushed a commit to cucumber/common that referenced this pull request Jul 4, 2022
aurelien-reeves added a commit to cucumber/common that referenced this pull request Jul 4, 2022
* Check lowest versions of dependencies

This is mostly because of #2034 - we need to check that
everything still works with the 'lowest' versions of the dependencies

There aren't any external dependencies yet so currently this will only detect when Gherkin doesn't work with Messages any more, or when we've written tests that don't work with older versions of the test tools

* Fix COMPOSER_FLAGS var in Makefile

* Switch install to update as we gitignore composer.lock

* Attempt to fix php 'bc' builds

* Update ramsey/uuid to minimum 4.2.1

The following fix is needed: ramsey/uuid#383

* Explicitly depend on high version of nikic/php-parser

This is used in static analysis and older versions can't deal with enums directly

Becuase we don't depend on it directly Psalm was allowing an older version to install

* Silence a static analysis error in tests

This is something we still want to check for even if the types say it's redundant - JSON decoding could be
throwing an error here

* Remove path repository for low-dependency build

Co-authored-by: aurelien-reeves <aurelien.reeves@smartbear.com>
cukebot pushed a commit to cucumber/gherkin-php that referenced this pull request Jul 4, 2022
* Check lowest versions of dependencies

This is mostly because of cucumber/common#2034 - we need to check that
everything still works with the 'lowest' versions of the dependencies

There aren't any external dependencies yet so currently this will only detect when Gherkin doesn't work with Messages any more, or when we've written tests that don't work with older versions of the test tools

* Fix COMPOSER_FLAGS var in Makefile

* Switch install to update as we gitignore composer.lock

* Attempt to fix php 'bc' builds

* Update ramsey/uuid to minimum 4.2.1

The following fix is needed: ramsey/uuid#383

* Explicitly depend on high version of nikic/php-parser

This is used in static analysis and older versions can't deal with enums directly

Becuase we don't depend on it directly Psalm was allowing an older version to install

* Silence a static analysis error in tests

This is something we still want to check for even if the types say it's redundant - JSON decoding could be
throwing an error here

* Remove path repository for low-dependency build

Co-authored-by: aurelien-reeves <aurelien.reeves@smartbear.com>
cukebot pushed a commit to cucumber/messages-php that referenced this pull request Jul 4, 2022
* Check lowest versions of dependencies

This is mostly because of cucumber/common#2034 - we need to check that
everything still works with the 'lowest' versions of the dependencies

There aren't any external dependencies yet so currently this will only detect when Gherkin doesn't work with Messages any more, or when we've written tests that don't work with older versions of the test tools

* Fix COMPOSER_FLAGS var in Makefile

* Switch install to update as we gitignore composer.lock

* Attempt to fix php 'bc' builds

* Update ramsey/uuid to minimum 4.2.1

The following fix is needed: ramsey/uuid#383

* Explicitly depend on high version of nikic/php-parser

This is used in static analysis and older versions can't deal with enums directly

Becuase we don't depend on it directly Psalm was allowing an older version to install

* Silence a static analysis error in tests

This is something we still want to check for even if the types say it's redundant - JSON decoding could be
throwing an error here

* Remove path repository for low-dependency build

Co-authored-by: aurelien-reeves <aurelien.reeves@smartbear.com>
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.

3 participants