Unexpected errors with `willReturn` called on `with`
还没有人认领这个 Issue。
评估
调研方向
Reproduce the reported diagnostic using the shown PHPUnit mock chain and the listed PHPStan and PHPUnit versions. Inspect the PHPStan PHPUnit extension's handling of with() and willReturn(); done means the chain no longer reports InvocationStubber::with() as undefined while unrelated invalid calls remain detectable.
由索引模型根据 Issue 内容生成。
描述
After upgrading to PHPStan 2.2.0 the willReturn on the with seems not longer be detected correctly:
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
use Symfony\Component\DependencyInjection\ContainerBuilder;
class RegisterPreviewWebspaceClassPassTest extends TestCase
{
/** @var ContainerBuilder&MockObject */
private $containerBuilderMock;
public function testShouldNotOverrideWebspaceCacheClass(): void
{
$this->containerBuilderMock
->method('hasExtension')
->with('sulu_core')
->willReturn(false);
}
28 Call to an undefined method PHPUnit\Framework\MockObject\InvocationStubber::with().
🪪 method.notFound
Packages which are installed related to PHPUnit:
phpspec/prophecy-phpunit 2.5.0 Integrating the Prophecy mocking library in PHPUnit test cases
phpstan/phpstan-phpunit 2.0.16 PHPUnit extensions and rules for PHPStan
phpunit/php-code-coverage 14.1.9 Library that provides collection, processing, and rendering functionality for PHP code covera...
phpunit/php-file-iterator 7.0.0 FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker 7.0.0 Invoke callables with a timeout
phpunit/php-text-template 6.0.0 Simple template engine.
phpunit/php-timer 9.0.0 Utility class for timing
phpunit/phpunit 13.1.13 The PHP Unit Testing framework.
symfony/phpunit-bridge 7.4.8 Provides utilities for PHPUnit, especially user deprecation notices management
- 主要语言
- PHP
- 星标
- 544
- 派生
- 58
- 平均合并
- 2 天 1 小时
- 30 天内合并 PR
- 5
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
phpstan/phpstan-phpunit 的其他 Issue
-
bug
难度 3/5 1-2 天 新手友好度 68/100
phpstan/phpstan-phpunit#332 · 2 条评论 ·
-
难度 4/5 3-5 天 新手友好度 48/100
phpstan/phpstan-phpunit#321 ·
-
难度 4/5 3-5 天 新手友好度 48/100
phpstan/phpstan-phpunit#309 ·
-
难度 3/5 1-2 天 新手友好度 52/100
phpstan/phpstan-phpunit#292 · 3 条评论 ·
-
难度 4/5 3-5 天 新手友好度 20/100
phpstan/phpstan-phpunit#291 ·
查看 phpstan/phpstan-phpunit 的全部 Issue
相似的 Issue
-
Solved site promotion gate fails on runner PHP patch drift (expects 8.2.33, runner installs 8.2.34) 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
Automattic/blocks-engine#2161 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
Automattic/static-site-importer#1824 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
0. Needs triage bug
难度 2/5 1-3 小时 新手友好度 75/100
-
0. Needs triage 35-feedback bug
难度 2/5 1-3 小时 新手友好度 75/100