<commit_before>import Context from "../context"
import ContextTypes from "../context-types"
import Block from "./block"
import Class from "./class"
import Doc from "./doc"
import * as PHPError from "../php-error"
export default class Program extends Block {
    /**
     * Checks that syntax seems ok
     * @param {Context} context
     * @param {boolean} [in_call]
     * @param {?Doc} [doc]
     * @returns {?ContextTypes} The set of types applicable to this value
     */
    check(context, in_call = false, doc = null) {
        let classes = this.children.filter(
            c => c instanceof Class
        )
        if(classes.length > 1) {
            this.throw(new PHPError.PSR1.S3ClassCount(
                `PSR-1 #3: One class per file (${classes.length})`
            ), context)
        }
        var inner_context = context.childContext()
        /** @type {?Doc} */
        let last_doc = null
        this.children.forEach(child => {
            if(child instanceof Doc) {
                last_doc = child
            } else {
                child.check(inner_context, false, last_doc)
                last_doc = null
            }
        })
        return super.check(context, in_call, doc)
    }
}
<commit_msg>Let Block check the block children for doc<commit_after>import Context from "../context"
import ContextTypes from "../context-types"
import Block from "./block"
import Class from "./class"
import Doc from "./doc"
import * as PHPError from "../php-error"
export default class Program extends Block {
    /**
     * Checks that syntax seems ok
     * @param {Context} context
     * @param {boolean} [in_call]
     * @param {?Doc} [doc]
     * @returns {?ContextTypes} The set of types applicable to this value
     */
    check(context, in_call = false, doc = null) {
        let classes = this.children.filter(
            c => c instanceof Class
        )
        if(classes.length > 1) {
            this.throw(new PHPError.PSR1.S3ClassCount(
                `PSR-1 #3: One class per file (${classes.length})`
            ), context)
        }
        return super.check(context, in_call, doc)
    }
}

{'fraction_non_alphanumeric': 0.11745437529246608, 'fraction_numerical': 0.004679457182966776, 'mean_word_length': 2.0412517780938835, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '4913036', 'n_tokens_mistral': 606, 'n_tokens_neox': 602, 'n_words': 193}