<commit_before><?php

namespace Psalm\Tests;

use PhpParser;
use PhpParser\ParserFactory;
use PHPUnit_Framework_TestCase;
use Psalm\Context;
use Psalm\Checker\TypeChecker;
use Psalm\Type;

class Php55Test extends PHPUnit_Framework_TestCase
{
    protected static $_parser;

    public static function setUpBeforeClass()
    {
        self::$_parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);

        $config = \Psalm\Config::getInstance();
        $config->throw_exception = true;
        $config->use_docblock_types = true;
    }

    public function setUp()
    {
        \Psalm\Checker\FileChecker::clearCache();
    }

    public function testGenerator()
    {
        $stmts = self::$_parser->parse('<?php
        function xrange($start, $limit, $step = 1) {
            for ($i = $start; $i <= $limit; $i += $step) {
                yield $i;
            }
        }

        /*
         * Note that an array is never created or returned,
         * which saves memory.
         */
        foreach (xrange(1, 9, 2) as $number) {<commit_msg>Add checkable return type for Generator<commit_after><?php

namespace Psalm\Tests;

use PhpParser;
use PhpParser\ParserFactory;
use PHPUnit_Framework_TestCase;
use Psalm\Context;
use Psalm\Checker\TypeChecker;
use Psalm\Type;

class Php55Test extends PHPUnit_Framework_TestCase
{
    protected static $_parser;

    public static function setUpBeforeClass()
    {
        self::$_parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7);

        $config = \Psalm\Config::getInstance();
        $config->throw_exception = true;
        $config->use_docblock_types = true;
    }

    public function setUp()
    {
        \Psalm\Checker\FileChecker::clearCache();
    }

    public function testGenerator()
    {
        $stmts = self::$_parser->parse('<?php
        /**
         * @param  int  $start
         * @param  int  $limit
         * @param  int  $step
         * @return int[]
         */
        function xrange($start, $limit, $step = 1) {
            for ($i = $start; $i <= $limit; $i += $step) {
                yield $i;
            }
        }

        /*
         * Note that an array is never created or returned,
         * which saves memory.
         */
        foreach (xrange(1, 9, 2) as $number) {
{'fraction_non_alphanumeric': 0.11949411251635413, 'fraction_numerical': 0.006105538595726123, 'mean_word_length': 2.277142857142857, 'pattern_counts': {'":': 0, '<': 9, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '876754', 'n_tokens_mistral': 713, 'n_tokens_neox': 690, 'n_words': 168}