public static function isTraitInstanceOf($object, $haystack)
    {
        $traits = static::traitsList($object);

        // if its an object, the all traits for the given object.
        if (is_object($haystack)) {
            $haystack = static::traitsList($haystack);
        }

        foreach ((array) $haystack as $stack) {
            if (in_array($stack, $traits)) {
                return true;
            }
        }

        return false;
    }
public static function isTraitInstanceOf($object, $haystack)
    {
        $traits = static::traitsList($object);

        // if its an object, the all traits for the given object.
        if (is_object($haystack)) {
            $haystack = static::traitsList($haystack);
        }

        foreach ((array) $haystack as $stack) {
            if (in_array($stack, $traits)) {
                return true;
            }
        }

        return false;
    }
public static function isTraitInstanceOf ( $ object , $ haystack ) { $ traits = static :: traitsList ( $ object ) ; // if its an object, the all traits for the given object. if ( is_object ( $ haystack ) ) { $ haystack = static :: traitsList ( $ haystack ) ; } foreach ( ( array ) $ haystack as $ stack ) { if ( in_array ( $ stack , $ traits ) ) { return true ; } } return false ; }
Check whether a given object contains a trait.

```php
trait XYZ {

}

class ABC {
use XYZ;
}

$object = new ABC();

ObjectHelper::isTraitInstanceOf($object, XYZ::class);
```

@param object $object
@param string|array|object $haystack
@return boolean
@since 1.0.17
Check whether a given object contains a trait .