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

Drop PHP 7.4 and add support for psr/link v2 #59

Draft
wants to merge 2 commits into
base: 3.0.x
Choose a base branch
from

Conversation

internalsystemerror
Copy link
Member

@internalsystemerror internalsystemerror commented Sep 14, 2022

Q A
Documentation no
Bugfix no
BC Break no
New Feature yes
RFC no
QA yes

Description

Best I could do to avoid BC breaks was to:

  • Update minimum supported PHP version to 8.0
  • Widen psr/link to include ^2.0 (closes Update dependency psr/link to v2 #58)
  • Add static return types where a fatal error would take place
  • Add remaining type errors to psalm-baseline.xml

@Ocramius Ocramius added the Enhancement New feature or request label Sep 14, 2022
@Ocramius Ocramius added this to the 2.5.0 milestone Sep 14, 2022
Copy link
Member

@Ocramius Ocramius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch looks good, but needs to target next major.

At that point, we can also use the native type declarations in parameters.

@@ -270,6 +259,7 @@
</TypeDoesNotContainType>
</file>
<file src="src/ResourceGenerator/ExtractCollectionTrait.php">
<MethodSignatureMismatch occurrences="1"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uh-oh...

Comment on lines +345 to +347
<MethodSignatureMismatch occurrences="1">
<code>protected function generateSelfLink(</code>
</MethodSignatureMismatch>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

uh-oh ^2

@@ -53,31 +52,31 @@ public function __construct($relation, string $uri = '', bool $isTemplated = fal
/**
* {@inheritDoc}
*/
public function getHref()
public function getHref(): string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This class is not final: adding return types here will be a major BC break for downstream

@@ -44,7 +44,7 @@ public function getLinksByRel($rel): array
/**
* {@inheritDoc}
*/
public function withLink(LinkInterface $link): self
public function withLink(LinkInterface $link): static
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a BC break for downstream consumers that implement this trait, and aren't final

class Uri
use Stringable;

class Uri implements Stringable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's please use final, and a lot of it @_@

@Ocramius Ocramius modified the milestones: 2.5.0, 3.0.0 Sep 14, 2022
@Ocramius
Copy link
Member

@internalsystemerror cb73daf is extraneous: please rebase instead

@internalsystemerror internalsystemerror marked this pull request as draft September 14, 2022 18:18
@internalsystemerror
Copy link
Member Author

I'm converting this to a draft as it clearly needs more work. If we're targeting a new major, should I update all method signatures to match psr/link v2 and drop support for v1?

@Ocramius
Copy link
Member

and drop support for v1?

Your pick: @weierophinney may have a stronger opinion perhaps?

Supporting both would mean a new BC break release once we drop v1 (due to added signatures)

@weierophinney
Copy link
Contributor

Supporting both would mean a new BC break release once we drop v1 (due to added signatures)

So, the PSR evolution by-law suggests doing a new minor that targets 1.1, and which adds only a return typehint, as that's technically a non-BC break; however, the by-law misses that any class extending the implementation would experience a BC break unless they add the return typehint, as they'd be widening the return type.

And, of course, as soon as you also add support for the new major of a PSR, you MUST jumpt to a new major in your implementation, due to the signature change, even if you support both versions (and we could support both 1.1 and 2.0 at that point).

So, 👍 from me to bump to new major, and I think we can do ^1.1 || ^2.0 when we do (but verify!).

@Ocramius
Copy link
Member

Can't do it in 1.1 due to inherent BC breaks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC Break Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants