Create dependencies between tests in PHPUnit

Code
<?php

use PHPUnit\Framework\TestCase;

class 
DependsTest extends TestCase
{
    public function 
testSetValue() : Foo
    
{
        
$foo = new Foo();
        
        
$this->assertNull($foo->getValue());
        
        
$foo->setValue(4);
        
$this->assertEquals(4$foo->getValue());
        
        
// returned $foo is param of dependent tests 
        
return $foo;
    }
    
    
/**
     * These two tests doesn't really have a dependency
     * but it's only to show how the depends annotation works
     *
     * @depends testSetValue
     */
    
public function testAddIntToValue($foo) : void
    
{
        
$this->assertEquals(5$foo->addIntToValue(1));
    }
}

class 
Foo
{
    private 
$value;
    
    public function 
getValue()
    {
        return 
$this->value;
    }
    
    public function 
setValue($value)
    {
        
$this->value $value;
    }
    
    public function 
addIntToValue($int)
    {
        return 
$this->value $int;
    }
}
Result
Time: 00:00.007, Memory: 18.00 MB

OK (2 tests, 0 assertions)
Used Versions
PHP 8.2, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8