Completed
Push — master ( 761755...65d5d0 )
by Ron
05:42
created
src/StackTracePrinter.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@  discard block
 block discarded – undo
11 11
 	public static function printException(Exception $e, $messageIntro = '') {
12 12
 		self::p("%s[%s] %s\n", $messageIntro, get_class($e), $e->getMessage());
13 13
 
14
-		foreach($e->getTrace() as $idx => $station) {
14
+		foreach ($e->getTrace() as $idx => $station) {
15 15
 			self::formatStation($idx, $station);
16 16
 		}
17 17
 
18
-		if($e->getPrevious() instanceof Exception) {
18
+		if ($e->getPrevious() instanceof Exception) {
19 19
 			self::p();
20 20
 			self::printException($e->getPrevious(), 'Previous: ');
21 21
 		}
@@ -36,18 +36,18 @@  discard block
 block discarded – undo
36 36
 		);
37 37
 		$station = array_merge($defaults, $station);
38 38
 		self::p("#%- 3s%s:%d\n", $idx, $station['file'] ?: 'unknown', $station['line']);
39
-		if($station['class'] !== null || $station['function'] !== null) {
39
+		if ($station['class'] !== null || $station['function'] !== null) {
40 40
 			$params = array();
41
-			foreach(is_array($station['args']) ? $station['args'] : array() as $argument) {
42
-				if(is_array($argument)) {
41
+			foreach (is_array($station['args']) ? $station['args'] : array() as $argument) {
42
+				if (is_array($argument)) {
43 43
 					$params[] = sprintf('array%d', count($argument));
44
-				} elseif(is_object($argument)) {
44
+				} elseif (is_object($argument)) {
45 45
 					$params[] = sprintf('%s', get_class($argument));
46 46
 				} else {
47 47
 					$params[] = gettype($argument);
48 48
 				}
49 49
 			}
50
-			if(strpos($station['function'], '{closure}') !== false && $station['class'] !== null) {
50
+			if (strpos($station['function'], '{closure}') !== false && $station['class'] !== null) {
51 51
 				$station['function'] = '{closure}';
52 52
 			}
53 53
 			self::p("    %s%s%s%s%s%s\n", $station['class'], $station['type'], $station['function'], "(", join(', ', $params), ")");
Please login to merge, or discard this patch.
src/CoreErrorHandlers.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -28,15 +28,15 @@  discard block
 block discarded – undo
28 28
 	 * @param int|null $bitmask
29 29
 	 */
30 30
 	public static function enableExceptionsForErrors($bitmask = null) {
31
-		set_error_handler(function ($level, $message, $file, $line) use ($bitmask) {
31
+		set_error_handler(function($level, $message, $file, $line) use ($bitmask) {
32 32
 			// PHP-7 fix: What once was an E_STRICT is now an E_WARNING:
33
-			if(preg_match('/^Declaration of .*? should be compatible with/', $message)) {
33
+			if (preg_match('/^Declaration of .*? should be compatible with/', $message)) {
34 34
 				$level = E_STRICT;
35 35
 			}
36 36
 			if (0 === error_reporting()) {
37 37
 				return false;
38 38
 			}
39
-			if($bitmask & $level) {
39
+			if ($bitmask & $level) {
40 40
 				throw new ErrorException($message, 0, $level, $file, $line);
41 41
 			}
42 42
 		});
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 	 */
49 49
 	public static function registerAssertionHandler(LoggerInterface $logger, $logLevel) {
50 50
 		static $errorLogger = null;
51
-		if($errorLogger === null) {
51
+		if ($errorLogger === null) {
52 52
 			$errorLogger = new LoggerCollection();
53 53
 			assert_options(ASSERT_ACTIVE, true);
54 54
 			assert_options(ASSERT_WARNING, false);
55
-			assert_options(ASSERT_CALLBACK, function ($file, $line, $message) use ($errorLogger, $logLevel) {
55
+			assert_options(ASSERT_CALLBACK, function($file, $line, $message) use ($errorLogger, $logLevel) {
56 56
 				$errorLogger->log($logLevel, $message, array(
57 57
 					'file' => $file,
58 58
 					'line' => $line
@@ -67,12 +67,12 @@  discard block
 block discarded – undo
67 67
 	 */
68 68
 	public static function registerFatalErrorHandler(LoggerInterface $logger) {
69 69
 		static $errorLogger = null;
70
-		if($errorLogger === null) {
70
+		if ($errorLogger === null) {
71 71
 			$errorLogger = new LoggerCollection();
72 72
 			$errorLevels = self::$phpErrorLevels;
73
-			register_shutdown_function(function () use ($errorLogger, $errorLevels) {
73
+			register_shutdown_function(function() use ($errorLogger, $errorLevels) {
74 74
 				$error = error_get_last();
75
-				if($error['type'] === E_ERROR) {
75
+				if ($error['type'] === E_ERROR) {
76 76
 					$errorLogger = new LogLevelRangeFilter($errorLogger, LogLevel::ERROR);
77 77
 					$errorLogger->log(LogLevel::ALERT, $error['message'], $error);
78 78
 				}
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 	 */
87 87
 	public static function registerExceptionHandler(LoggerInterface $logger) {
88 88
 		static $errorLogger = null;
89
-		if($errorLogger === null) {
89
+		if ($errorLogger === null) {
90 90
 			$errorLogger = new LoggerCollection();
91
-			set_exception_handler(function ($exception) use ($errorLogger) {
91
+			set_exception_handler(function($exception) use ($errorLogger) {
92 92
 				/** @var \Exception|\Throwable $exception */
93 93
 				$errorLogger = new LogLevelRangeFilter($errorLogger, LogLevel::ERROR);
94 94
 				$errorLogger->log(LogLevel::CRITICAL, $exception->getMessage(), array('exception' => $exception));
95
-				if($exception instanceof Exception) {
95
+				if ($exception instanceof Exception) {
96 96
 					StackTracePrinter::printException($exception, "PHP Fatal Error: Uncaught exception: ");
97 97
 					die(1);
98 98
 				}
Please login to merge, or discard this patch.