protected function checkRule($rule)
    {
        $this->assertTrue(is_array($rule) || is_string($rule));

        $parts = is_array($rule) ? $rule : explode('|', $rule);

        $this->assertTrue(isset($parts[0]));

        if ($this->enforceRequiredOrNullable()) {
            $this->assertTrue($parts[0] === 'required' || $parts[0] === 'nullable');
        }

        foreach ($parts as $part) {
            $this->assertInternalType('string', $part);
        }
    }