Skip to content

Add return types and update PHPDoc bool types#252

Open
RobinvanderVliet wants to merge 3 commits intocweiske:masterfrom
RobinvanderVliet:patch-1
Open

Add return types and update PHPDoc bool types#252
RobinvanderVliet wants to merge 3 commits intocweiske:masterfrom
RobinvanderVliet:patch-1

Conversation

@RobinvanderVliet
Copy link
Contributor

@RobinvanderVliet RobinvanderVliet commented Feb 24, 2026

  • Add return types to most functions.
  • Change "boolean" to "bool" in PHPDoc for consistency, instead of using both mixed.

@RobinvanderVliet RobinvanderVliet marked this pull request as ready for review February 24, 2026 21:42
@cweiske
Copy link
Owner

cweiske commented Feb 25, 2026

Remove return type from createInstance because of unit test

The unit test could be adjusted.

I'm wary because adding return types to methods will be a breaking change - classes extending JsonMapper will not have those return types in their overridden methods, and PHP will complain about that:

Declaration of MyChild::getString() must be compatible with MyParent::getString(): string

So this would require a new major version (6). In that case the unit test needs to be adjusted, so that we have proper return types for all methods.

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.

2 participants