Skip to content

Fixed spelling in exception messages #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions src/PHPCR/Util/ValueConverter.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
switch ($srctype) {
case PropertyType::DATE:
if (! $value instanceof \DateTime) {
throw new RepositoryException('Can not convert a date that is not a \DateTime instance to string');
throw new RepositoryException('Cannot convert a date that is not a \DateTime instance to string');
}
/** @var $value \DateTime */
// Milliseconds formatting is not possible in PHP so we
Expand All @@ -161,7 +161,7 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
return $value;
default:
if (is_object($value)) {
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to STRING');
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to STRING');
}
if (is_resource($value)) {
throw new ValueFormatException('Inconsistency: Non-binary property should not have resource stream value');
Expand Down Expand Up @@ -200,9 +200,9 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
return $value->getTimestamp();
}
if (is_object($value)) {
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to a LONG');
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to a LONG');
}
throw new ValueFormatException('Can not convert '.var_export($value, true).' to a LONG');
throw new ValueFormatException('Cannot convert "'.var_export($value, true).'" to a LONG');

case PropertyType::DOUBLE:
switch ($srctype) {
Expand All @@ -222,9 +222,9 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
return (double) $value->getTimestamp();
}
if (is_object($value)) {
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to a DOUBLE');
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to a DOUBLE');
}
throw new ValueFormatException('Can not convert '.var_export($value, true).' to a DOUBLE');
throw new ValueFormatException('Cannot convert "'.var_export($value, true).'" to a DOUBLE');

case PropertyType::DATE:
switch ($srctype) {
Expand All @@ -247,9 +247,9 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
return $datetime;
}
if (is_object($value)) {
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to a DATE');
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to a DATE');
}
throw new ValueFormatException('Can not convert '.var_export($value, true).' to DATE');
throw new ValueFormatException('Cannot convert "'.var_export($value, true).'" to DATE');

case PropertyType::BOOLEAN:
switch ($srctype) {
Expand All @@ -266,9 +266,9 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
return (boolean) ((double) $value); // '0' is false too
}
if (is_object($value)) {
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to a BOOLEAN');
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to a BOOLEAN');
}
throw new ValueFormatException('Can not convert '.var_export($value, true).' to a BOOLEAN');
throw new ValueFormatException('Cannot convert "'.var_export($value, true).'" to a BOOLEAN');

case PropertyType::NAME:
switch ($srctype) {
Expand All @@ -282,9 +282,9 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
return $value;
}
if (is_object($value)) {
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to a NAME');
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to a NAME');
}
throw new ValueFormatException('Can not convert '.var_export($value, true).' to NAME');
throw new ValueFormatException('Cannot convert "'.var_export($value, true).'" to NAME');

case PropertyType::PATH:
switch ($srctype) {
Expand All @@ -299,9 +299,9 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
return $value;
}
if (is_object($value)) {
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to a PATH');
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to a PATH');
}
throw new ValueFormatException('Can not convert '.var_export($value, true).' to PATH');
throw new ValueFormatException('Cannot convert "'.var_export($value, true).'" to PATH');

case PropertyType::REFERENCE:
case PropertyType::WEAKREFERENCE:
Expand All @@ -311,15 +311,15 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
case PropertyType::WEAKREFERENCE:
if (empty($value)) {
//TODO check if string is valid uuid
throw new ValueFormatException('Value '.var_export($value, true).' is not a valid unique id');
throw new ValueFormatException('Value "'.var_export($value, true).'" is not a valid unique id');
}

return $value;
}
if (is_object($value)) {
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to a unique id');
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to a unique id');
}
throw new ValueFormatException('Can not convert '.var_export($value, true).' to unique id');
throw new ValueFormatException('Cannot convert "'.var_export($value, true).'" to unique id');

case PropertyType::URI:
switch ($srctype) {
Expand All @@ -341,9 +341,9 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
return $value;
}
if (is_object($value)) {
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to a URI');
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to a URI');
}
throw new ValueFormatException('Can not convert '.var_export($value, true).' to URI');
throw new ValueFormatException('Cannot convert "'.var_export($value, true).'" to URI');

case PropertyType::DECIMAL:
switch ($srctype) {
Expand All @@ -361,12 +361,12 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
return (string) $value->getTimestamp();
}
if (is_object($value)) {
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to a DECIMAL');
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to a DECIMAL');
}
throw new ValueFormatException('Can not convert '.var_export($value, true).' to a DECIMAL');
throw new ValueFormatException('Cannot convert "'.var_export($value, true).'" to a DECIMAL');

default:
throw new ValueFormatException("Unexpected target type $type in conversion");
throw new ValueFormatException('Unexpected target type "' . $type . '" in conversion');
}
}
}