Skip to content

Conversation

@ADmad
Copy link
Contributor

@ADmad ADmad commented Nov 11, 2024

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

Description

Some properties and methods were missing type declarations.

Copy link
Member

@gsteel gsteel left a comment

Choose a reason for hiding this comment

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

Thanks for the patch @ADmad but there are a few BC breaks that need reverting

@ADmad
Copy link
Contributor Author

ADmad commented Nov 12, 2024

All these are private properties, shouldn't it be safe to change them?

[BC] CHANGED: Type of property Laminas\Diactoros\RequestTrait#$protocol changed from having no type to string
[BC] CHANGED: Type of property Laminas\Diactoros\RequestTrait#$stream changed from having no type to Psr\Http\Message\StreamInterface
[BC] CHANGED: Type of property Laminas\Diactoros\RequestTrait#$method changed from having no type to string
[BC] CHANGED: Type of property Laminas\Diactoros\RequestTrait#$requestTarget changed from having no type to string|null
[BC] CHANGED: Type of property Laminas\Diactoros\RequestTrait#$uri changed from having no type to Psr\Http\Message\UriInterface
[BC] CHANGED: Type of property Laminas\Diactoros\MessageTrait#$protocol changed from having no type to string
[BC] CHANGED: Type of property Laminas\Diactoros\MessageTrait#$stream changed from having no type to Psr\Http\Message\StreamInterface

Constructors can be changed with impunity, changing the type shouldn't cause any error even if the constructor was overridden in a child class.

[BC] CHANGED: The parameter $data of Laminas\Diactoros\Response\JsonResponse#__construct() changed from no type to mixed

@gsteel
Copy link
Member

gsteel commented Nov 12, 2024

The change in JsonResponse constructor is fine IMO, but it is a technical BC break, just because PHP lets us change the signature of __construct, it's still part of the public API.

The private property changes to the traits are indeed a BC break if users have re-implemented a property without a type hint: https://3v4l.org/aaQTo - if they were class properties, it'd be fine, so very little of this can go into a 3.x release

@ADmad
Copy link
Contributor Author

ADmad commented Nov 12, 2024

Thank you for the trait example, I'll revert the related changes.

I am still not convinced the constructor change is a BC break :)
The arguments aren't being changed, just the untyped argument is explicitly typed as mixed. I can't think of any practical use case which would generate an error with this change.

@ADmad ADmad force-pushed the property-types branch 3 times, most recently from 5244e00 to 88ac87d Compare November 16, 2024 18:16
@ADmad
Copy link
Contributor Author

ADmad commented Nov 18, 2024

I don't think the test failures are related to the changes in this PR.

@gsteel
Copy link
Member

gsteel commented Nov 18, 2024

No, but whatever they are, they'll need to be addressed separately 🤔

@gsteel
Copy link
Member

gsteel commented Nov 18, 2024

See #205

@ADmad
Copy link
Contributor Author

ADmad commented Nov 18, 2024

That's not a "me" problem, so I'll let you guys tackle that :)

@ADmad
Copy link
Contributor Author

ADmad commented Dec 31, 2024

Ping

@froschdesign
Copy link
Member

@ADmad

Ping

Please could you explain what you expect?

@ADmad
Copy link
Contributor Author

ADmad commented Jan 3, 2025

@froschdesign I expect the PR to be merged :) I believe I have made the changes as per the feedback. The test failures are unrelated to my changes.

@froschdesign
Copy link
Member

@ADmad

The test failures are unrelated to my changes.

Thanks for you response but a fix for the problem is needed before something can merge here. And if another pull request is required beforehand, this one remains open.
Merging this pull request means ready for release, but it is not, because there are still open problems.
Thanks for your understanding!

@ADmad
Copy link
Contributor Author

ADmad commented Jan 3, 2025

Okay, thank you for the explanation.

@Xerkus Xerkus changed the base branch from 3.6.x to 3.9.x October 12, 2025 15:45
@ADmad
Copy link
Contributor Author

ADmad commented Oct 12, 2025

With the base branch for the merge being updated CI is green now.

@Xerkus
Copy link
Member

Xerkus commented Oct 12, 2025

Please do a rebase instead of merge to update

@Xerkus Xerkus added this to the 3.9.0 milestone Oct 12, 2025
Signed-off-by: ADmad <[email protected]>
@ADmad
Copy link
Contributor Author

ADmad commented Oct 12, 2025

Please do a rebase instead of merge to update

Done

@Xerkus Xerkus changed the title Add missing types QA: Add type declarations and refine psalm types Oct 12, 2025
@Xerkus Xerkus merged commit 0ddf3f9 into laminas:3.9.x Oct 12, 2025
14 checks passed
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