Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merged branch romainneutron/DependencyInjectionExceptions (PR #5399)

Commits
-------

f2e4802 [Yaml] Normalize exceptions
b0f5f2e [Serializer] Normalize exceptions
bcd8db2 [DependencyInjection] Normalize exceptions

Discussion
----------

Normalize exceptions

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
License of the code: MIT

This PR adds consistence to components which already have their own exception interface.

DependencyInjection, Serializer and Yaml now only throw their own scoped exceptions.

For other components, it's much more work and could introduce some bugs. It would be better to do it in Symfony 2.2.
  • Loading branch information...
commit f1f0e0fea2bc568492ba1e25c2f88888d38459ca 2 parents 826fe43 + 85d2214
@fabpot fabpot authored
View
2  Exception/DumpException.php
@@ -18,6 +18,6 @@
*
* @api
*/
-class DumpException extends \RuntimeException implements ExceptionInterface
+class DumpException extends RuntimeException
{
}
View
2  Exception/ParseException.php
@@ -18,7 +18,7 @@
*
* @api
*/
-class ParseException extends \RuntimeException implements ExceptionInterface
+class ParseException extends RuntimeException
{
private $parsedFile;
private $parsedLine;
View
23 Exception/RuntimeException.php
@@ -0,0 +1,23 @@
+<?php
+
+/*
+ * This file is part of the Symfony package.
+ *
+ * (c) Fabien Potencier <fabien@symfony.com>
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Yaml\Exception;
+
+/**
+ * Exception class thrown when an error occurs during parsing.
+ *
+ * @author Romain Neutron <imprec@gmail.com>
+ *
+ * @api
+ */
+class RuntimeException extends \RuntimeException implements ExceptionInterface
+{
+}
View
4 Unescaper.php
@@ -130,7 +130,7 @@ public function unescapeCharacter($value)
*
* @return string The string with the new encoding
*
- * @throws \RuntimeException if no suitable encoding function is found (iconv or mbstring)
+ * @throws RuntimeException if no suitable encoding function is found (iconv or mbstring)
*/
private function convertEncoding($value, $to, $from)
{
@@ -140,6 +140,6 @@ private function convertEncoding($value, $to, $from)
return iconv($from, $to, $value);
}
- throw new \RuntimeException('No suitable convert encoding function (install the iconv or mbstring extension).');
+ throw new RuntimeException('No suitable convert encoding function (install the iconv or mbstring extension).');
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.