beberlei / assert

Thin assertion library for use in libraries and business-model
Other
2.41k stars 186 forks source link

Assertion::classExists() emits a PHP Warning #322

Open ktomk opened 2 years ago

ktomk commented 2 years ago

asserting an expression with classExists(), and the expression is an array, it shows me the following warning:

PHP Warning: class_exists() expects parameter 1 to be string, array given in beberlei/assert/lib/Assert/Assertion.php on line 1860

on beberlei/assert v3.3.2 with php 7.4

and with php 8.0

PHP Fatal error: Uncaught TypeError: class_exists(): Argument #1 ( $class) must be of type string, array given in [...] Assertion.php:1860

add an is_string check.

ktomk commented 2 years ago

FYI had an issue following assert/CONTRIBUTING.md on master when filing this PR, see https://github.com/beberlei/assert/issues/321