首页 > 解决方案 > Mac OS Mojave phpunit 8.0.1 symfony

问题描述

安装 PHPunit 8.0.1 后出现此错误:

Fatal error: Declaration of Symfony\Bundle\FrameworkBundle\Test\KernelTestCase::tearDown() must be compatible with PHPUnit\Framework\TestCase::tearDown()

我正在使用 PHP 7.2

标签: phpunitphp-7.2

解决方案


您的 tearDown 功能与您扩展的功能不兼容。您必须添加返回类型才能实现相同的声明。

protected function tearDown(): void

另请参阅文档https://phpunit.de/announcements/phpunit-8.html部分“模板方法的返回类型”


推荐阅读