I use PHPUnit 9.0., Laravel framework 8.* and PHP 7.4.
I run into an PHP Fatal error by using a Trait that has a same method name like a class at the PhpUnit Framework.
The Error is:
PHP Fatal error:  Declaration of App\Traits\ExampleTrait::getStatus(App\Example\ExampleConnectionInterface $example_connection, $unique_id) 
must be compatible with PHPUnit\Framework\TestCase::getStatus(): int in /home/vagrant/code/tests/Integration/JobTests/ExampleJobTest.php 
on line 204
The ExampleJobTest.php looks like this:
<?php
namespace Tests\Integration\JobTests\Examples;
use App\Traits\ExampleTrait;
use Illuminate\Foundation\Testing\DatabaseTransactions;
use Illuminate\Foundation\Testing\WithoutMiddleware;
use Tests\TestCase;
class ExampleTest extends TestCase
{
    use WithoutMiddleware;
    use DatabaseTransactions;
    use ExampleTrait;
    protected function setUp(): void
    {
        parent::setUp();
        $this->example_connection = new ExampleConnection();
    }
}
I have to use the App\Traits\ExampleTrait many times for different Tests and everytime I run in this error. When I rename the function App\Traits\ExampleTrait::getStatus(...) into another name the error doesn't occur.
Of Course, the easiest and fastest way would be to rename the function in App\Traits\ExampleTrait, but my team asked me to find another solution.
So, is there way to fix this error without renaming the function name in App\Traits\ExampleTrait?
 
     
     
    