New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP Fatal error: Duplicate type null is redundant #1116
Comments
I was experiencing the same error for a custom class I am working on. It seems that my issue was related to how I had set up the following constructor that was attempting to be mocked: public function __construct(AlpacaTrading $tradingApi, Order|array $order = null)
{
parent::__construct($tradingApi);
return $order ? $this->from($order) : $this;
} It didn't like having to mock the type-hinted nullable param $order. Changing the constructor to the following alleviated the issue for me. public function __construct(AlpacaTrading $tradingApi, array $order = null)
{
parent::__construct($tradingApi);
return $order ? $this->from($order) : $this;
} |
Reckon I'm hitting this one too, with PHP8.0 and Mockery 1.4.2 Trying to mock a class with this method cause the "Duplicate type" error: public function add(ActionableInterface $component, array|string|null $definition, ?string $type = null): void
{
//...
} Changing the type hint for |
On investigation, this was fixed in #1106 Looks like it's just waiting for a new release @davedevelopment any chance this could be released soon please? |
Sorry for the delay, will see if I can schedule some time this week to merge the branches and release. |
Thanks for the release @davedevelopment |
PHP 8.0
Mockery v1.4.2
I want to mock php built-in class
ZipArchive
:But i get this error:
The text was updated successfully, but these errors were encountered: