<commit_before><?php

namespace Brick\Form\Element\Input;

use Brick\Form\Attribute\CheckedAttribute;
use Brick\Form\Attribute\RequiredAttribute;
use Brick\Form\Attribute\ValueAttribute;
use Brick\Form\Element\Input;

/**
 * Represents a checkbox input element.
 */
class Checkbox extends Input
{
    use CheckedAttribute;
    use RequiredAttribute;
    use ValueAttribute;

    /**
     * {@inheritdoc}
     */
    protected function getType()
    {
        return 'checkbox';
    }

    /**
     * {@inheritdoc}
     */
    protected function doPopulate($value)
    {
        $this->setChecked($value === $this->getValue());
    }
}
<commit_msg>Support checkboxes with no value specified<commit_after><?php

namespace Brick\Form\Element\Input;

use Brick\Form\Attribute\CheckedAttribute;
use Brick\Form\Attribute\RequiredAttribute;
use Brick\Form\Attribute\ValueAttribute;
use Brick\Form\Element\Input;

/**
 * Represents a checkbox input element.
 */
class Checkbox extends Input
{
    use CheckedAttribute;
    use RequiredAttribute;
    use ValueAttribute;

    /**
     * {@inheritdoc}
     */
    protected function getType()
    {
        return 'checkbox';
    }

    /**
     * {@inheritdoc}
     */
    protected function doPopulate($value)
    {
        $thisValue = $this->getValueOrNull();

        if ($thisValue === null) {
            $thisValue = 'on';
        }

        $this->setChecked($value === $thisValue);
    }
}

{'fraction_non_alphanumeric': 0.12569444444444444, 'fraction_numerical': 0.0, 'mean_word_length': 2.733160621761658, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '4502516', 'n_tokens_mistral': 427, 'n_tokens_neox': 420, 'n_words': 88}