{"record":{"id":"b822939d6c7e3f50","repo":"twigphp/Twig","slug":"unknown-s-option","errorCode":null,"errorMessage":"Unknown \"%s\" option.","messagePattern":"Unknown \"(.+?)\" option\\.","errorType":"exception","errorClass":"SyntaxError","httpStatus":null,"severity":"error","filePath":"src/TokenParser/DeprecatedTokenParser.php","lineNumber":52,"sourceCode":"    {\n        $stream = $this->parser->getStream();\n        $expr = $this->parser->parseExpression();\n        $node = new DeprecatedNode($expr, $token->getLine());\n\n        while ($stream->test(Token::NAME_TYPE)) {\n            $k = $stream->getCurrent()->getValue();\n            $stream->next();\n            $stream->expect(Token::OPERATOR_TYPE, '=');\n\n            switch ($k) {\n                case 'package':\n                    $node->setNode('package', $this->parser->parseExpression());\n                    break;\n                case 'version':\n                    $node->setNode('version', $this->parser->parseExpression());\n                    break;\n                default:\n                    throw new SyntaxError(\\sprintf('Unknown \"%s\" option.', $k), $stream->getCurrent()->getLine(), $stream->getSourceContext());\n            }\n        }\n\n        $stream->expect(Token::BLOCK_END_TYPE);\n\n        return $node;\n    }\n\n    public function getTag(): string\n    {\n        return 'deprecated';\n    }\n}\n","sourceCodeStart":34,"sourceCodeEnd":66,"githubUrl":"https://github.com/twigphp/Twig/blob/a414c3a491defb5a60f2fc88ef79ff37c90010cd/src/TokenParser/DeprecatedTokenParser.php#L34-L66","documentation":"Thrown by DeprecatedTokenParser::parse when the {% deprecated %} tag receives an option key other than 'package' or 'version'. The parser switches over known option names and any other key (the loop iterates string arguments) hits the default case, raising a SyntaxError. Only package and version metadata are supported for deprecation notices.","triggerScenarios":"Writing {% deprecated since=\"1.2\" %} or {% deprecated reason=\"old\" %} — any option key besides package/version triggers the error at the option's line.","commonSituations":"Confusing {% deprecated %} with PHP docblock-style @deprecated annotations and writing since/reason keys; copying syntax from other template engines or from trigger_deprecation() helper calls.","solutions":["Use only supported options: {% deprecated 'message' package='vendor/pkg' version='1.2' %}.","Remove the unknown option key.","Move extra rationale into the free-text message part of the tag."],"exampleFix":"{% deprecated since=\"2.0\" %}\n\n{# after #}\n{% deprecated 'The \"foo\" filter is deprecated.' package='vendor/pkg' version='2.0' %}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    $twig->parse($twig->tokenize(new \\Twig\\Source($code, $name)));\n} catch (\\Twig\\Error\\SyntaxError $e) {\n    if (str_contains($e->getMessage(), 'Unknown') && str_contains($e->getMessage(), 'option')) {\n        // point developer to supported keys: package, version\n    }\n    throw $e;\n}","preventionTips":["Use only package and version options with {% deprecated %}.","Fold extra rationale into the free-text message of the tag.","Lint templates in CI before merging deprecation annotations."],"tags":["twig","deprecated","syntax-error","token-parser"],"backgroundTag":"invalid-enum-value","analyzedSha":"a414c3a491defb5a60f2fc88ef79ff37c90010cd","analyzedAt":"2026-09-13T15:10:46.849Z","contentChangedAt":"2026-09-13T15:10:46.849Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}