{"record":{"id":"7d8a7b6e52e03b7c","repo":"yiisoft/yii2","slug":"argument-needles-must-be-an-array-or-implement-tr","errorCode":null,"errorMessage":"Argument $needles must be an array or implement Traversable","messagePattern":"Argument \\$needles must be an array or implement Traversable","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"framework/helpers/BaseArrayHelper.php","lineNumber":910,"sourceCode":"    }\n\n    /**\n     * Checks whether an array or [[Traversable]] is a subset of another array or [[Traversable]].\n     *\n     * This method will return `true`, if all elements of `$needles` are contained in\n     * `$haystack`. If at least one element is missing, `false` will be returned.\n     *\n     * @param iterable $needles The values that must **all** be in `$haystack`.\n     * @param iterable $haystack The set of value to search.\n     * @param bool $strict Whether to enable strict (`===`) comparison.\n     * @return bool `true` if `$needles` is a subset of `$haystack`, `false` otherwise.\n     * @throws InvalidArgumentException if `$haystack` or `$needles` is neither traversable nor an array.\n     * @since 2.0.7\n     */\n    public static function isSubset($needles, $haystack, $strict = false)\n    {\n        if (!static::isTraversable($needles)) {\n            throw new InvalidArgumentException('Argument $needles must be an array or implement Traversable');\n        }\n\n        foreach ($needles as $needle) {\n            if (!static::isIn($needle, $haystack, $strict)) {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    /**\n     * Filters array according to rules specified.\n     *\n     * For example:\n     *\n     * ```\n     * $array = [","sourceCodeStart":892,"sourceCodeEnd":928,"githubUrl":"https://github.com/yiisoft/yii2/blob/66f00d18a29b520f85e8e8f1e32d1e7e7b556cac/framework/helpers/BaseArrayHelper.php#L892-L928","documentation":"Error \"Argument $needles must be an array or implement Traversable\" thrown in yiisoft/yii2.","triggerScenarios":"Thrown at framework/helpers/BaseArrayHelper.php:910 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"66f00d18a29b520f85e8e8f1e32d1e7e7b556cac","analyzedAt":"2026-08-17T05:17:23.470Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}