Skip to content

Commit

Permalink
Merge pull request #170 from Kharhamel/fix/exception
Browse files Browse the repository at this point in the history
fixed incorrect excecption creation
  • Loading branch information
Kharhamel authored Dec 18, 2019
2 parents 04e226d + 4df8789 commit 641198c
Show file tree
Hide file tree
Showing 84 changed files with 259 additions and 166 deletions.
5 changes: 3 additions & 2 deletions generated/Exceptions/ApacheException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class ApacheException extends \Exception implements SafeExceptionInterface
class ApacheException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/ApcException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class ApcException extends \Exception implements SafeExceptionInterface
class ApcException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/ApcuException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class ApcuException extends \Exception implements SafeExceptionInterface
class ApcuException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/ArrayException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class ArrayException extends \Exception implements SafeExceptionInterface
class ArrayException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/Bzip2Exception.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class Bzip2Exception extends \Exception implements SafeExceptionInterface
class Bzip2Exception extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/ClassobjException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class ClassobjException extends \Exception implements SafeExceptionInterface
class ClassobjException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/ComException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class ComException extends \Exception implements SafeExceptionInterface
class ComException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/CubridException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class CubridException extends \Exception implements SafeExceptionInterface
class CubridException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/DatetimeException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class DatetimeException extends \Exception implements SafeExceptionInterface
class DatetimeException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/DirException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class DirException extends \Exception implements SafeExceptionInterface
class DirException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/EioException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class EioException extends \Exception implements SafeExceptionInterface
class EioException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/ErrorfuncException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class ErrorfuncException extends \Exception implements SafeExceptionInterface
class ErrorfuncException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/ExecException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class ExecException extends \Exception implements SafeExceptionInterface
class ExecException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/FileinfoException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class FileinfoException extends \Exception implements SafeExceptionInterface
class FileinfoException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/FilesystemException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class FilesystemException extends \Exception implements SafeExceptionInterface
class FilesystemException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/FilterException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class FilterException extends \Exception implements SafeExceptionInterface
class FilterException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/FpmException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class FpmException extends \Exception implements SafeExceptionInterface
class FpmException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/FtpException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class FtpException extends \Exception implements SafeExceptionInterface
class FtpException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/FunchandException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class FunchandException extends \Exception implements SafeExceptionInterface
class FunchandException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/GmpException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class GmpException extends \Exception implements SafeExceptionInterface
class GmpException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/GnupgException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class GnupgException extends \Exception implements SafeExceptionInterface
class GnupgException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/HashException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class HashException extends \Exception implements SafeExceptionInterface
class HashException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/IbaseException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class IbaseException extends \Exception implements SafeExceptionInterface
class IbaseException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/IbmDb2Exception.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class IbmDb2Exception extends \Exception implements SafeExceptionInterface
class IbmDb2Exception extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/IconvException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class IconvException extends \Exception implements SafeExceptionInterface
class IconvException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/ImageException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class ImageException extends \Exception implements SafeExceptionInterface
class ImageException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/ImapException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class ImapException extends \Exception implements SafeExceptionInterface
class ImapException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
5 changes: 3 additions & 2 deletions generated/Exceptions/InfoException.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
<?php
namespace Safe\Exceptions;

class InfoException extends \Exception implements SafeExceptionInterface
class InfoException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
return new self(\json_last_error_msg(), \json_last_error());
$error = error_get_last();
return new self($error['message'] ?? 'An error occured', 0, $error['type'] ?? 1);
}
}
Loading

0 comments on commit 641198c

Please sign in to comment.