Skip to content

Conversation

derrabus
Copy link
Contributor

@derrabus derrabus commented Sep 2, 2025

This PR modernizes the code examples and the documentation on mock objects.

  • Current PHPUnit releases use the namespaced interface PHPUnit\Framework\MockObject\MockObject for mocks. The non-namespaced PHPUnit_Framework_MockObject_MockObject is legacy and has been removed a long time ago.
  • Current PHPUnit releases require the setUp() method in tests to have a void return type.
  • PHP nowadays supports native intersection types which should be what we recommend to use in the README file. PHPDoc should only be a fallback if the projects needs to support legacy PHP runtimes.

@ondrejmirtes ondrejmirtes merged commit 9ec3fa9 into phpstan:2.0.x Sep 2, 2025
67 checks passed
@ondrejmirtes
Copy link
Member

Awesome, thank you!

@derrabus derrabus deleted the improvement/readme-examples branch September 4, 2025 06:42
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