-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TASK] Update the development tools #1383
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a couple of questions about createStub
.
config/php-cs-fixer.php
Outdated
// `'methods' => ['createStub' => 'this']` is required as long as we are not on PHPUnit 10.x yet | ||
// (where that method was made static). | ||
'php_unit_test_case_static_method_calls' => ['call_type' => 'self', 'methods' => ['createStub' => 'this']], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm surprised that we need this, given that we do not call createStub
AFAICS, and neither does PHPUnit itself. I'm also mystified as to what change between 3.64 and 3.66 of the Fixer means that we would now need it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some background on this:
PHPUnit provides two kinds of test doubles: Mocks and stubs. They work in similar ways, and using the correct type helps both the reader recognize the purpose of the corresponding test double more easily as well as PHPStan to recognize incorrect usage.
With PHPUnit version 10, the method createStub
was made static
.
PHP-CS-Fixer 3.66.0 introduced the feature of (by default) making calls to createStub
static as well, which breaks tests that are on PHPUnit 9.x. (Up to and including version 3.65.0, PHP-CS-Fixer left calls to createStub
alone AFAIK.)
As we're currently using neither getMock
nor getStub
, I'll remove the corresponding line from the PHP-CS-Fixer configuration to keep things simple.
We're not using `createStub` at this point (and also not `createMock`, so let's keep the PHP-CS-Fixer configuration simple for now.
ac9e389
to
2a4c00f
Compare
No description provided.