Browse Source

simplification

tags/0.8
Paul Rock 7 years ago
parent
commit
9497fc04ef
  1. 2
      src/Config.php
  2. 3
      src/Helpers/TypeHelper.php

2
src/Config.php

@ -58,7 +58,7 @@ class Config implements ConfigInterface
}
// Check what type has this value
if (TypeHelper::checkIfTypeMismatch($name, \gettype($value), self::ALLOWED[$name])) {
if (TypeHelper::checkIfTypeMismatch(\gettype($value), self::ALLOWED[$name])) {
throw new ConfigException("Parameter '$name' has wrong type '" . \gettype($value) . "' but should be '" . self::ALLOWED[$name] . "'");
}

3
src/Helpers/TypeHelper.php

@ -13,12 +13,11 @@ class TypeHelper
/**
* Compare data types of some value
*
* @param string $name Name of value
* @param mixed $whatType What type has value
* @param mixed $isType What type should be
* @return bool
*/
public static function checkIfTypeMismatch(string $name, $whatType, $isType): bool
public static function checkIfTypeMismatch($whatType, $isType): bool
{
return ($whatType !== $isType);
}

Loading…
Cancel
Save