<commit_before><?php

declare(strict_types=1);

/*
 * This file is a part of Sculpin.
 *
 * (c) Dragonfly Development Inc.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sculpin\Bundle\TwigBundle;

/**
 * Twig Environment with Loaded Template Invalidation.
 */
class Environment extends \Twig_Environment
{
    /**
     * We aren't supposed to be using loadTemplate directly, and Twig V2 took away our ability to invalidate it.
     *
     * Hacky workaround to expose invalidation.
     */
    public function invalidateLoadedTemplates() {
        try {
            $me     = new \ReflectionClass($this);
            $parent = $me;

            while ($parent !== false) {
                $me     = $parent;
                $parent = $me->getParentClass();
            }

            $templates = $me->getProperty('loadedTemplates');
            $templates->setAccessible(true);
            $templates->setValue($this, []);
        } catch (\ReflectionException $e) {}
    }
}<commit_msg>Cleaning up code sniffs<commit_after><?php

declare(strict_types=1);

/*
 * This file is a part of Sculpin.
 *
 * (c) Dragonfly Development Inc.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Sculpin\Bundle\TwigBundle;

/**
 * Twig Environment with Loaded Template Invalidation.
 */
class Environment extends \Twig_Environment
{
    /**
     * We aren't supposed to be using loadTemplate directly, and Twig V2 took away our ability to invalidate it.
     *
     * Hacky workaround to expose invalidation.
     */
    public function invalidateLoadedTemplates()
    {
        try {
            $me     = new \ReflectionClass($this);
            $parent = $me;

            while ($parent !== false) {
                $me     = $parent;
                $parent = $me->getParentClass();
            }

            $templates = $me->getProperty('loadedTemplates');
            $templates->setAccessible(true);
            $templates->setValue($this, []);
        } catch (\ReflectionException $e) {
        }
    }
}
{'fraction_non_alphanumeric': 0.108329540282203, 'fraction_numerical': 0.0018206645425580337, 'mean_word_length': 2.2562962962962962, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7240449', 'n_tokens_mistral': 597, 'n_tokens_neox': 581, 'n_words': 183}