How to use Prophecy as stub in unit tests

Code
<?php

use Prophecy\Prophet;
use Prophecy\Argument\Token\TypeToken;
use Prophecy\Argument\ArgumentsWildcard;

interface Foo
{
    public function bar($value);
}

// Creating a stub for Foo interface
$prophet = new Prophet();
$fooProphecy = $prophet->prophesize('Foo');

// if argument is 5, method bar returns 10
$fooProphecy->bar(5)->willReturn(10);

// if argument is any kind of string, method bar returns 'string'
$argToken = new TypeToken('string');
$fooProphecy->bar($argToken)->willReturn('string');

// now get your Foo instance and use it
$foo = $fooProphecy->reveal();

// different invokations of Foo::bar() method
dump($foo->bar(5));
dump($foo->bar('foobar'));

// Argument 4 was not expected
try {
    $foo->bar(4);
} catch(Exception $e) {
    dump($e->getMessage());
}
Result
^ 10

^ "string"
Used Versions
PHP 8.3, Laminas MVC 3.2, Symfony 5.2, Laravel 8.28, PHPUnit 9.5, Doctrine ORM 2.8