/**
  * Applicable to lower shield Restriction (Fight number malus), but can not make it positive.
  *
  * @param MissingShieldSkillTable $missingShieldSkillsTable
  * @param int $shieldRestriction
  * @return int
  * @throws \Granam\Integer\Tools\Exceptions\WrongParameterType
  * @throws \Granam\Integer\Tools\Exceptions\ValueLostOnCast
  * @throws \Granam\Integer\Tools\Exceptions\NegativeIntegerCanNotBePositive
  */
 public function getRestrictionWithShield(MissingShieldSkillTable $missingShieldSkillsTable, $shieldRestriction)
 {
     /** @noinspection ExceptionsAnnotatingAndHandlingInspection */
     $malusFromRestriction = ToInteger::toNegativeInteger($shieldRestriction) + $missingShieldSkillsTable->getRestrictionBonusForSkill($this->getCurrentSkillRank()->getValue());
     if ($malusFromRestriction > 0) {
         return 0;
         // skill can lower the malus, but can not give bonus
     }
     return $malusFromRestriction;
 }
 private function normalizeValueForType($value, $type)
 {
     $value = trim($value);
     switch ($type) {
         case self::BOOLEAN:
             return ToBoolean::toBoolean($value, false);
         case self::INTEGER:
             return $value === '' ? false : ToInteger::toInteger($this->normalizeMinus($value));
         case self::POSITIVE_INTEGER:
             return $value === '' ? false : ToInteger::toPositiveInteger($this->normalizeMinus($value));
         case self::NEGATIVE_INTEGER:
             return $value === '' ? false : ToInteger::toNegativeInteger($this->normalizeMinus($value));
         case self::FLOAT:
             return $value === '' ? false : ToFloat::toFloat($this->normalizeMinus($value));
         default:
             // string
             return $value;
     }
 }