<commit_before><?php
declare(strict_types=1);

namespace ManaPHP\Pool;

use ManaPHP\Component;
use ManaPHP\Coroutine\Channel;
use ManaPHP\Exception\MisuseException;
use WeakMap;

class Manager extends Component implements ManagerInterface
{
    /**
     * @var \ManaPHP\Coroutine\Channel[][]
     */
    protected WeakMap $pool;

    public function __construct()
    {
        $this->pool = new WeakMap();
    }

    public function remove(object $owner, ?string $type = null): static
    {
        if ($type === null) {
            unset($this->pool[$owner]);
        } else {
            unset($this->pool[$owner][$type]);
        }

        return $this;
    }

    public function create(object $owner, int $capacity, string $type = 'default'): static
    {
        if (isset($this->pool[$owner][$type])) {
            throw new MisuseException(['`%s` pool of `%s` is exists', $type, get_class($owner)]);
        }

        $this->pool[$owner] ??= [];
        $this->pool[$owner][$type] = new Channel($capacity);
<commit_msg>fix Type doesn't match property's declared type<commit_after><?php
declare(strict_types=1);

namespace ManaPHP\Pool;

use ManaPHP\Component;
use ManaPHP\Coroutine\Channel;
use ManaPHP\Exception\MisuseException;
use WeakMap;

class Manager extends Component implements ManagerInterface
{
    protected WeakMap $pool;

    public function __construct()
    {
        $this->pool = new WeakMap();
    }

    public function remove(object $owner, ?string $type = null): static
    {
        if ($type === null) {
            unset($this->pool[$owner]);
        } else {
            unset($this->pool[$owner][$type]);
        }

        return $this;
    }

    public function create(object $owner, int $capacity, string $type = 'default'): static
    {
        if (isset($this->pool[$owner][$type])) {
            throw new MisuseException(['`%s` pool of `%s` is exists', $type, get_class($owner)]);
        }

        $this->pool[$owner] ??= [];
        $this->pool[$owner][$type] = new Channel($capacity);

{'fraction_non_alphanumeric': 0.1542997542997543, 'fraction_numerical': 0.0009828009828009828, 'mean_word_length': 2.805607476635514, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, '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': '5364835', 'n_tokens_mistral': 619, 'n_tokens_neox': 607, 'n_words': 146}