Skip to content

Commit 42d94f8

Browse files
committed
Merge pull request #129 from phpcr/fixed_exception_messages
Fixed spelling in exception messages
2 parents 8320659 + 7308576 commit 42d94f8

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/PHPCR/Util/ValueConverter.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
146146
switch ($srctype) {
147147
case PropertyType::DATE:
148148
if (! $value instanceof \DateTime) {
149-
throw new RepositoryException('Can not convert a date that is not a \DateTime instance to string');
149+
throw new RepositoryException('Cannot convert a date that is not a \DateTime instance to string');
150150
}
151151
/** @var $value \DateTime */
152152
// Milliseconds formatting is not possible in PHP so we
@@ -161,7 +161,7 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
161161
return $value;
162162
default:
163163
if (is_object($value)) {
164-
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to STRING');
164+
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to STRING');
165165
}
166166
if (is_resource($value)) {
167167
throw new ValueFormatException('Inconsistency: Non-binary property should not have resource stream value');
@@ -200,9 +200,9 @@ public function convertType($value, $type, $srctype = PropertyType::UNDEFINED)
200200
return $value->getTimestamp();
201201
}
202202
if (is_object($value)) {
203-
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to a LONG');
203+
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to a LONG');
204204
}
205-
throw new ValueFormatException('Can not convert '.var_export($value, true).' to a LONG');
205+
throw new ValueFormatException('Cannot convert "'.var_export($value, true).'" to a LONG');
206206

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

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

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

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

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

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

317317
return $value;
318318
}
319319
if (is_object($value)) {
320-
throw new ValueFormatException('Can not convert object of class '.get_class($value).' to a unique id');
320+
throw new ValueFormatException('Cannot convert object of class "'.get_class($value).'" to a unique id');
321321
}
322-
throw new ValueFormatException('Can not convert '.var_export($value, true).' to unique id');
322+
throw new ValueFormatException('Cannot convert "'.var_export($value, true).'" to unique id');
323323

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

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

368368
default:
369-
throw new ValueFormatException("Unexpected target type $type in conversion");
369+
throw new ValueFormatException('Unexpected target type "' . $type . '" in conversion');
370370
}
371371
}
372372
}

0 commit comments

Comments
 (0)