original_string: protected function castValueToSimpleType($expectedType, $value, $nullIsValidValue = false)
      {
          try {
              $this->checkType($expectedType, $value, $nullIsValidValue);
          } catch (CmisInvalidArgumentException $exception) {
              if (PHP_INT_SIZE == 4 && $expectedType == 'integer' && is_double($value)) {
                  //TODO: 32bit - handle this specially?
                  settype($value, $expectedType);
              } else {
                  trigger_error(
                      sprintf(
                          'Given value is of type "%s" but a value of type "%s" was expected.'
                          . ' Value has been casted to the expected type.',
                          gettype($value),
                          $expectedType
                      ),
                      E_USER_NOTICE
                  );
                  settype($value, $expectedType);
              }
          }
  
          return $value;
      }
code: protected function castValueToSimpleType($expectedType, $value, $nullIsValidValue = false)
      {
          try {
              $this->checkType($expectedType, $value, $nullIsValidValue);
          } catch (CmisInvalidArgumentException $exception) {
              if (PHP_INT_SIZE == 4 && $expectedType == 'integer' && is_double($value)) {
                  //TODO: 32bit - handle this specially?
                  settype($value, $expectedType);
              } else {
                  trigger_error(
                      sprintf(
                          'Given value is of type "%s" but a value of type "%s" was expected.'
                          . ' Value has been casted to the expected type.',
                          gettype($value),
                          $expectedType
                      ),
                      E_USER_NOTICE
                  );
                  settype($value, $expectedType);
              }
          }
  
          return $value;
      }
code_tokens: protected function castValueToSimpleType ( $ expectedType , $ value , $ nullIsValidValue = false ) { try { $ this -> checkType ( $ expectedType , $ value , $ nullIsValidValue ) ; } catch ( CmisInvalidArgumentException $ exception ) { if ( PHP_INT_SIZE == 4 && $ expectedType == 'integer' && is_double ( $ value ) ) { //TODO: 32bit - handle this specially? settype ( $ value , $ expectedType ) ; } else { trigger_error ( sprintf ( 'Given value is of type "%s" but a value of type "%s" was expected.' . ' Value has been casted to the expected type.' , gettype ( $ value ) , $ expectedType ) , E_USER_NOTICE ) ; settype ( $ value , $ expectedType ) ; } } return $ value ; }
docstring: Ensure that a value is an instance of the expected type. If not the value
  is casted to the expected type and a log message is triggered.
  
  @param string $expectedType the expected object type (class name)
  @param mixed $value The value that has to be checked
  @param boolean $nullIsValidValue defines if <code>null</code> is also a valid value
  @return mixed
docstring_tokens: Ensure that a value is an instance of the expected type . If not the value is casted to the expected type and a log message is triggered .