Skip to content

Commit 45a2311

Browse files
ismail1432teohhanhui
authored andcommitted
Improve error message when filter class is not imported
1 parent d598df3 commit 45a2311

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Annotation/ApiFilter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct($options = [])
5858
}
5959

6060
if (!is_a($options['value'], FilterInterface::class, true)) {
61-
throw new InvalidArgumentException(sprintf('The filter class "%s" does not implement "%s".', $options['value'], FilterInterface::class));
61+
throw new InvalidArgumentException(sprintf('The filter class "%s" does not implement "%s". Did you forget a use statement?', $options['value'], FilterInterface::class));
6262
}
6363

6464
$this->filterClass = $options['value'];

tests/Annotation/ApiFilterTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function testInvalidConstructor()
3434
public function testInvalidFilter()
3535
{
3636
$this->expectException(\InvalidArgumentException::class);
37-
$this->expectExceptionMessage('The filter class "ApiPlatform\\Core\\Tests\\Fixtures\\TestBundle\\Entity\\Dummy" does not implement "ApiPlatform\\Core\\Api\\FilterInterface".');
37+
$this->expectExceptionMessage('The filter class "ApiPlatform\\Core\\Tests\\Fixtures\\TestBundle\\Entity\\Dummy" does not implement "ApiPlatform\\Core\\Api\\FilterInterface". Did you forget a use statement?');
3838

3939
new ApiFilter(['value' => Dummy::class]);
4040
}

0 commit comments

Comments
 (0)