code: protected function stringToType($string)
      {
          if (is_string($string)) {
              switch (true) {
                  case ($string == 'null' || $string == 'NULL'):
                      $string = null;
                      break;
  
                  case ($string == 'true' || $string == 'TRUE'):
                      $string = true;
                      break;
  
                  case ($string == 'false' || $string == 'FALSE'):
                      $string = false;
                      break;
  
                  default:
                      break;
              }
          }
  
          return $string;
      }
docs: Convert string to corresponding type
  
  @param  string $string
  
  @return mixed