Skip to content

Add return types and update PHPDoc bool types#252

Closed
RobinvanderVliet wants to merge 3 commits into
cweiske:masterfrom
RobinvanderVliet:patch-1
Closed

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

Conversation

@RobinvanderVliet
Copy link
Copy Markdown
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
Copy Markdown
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.

@cweiske
Copy link
Copy Markdown
Owner

cweiske commented May 12, 2026

@RobinvanderVliet please rebase against master.
If you don't plan to rebase, close this PR.

cweiske added a commit that referenced this pull request May 20, 2026
BC break if you extend JsonMapper.

Related: #252
cweiske added a commit that referenced this pull request May 20, 2026
I don't want to enforce the logger to be a \Psr\Log\LoggerInterface,
both to keep BC and to allow light-weight software that does not
depend on the PSR interface classes.

BC break if you extend JsonMapper.

Related: #252
@cweiske
Copy link
Copy Markdown
Owner

cweiske commented May 20, 2026

I've implemented the changes myself now.

@cweiske cweiske closed this May 20, 2026
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