<NME> SetcontentTokenParser.php
<BEF> <?php

namespace Bolt\Twig;

use Twig\Node\Expression\ArrayExpression;
use Twig\Node\Expression\ConstantExpression;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;

/**
 * Twig {{ setcontent }} token parser.
 *
 * @author Bob den Otter <bob@twokings.nl>
 */
class SetcontentTokenParser extends AbstractTokenParser
{

    protected $version = 1;

    public function __construct($version)
    {
        $this->version = $version;
    }
    /**
     * @param bool $legacy
     */
    public function __construct($legacy = false)
    {
        $this->legacy = $legacy;
    }

    /**
     * {@inheritdoc}
     */
    public function parse(Token $token)
    {
        $lineno = $token->getLine();

        $arguments = new ArrayExpression([], $lineno);
        $whereArguments = [];

        // name - the new variable with the results
        $name = $this->parser->getStream()->expect(Token::NAME_TYPE)->getValue();
        $this->parser->getStream()->expect(Token::OPERATOR_TYPE, '=');

        // ContentType, or simple expression to content.
        $contentType = $this->parser->getExpressionParser()->parseExpression();

        $counter = 0;

        do {
            // where parameter
            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'where')) {
                $this->parser->getStream()->next();
                $whereArguments = ['wherearguments' => $this->parser->getExpressionParser()->parseExpression()];
            }

            // limit parameter
            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'limit')) {
                $this->parser->getStream()->next();
                $limit = $this->parser->getExpressionParser()->parseExpression();
                $arguments->addElement($limit, new ConstantExpression('limit', $lineno));
            }

            // order / orderby parameter
            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'order') ||
                $this->parser->getStream()->test(Token::NAME_TYPE, 'orderby')) {
                $this->parser->getStream()->next();
                $order = $this->parser->getExpressionParser()->parseExpression();
                $arguments->addElement($order, new ConstantExpression('order', $lineno));
            }

            // paging / allowpaging parameter
            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'paging') ||
                $this->parser->getStream()->test(Token::NAME_TYPE, 'allowpaging')) {
                $this->parser->getStream()->next();
                $arguments->addElement(
                    new ConstantExpression(true, $lineno),
                    new ConstantExpression('paging', $lineno)
                );
            }

            // printquery parameter
            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'printquery')) {
                $this->parser->getStream()->next();
                $arguments->addElement(
                    new ConstantExpression(true, $lineno),
                    new ConstantExpression('printquery', $lineno)
                );
            }

            // returnsingle parameter
            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'returnsingle')) {
                $this->parser->getStream()->next();
                $arguments->addElement(
                    new ConstantExpression(true, $lineno),
                    new ConstantExpression('returnsingle', $lineno)
                );
            }

            // nohydrate parameter
            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'nohydrate')) {
                $this->parser->getStream()->next();
                $arguments->addElement(
                    new ConstantExpression(false, $lineno),
                    new ConstantExpression('hydrate', $lineno)
                );
            }

            // Make sure we don't get stuck in a loop, if a token can't be parsed.
            ++$counter;
        } while (!$this->parser->getStream()->test(Token::BLOCK_END_TYPE) && ($counter < 10));

        $this->parser->getStream()->expect(Token::BLOCK_END_TYPE);

        if ($this->legacy) {
            return new SetcontentNode($name, $contentType, $arguments, $whereArguments, $lineno, $this->getTag(), true);
        }

        return new SetcontentNode($name, $contentType, $arguments, $whereArguments, $lineno, $this->getTag());
    }

    /**
     * {@inheritdoc}
     */
    public function getTag()
    {
        return 'setcontent';
    }
}

<MSG> make sure the parser has default version of 1

