We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
self
Hi, stumbled into this:
<?php declare(strict_types=1); require_once __DIR__ . '/vendor/autoload.php'; class Test { public function __construct(string|self $value) { // copy-constructor-ish } } $mapper = (new CuyZ\Valinor\MapperBuilder)->mapper(); $test = $mapper->map(Test::class, ['value' => 'foo']); // string -> OK $test = $mapper->map(Test::class, ['value' => $test]); // self -> OK $test = $mapper->map(Test::class, ['value' => null]); // null -> FAIL
$ php test.php PHP Fatal error: Uncaught Error: Xdebug has detected a possible infinite loop, and aborted your script ...
Without Xdebug it just keeps running.
The text was updated successfully, but these errors were encountered:
you'd need string | self | null
string | self | null
Sorry, something went wrong.
Let me clarify:
What is expected to happen?
Because null is not allowed as $value, the mapper is expected to throw MappingError.
null
$value
MappingError
This is what happens if self is removed from allowed types:
Uncaught CuyZ\Valinor\Mapper\TypeTreeMapperError: Could not map type `Test`. An error occurred at path value: Value null is not a valid string.
What actually happens?
The library enters infinite loop/recursion.
Program crashes when either time limit or memory limit is reached.
No branches or pull requests
Hi, stumbled into this:
Without Xdebug it just keeps running.
The text was updated successfully, but these errors were encountered: