Skip to content

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

Draft
internalsystemerror wants to merge 2 commits into
mezzio:3.0.xfrom
internalsystemerror:upgrade-dependencies
Draft

Drop PHP 7.4 and add support for psr/link v2#59
internalsystemerror wants to merge 2 commits into
mezzio:3.0.xfrom
internalsystemerror:upgrade-dependencies

Conversation

@internalsystemerror

@internalsystemerror internalsystemerror commented Sep 14, 2022

Copy link
Copy Markdown
Member
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

@Ocramius Ocramius left a comment

Copy link
Copy Markdown
Member

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.

Comment thread psalm-baseline.xml
</TypeDoesNotContainType>
</file>
<file src="src/ResourceGenerator/ExtractCollectionTrait.php">
<MethodSignatureMismatch occurrences="1"/>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

uh-oh...

Comment thread psalm-baseline.xml
Comment on lines +345 to +347
<MethodSignatureMismatch occurrences="1">
<code>protected function generateSelfLink(</code>
</MethodSignatureMismatch>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

uh-oh ^2

Comment thread src/Link.php
* {@inheritDoc}
*/
public function getHref()
public function getHref(): string

Copy link
Copy Markdown
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

Comment thread src/LinkCollection.php
* {@inheritDoc}
*/
public function withLink(LinkInterface $link): self
public function withLink(LinkInterface $link): static

Copy link
Copy Markdown
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

Comment thread test/TestAsset/Uri.php
class Uri
use Stringable;

class Uri implements Stringable

Copy link
Copy Markdown
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
Copy Markdown
Member

@internalsystemerror cb73daf is extraneous: please rebase instead

@internalsystemerror
internalsystemerror marked this pull request as draft September 14, 2022 18:18
@internalsystemerror

Copy link
Copy Markdown
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?

@internalsystemerror
internalsystemerror changed the base branch from 2.5.x to 3.0.x September 14, 2022 18:21
@Ocramius

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

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

Gary Lockett added 2 commits October 25, 2022 19:11
Signed-off-by: Gary Lockett <gary@creativecow.uk>
Signed-off-by: Gary Lockett <gary@creativecow.uk>
@alexmerlin

Copy link
Copy Markdown
Member

@internalsystemerror Do you plan to continue working on this?

@internalsystemerror

Copy link
Copy Markdown
Member Author

@alexmerlin Feel free to take control of this, it's most likely stale now. The issue I had was deciding how to proceed with adding support for psr/link v2 whilst not being a BC break for this component.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants