respect-validation/tests/integration/rules/instance.phpt
Henrique Moody a974c0c834
Run PHPStan in PHPT files
We were not running PHPStan on those files because of the strict types
declaration. However, I decided it would be better not to have strict
types on those files than not to run PHPStan issues.

Not surprisingly, there were several issues. Some issues were impacting
how user-friendly the library is.
2024-11-29 01:39:41 +01:00

15 lines
659 B
PHP

--FILE--
<?php
require 'vendor/autoload.php';
exceptionMessage(static fn() => v::instance(DateTime::class)->assert(''));
exceptionMessage(static fn() => v::not(v::instance(Traversable::class))->assert(new ArrayObject()));
exceptionFullMessage(static fn() => v::instance(ArrayIterator::class)->assert(new stdClass()));
exceptionFullMessage(static fn() => v::not(v::instance(stdClass::class))->assert(new stdClass()));
?>
--EXPECT--
"" must be an instance of `DateTime`
`ArrayObject { getArrayCopy() => [] }` must not be an instance of `Traversable`
- `stdClass {}` must be an instance of `ArrayIterator`
- `stdClass {}` must not be an instance of `stdClass`