It seems like $this->value->build() can also be of type boolean and double and integer and string; however, parameter $candidate of Dallgoot\Yaml\Compact::__construct() does only seem to accept array|object, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the ignore-type annotation
36
return new Compact(/** @scrutinizer ignore-type */ $this->value->build());