Completed
Push — master ( 60d74b...80261e )
by Ryosuke
02:19
created
src/Convert.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -46,16 +46,16 @@  discard block
 block discarded – undo
46 46
     {
47 47
         $argc = count($args);
48 48
         if ($argc < $required) {
49
-            throw new \InvalidArgumentException(get_called_class() . "::$method() expects at least $required parameters, $argc given");
49
+            throw new \InvalidArgumentException(get_called_class()."::$method() expects at least $required parameters, $argc given");
50 50
         }
51 51
         if ($required === 2 and !is_string($args[0]) and !is_object($args[0]) || !method_exists($args[0], '__toString')) {
52
-            throw new \InvalidArgumentException(get_called_class() . "::$method() expects parameter 1 to be string, " . gettype($args[0]) . ' given');
52
+            throw new \InvalidArgumentException(get_called_class()."::$method() expects parameter 1 to be string, ".gettype($args[0]).' given');
53 53
         }
54 54
         if (!is_callable($args[$required - 1])) {
55
-            throw new \InvalidArgumentException(get_called_class() . "::$method() expects parameter $required to be callable, " . gettype($args[$required - 1]) . ' given');
55
+            throw new \InvalidArgumentException(get_called_class()."::$method() expects parameter $required to be callable, ".gettype($args[$required - 1]).' given');
56 56
         }
57 57
         if (isset($args[$required]) && !is_numeric($args[$required])) {
58
-            throw new \InvalidArgumentException(get_called_class() . "::$method() expects parameter " . ($required + 1) . ' to be integer, ' . gettype($args[$required]) . ' given');
58
+            throw new \InvalidArgumentException(get_called_class()."::$method() expects parameter ".($required + 1).' to be integer, '.gettype($args[$required]).' given');
59 59
         }
60 60
     }
61 61
 
@@ -67,22 +67,22 @@  discard block
 block discarded – undo
67 67
     public static function __callStatic($method, array $args)
68 68
     {
69 69
         if (strcasecmp(substr($method, 0, 2), 'to')) {
70
-            throw new \BadMethodCallException('Call to undefined method ' . get_called_class() . "::$method()");
70
+            throw new \BadMethodCallException('Call to undefined method '.get_called_class()."::$method()");
71 71
         }
72 72
 
73
-        $class = (string)substr($method, 2);
73
+        $class = (string) substr($method, 2);
74 74
         $required = $class === '' ? 2 : 1;
75 75
         self::validateArgumentTypes($method, $args, $required);
76 76
 
77 77
         if ($class === '') {
78
-            $class = (string)array_shift($args);
78
+            $class = (string) array_shift($args);
79 79
         }
80 80
 
81 81
         if (!class_exists($class) and !is_subclass_of($class, '\Exception') and \PHP_VERSION < 7 || !is_subclass_of($class, '\Throwable')) {
82 82
             throw new \DomainException("The class \"$class\" must be an instance of Exception or Throwable");
83 83
         }
84 84
 
85
-        return Core::handle($args[0], function ($severity, $message, $file, $line) use ($class, $args) {
85
+        return Core::handle($args[0], function($severity, $message, $file, $line) use ($class, $args) {
86 86
             if (!(error_reporting() & $severity)) {
87 87
                 return;
88 88
             }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             } else {
92 92
                 throw new \ErrorException($message, 0, $severity, $file, $line);
93 93
             }
94
-        }, isset($args[1]) ? (int)$args[1] : \E_ALL | \E_STRICT);
94
+        }, isset($args[1]) ? (int) $args[1] : \E_ALL | \E_STRICT);
95 95
     }
96 96
 
97 97
     /**
@@ -103,20 +103,20 @@  discard block
 block discarded – undo
103 103
     public static function silent($callback, $types = null, $captureExceptions = true)
104 104
     {
105 105
         if (!is_callable($callback)) {
106
-            throw new \InvalidArgumentException(get_called_class() . '::' . __METHOD__ . '() expects parameter 1 to be callable, ' . gettype($callback) . ' given');
106
+            throw new \InvalidArgumentException(get_called_class().'::'.__METHOD__.'() expects parameter 1 to be callable, '.gettype($callback).' given');
107 107
         }
108 108
         if ($types !== null && !is_numeric($types)) {
109
-            throw new \InvalidArgumentException(get_called_class() . '::' . __METHOD__ . '() expects parameter 2 to be integer, ' . gettype($types) . ' given');
109
+            throw new \InvalidArgumentException(get_called_class().'::'.__METHOD__.'() expects parameter 2 to be integer, '.gettype($types).' given');
110 110
         }
111 111
 
112 112
         $dummyException = new \Exception;
113 113
         try {
114
-            return Core::handle($callback, function ($severity) use ($dummyException) {
114
+            return Core::handle($callback, function($severity) use ($dummyException) {
115 115
                 if (!(error_reporting() & $severity)) {
116 116
                     return;
117 117
                 }
118 118
                 throw $dummyException;
119
-            }, (int)($types === null ? \E_ALL | \E_STRICT : $types));
119
+            }, (int) ($types === null ? \E_ALL | \E_STRICT : $types));
120 120
         } catch (\Exception $e) {
121 121
         } catch (\Throwable $e) {
122 122
         }
Please login to merge, or discard this patch.