<commit_before><?php

namespace FSQL;

use FSQL\Environment;

class Statement
{
    private $environment;
    private $query;
    private $params;
    private $result;
    private $stored;
    private $error;

    public function __construct(Environment $environment, $query = null)
    {
        $this->environment = $environment;
        $this->prepare($query);
    }

    public function error()
    {
        return $this->error;
    }

    private function set_error($error)
    {
        $this->error = $error;
        return false;
    }

    public function bind_param($types, ...$params)
    {
        $length = strlen($types);
        if($this->query === null) {
            return $this->set_error("Unable to perform a bind_param without a prepare");
        } if($length != count($params)) {
            return $this->set_error("bind_param's number of types in the string doesn't match number of parameters passed in");
        }

        $param = current($params);

        for($i = 0; $i < $length; ++$i, $param = next($params)) {
            $type = $types[$i];
            if($type == null) {
                $this->params[] = 'NULL';
            } else {
                switch($type) {
                case 'i':
                    $this->params[] = (int) $param;
                    break;
                case 'd':
                    $this->params[] = (float) $param;
                    break;
                case 's':
                case 'o':
                    $this->params[] = "'". addslashes((string) $param) . "'";
                    break;
                }
            }
        }

        return true;
    }<commit_msg>#10 Fixed null check to check param not type<commit_after><?php

namespace FSQL;

use FSQL\Environment;

class Statement
{
    private $environment;
    private $query;
    private $params;
    private $result;
    private $stored;
    private $error;

    public function __construct(Environment $environment, $query = null)
    {
        $this->environment = $environment;
        $this->prepare($query);
    }

    public function error()
    {
        return $this->error;
    }

    private function set_error($error)
    {
        $this->error = $error;
        return false;
    }

    public function bind_param($types, ...$params)
    {
        $length = strlen($types);
        if($this->query === null) {
            return $this->set_error("Unable to perform a bind_param without a prepare");
        } if($length != count($params)) {
            return $this->set_error("bind_param's number of types in the string doesn't match number of parameters passed in");
        }

        $param = current($params);

        for($i = 0; $i < $length; ++$i, $param = next($params)) {
            $type = $types[$i];
            if($param == null) {
                $this->params[] = 'NULL';
            } else {
                switch($type) {
                case 'i':
                    $this->params[] = (int) $param;
                    break;
                case 'd':
                    $this->params[] = (float) $param;
                    break;
                case 's':
                case 'o':
                    $this->params[] = "'". addslashes((string) $param) . "'";
                    break;
                }
            }
        }

        return true;
    }
{'fraction_non_alphanumeric': 0.13682634730538923, 'fraction_numerical': 0.0011976047904191617, 'mean_word_length': 1.517709118311982, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, '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': '3577735', 'n_tokens_mistral': 938, 'n_tokens_neox': 890, 'n_words': 234}