{"record":{"id":"e7a6c74f4b0895bc","repo":"phalcon/cphalcon","slug":"role-must-be-either-a-string-or-implement-roleinte","errorCode":null,"errorMessage":"Role must be either a string or implement RoleInterface","messagePattern":"Role must be either a string or implement RoleInterface","errorType":"exception","errorClass":"Phalcon\\Acl\\Exceptions\\InvalidRoleType","httpStatus":null,"severity":"warning","filePath":"phalcon/Acl/Adapter/Memory.zep","lineNumber":414,"sourceCode":"     * $acl->addRole(\n     *     new Phalcon\\Acl\\Role(\"administrator\"),\n     *     \"consultant\"\n     * );\n     *\n     * $acl->addRole(\"administrator\", \"consultant\");\n     * $acl->addRole(\"administrator\", [\"consultant\", \"consultant2\"]);\n     * ```\n     */\n    public function addRole(role, accessInherits = null) -> bool\n    {\n        var roleName, roleObject;\n\n        if typeof role === \"object\" && role instanceof RoleInterface {\n            let roleObject = role;\n        } elseif is_string(role) {\n            let roleObject = new Role(role);\n        } else {\n            throw new InvalidRoleType();\n        }\n\n        let roleName = roleObject->getName();\n\n        if isset this->roles[roleName] {\n            return false;\n        }\n\n        let this->roles[roleName] = roleObject;\n\n        if null !== accessInherits {\n            return this->addInherit(roleName, accessInherits);\n        }\n\n        return true;\n    }\n\n    /**","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/phalcon/cphalcon/blob/b7419de9cd0a8a3f48441ead84c9f8415d463e25/phalcon/Acl/Adapter/Memory.zep#L396-L432","documentation":"AbstractProducer::setPriority() throws PriorityNotSupportedException for any non-null priority value; null (the default) is accepted. This is the capability-declaration pattern of this queue layer: transports without priority semantics (Beanstalk priority here is bound at put-time, not per producer) reject per-producer priority configuration.","triggerScenarios":"$producer->setPriority(5) on a producer whose class does not override setPriority().","commonSituations":"Reusable job-dispatch code shared across brokers that configures priority uniformly; migrating from enqueue/queue-interop backends where setPriority(null) round-trips harmlessly; documenting per-message priorities that the transport cannot honor.","solutions":["Remove the setPriority() call for transports without priority support, or pass null.","For Beanstalk, set the job priority at put() time instead (the put priority parameter), not on the producer.","If per-message priority is required, select a transport that overrides setPriority()."],"exampleFix":"// before\n$producer->setPriority(5);\n$producer->send($destination, $message);\n\n// after (Beanstalk-style transport: priority belongs to put())\n$producer->send($destination, $message);\n// pass priority via the transport-specific put options rather than the producer","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    $producer->setPriority($priority);\n} catch (\\Phalcon\\Queue\\Exceptions\\PriorityNotSupportedException $e) {\n    // fall back to the transport's default priority; do not fail the dispatch\n    $logger->info('Priority ignored: unsupported by this transport');\n}","preventionTips":["Treat priority as optional metadata; wrap the setter when brokers vary.","For Beanstalk, set priority at put() time instead of on the producer."],"tags":["queue","producer","priority","unsupported-feature"],"backgroundTag":"queue-feature-not-supported","analyzedSha":"b7419de9cd0a8a3f48441ead84c9f8415d463e25","analyzedAt":"2026-08-21T06:21:18.811Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}