<DFF> @@ -15,9 +15,9 @@ use Twig_Token as Token;
 class SetcontentTokenParser extends AbstractTokenParser
 {
 
-    protected $version = 1;
+    protected $version;
 
-    public function __construct($version)
+    public function __construct($version = 1)
     {
         $this->version = $version;
     }

{'commit': 'diff --git a/src/Twig/SetcontentTokenParser.php b/src/Twig/SetcontentTokenParser.php\nindex 6b383e94b..5b7be5c59 100644\n--- a/src/Twig/SetcontentTokenParser.php\n+++ b/src/Twig/SetcontentTokenParser.php\n@@ -15,9 +15,9 @@ use Twig_Token as Token;\n class SetcontentTokenParser extends AbstractTokenParser\n {\n \n-    protected $version = 1;\n+    protected $version;\n \n-    public function __construct($version)\n+    public function __construct($version = 1)\n     {\n         $this->version = $version;\n     }\n', 'commit_subject': 'make sure the parser has default version of 1', 'repo_name': 'bolt/bolt', 'committer': {'name': 'Ross Riley', 'email': 'eebce68ab99567722cee5644714a63dca807990d@gmail.com', 'time_sec': '1501580348', 'tz_offset': '60', 'date': {'seconds': '1501580348'}}, 'commit_tree': '60c7af232c375b9937091cabb6d20bba4cc81dcf', 'commit_message': 'make sure the parser has default version of 1\n', 'language_name': 'Shell', 'license': 'mit', 'hunks': '@@ -15,9 +15,9 @@ use Twig_Token as Token;\n class SetcontentTokenParser extends AbstractTokenParser\n {\n \n-    protected $version = 1;\n+    protected $version;\n \n-    public function __construct($version)\n+    public function __construct($version = 1)\n     {\n         $this->version = $version;\n     }\n', 'addition_count': 2, 'deletion_count': 2, 'src_file': 'a/src/Twig/SetcontentTokenParser.php', 'tgt_file': 'b/src/Twig/SetcontentTokenParser.php', 'file_extension': '.php', 'before_file': "<?php\n\nnamespace Bolt\\Twig;\n\nuse Twig\\Node\\Expression\\ArrayExpression;\nuse Twig\\Node\\Expression\\ConstantExpression;\nuse Twig\\Token;\nuse Twig\\TokenParser\\AbstractTokenParser;\n\n/**\n * Twig {{ setcontent }} token parser.\n *\n * @author Bob den Otter <bob@twokings.nl>\n */\nclass SetcontentTokenParser extends AbstractTokenParser\n{\n\n    protected $version = 1;\n\n    public function __construct($version)\n    {\n        $this->version = $version;\n    }\n    /**\n     * @param bool $legacy\n     */\n    public function __construct($legacy = false)\n    {\n        $this->legacy = $legacy;\n    }\n\n    /**\n     * {@inheritdoc}\n     */\n    public function parse(Token $token)\n    {\n        $lineno = $token->getLine();\n\n        $arguments = new ArrayExpression([], $lineno);\n        $whereArguments = [];\n\n        // name - the new variable with the results\n        $name = $this->parser->getStream()->expect(Token::NAME_TYPE)->getValue();\n        $this->parser->getStream()->expect(Token::OPERATOR_TYPE, '=');\n\n        // ContentType, or simple expression to content.\n        $contentType = $this->parser->getExpressionParser()->parseExpression();\n\n        $counter = 0;\n\n        do {\n            // where parameter\n            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'where')) {\n                $this->parser->getStream()->next();\n                $whereArguments = ['wherearguments' => $this->parser->getExpressionParser()->parseExpression()];\n            }\n\n            // limit parameter\n            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'limit')) {\n                $this->parser->getStream()->next();\n                $limit = $this->parser->getExpressionParser()->parseExpression();\n                $arguments->addElement($limit, new ConstantExpression('limit', $lineno));\n            }\n\n            // order / orderby parameter\n            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'order') ||\n                $this->parser->getStream()->test(Token::NAME_TYPE, 'orderby')) {\n                $this->parser->getStream()->next();\n                $order = $this->parser->getExpressionParser()->parseExpression();\n                $arguments->addElement($order, new ConstantExpression('order', $lineno));\n            }\n\n            // paging / allowpaging parameter\n            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'paging') ||\n                $this->parser->getStream()->test(Token::NAME_TYPE, 'allowpaging')) {\n                $this->parser->getStream()->next();\n                $arguments->addElement(\n                    new ConstantExpression(true, $lineno),\n                    new ConstantExpression('paging', $lineno)\n                );\n            }\n\n            // printquery parameter\n            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'printquery')) {\n                $this->parser->getStream()->next();\n                $arguments->addElement(\n                    new ConstantExpression(true, $lineno),\n                    new ConstantExpression('printquery', $lineno)\n                );\n            }\n\n            // returnsingle parameter\n            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'returnsingle')) {\n                $this->parser->getStream()->next();\n                $arguments->addElement(\n                    new ConstantExpression(true, $lineno),\n                    new ConstantExpression('returnsingle', $lineno)\n                );\n            }\n\n            // nohydrate parameter\n            if ($this->parser->getStream()->test(Token::NAME_TYPE, 'nohydrate')) {\n                $this->parser->getStream()->next();\n                $arguments->addElement(\n                    new ConstantExpression(false, $lineno),\n                    new ConstantExpression('hydrate', $lineno)\n                );\n            }\n\n            // Make sure we don't get stuck in a loop, if a token can't be parsed.\n            ++$counter;\n        } while (!$this->parser->getStream()->test(Token::BLOCK_END_TYPE) && ($counter < 10));\n\n        $this->parser->getStream()->expect(Token::BLOCK_END_TYPE);\n\n        if ($this->legacy) {\n            return new SetcontentNode($name, $contentType, $arguments, $whereArguments, $lineno, $this->getTag(), true);\n        }\n\n        return new SetcontentNode($name, $contentType, $arguments, $whereArguments, $lineno, $this->getTag());\n    }\n\n    /**\n     * {@inheritdoc}\n     */\n    public function getTag()\n    {\n        return 'setcontent';\n    }\n}\n", 'message': 'make sure the parser has default version of 1\n', 'author_name': 'Ross Riley', 'lang': 'php'}