Completed
Push — master ( 589d25...593179 )
by Ryosuke
06:07 queued 03:25
created
src/Convert.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -82,23 +82,23 @@  discard block
 block discarded – undo
82 82
     {
83 83
         $argc = count($args);
84 84
         if ($argc < $required) {
85
-            throw new \InvalidArgumentException(get_called_class() . "::$method() expects at least $required parameters, $argc given");
85
+            throw new \InvalidArgumentException(get_called_class()."::$method() expects at least $required parameters, $argc given");
86 86
         }
87 87
         if ($required === 2 and !is_string($args[0]) and !is_object($args[0]) || !method_exists($args[0], '__toString')) {
88
-            throw new \InvalidArgumentException(get_called_class() . "::$method() expects parameter 1 to be string, " . gettype($args[0]) . ' given');
88
+            throw new \InvalidArgumentException(get_called_class()."::$method() expects parameter 1 to be string, ".gettype($args[0]).' given');
89 89
         }
90 90
         if (isset($args[$required - 1]) && is_numeric($args[$required - 1])) {
91
-            $code = $args[$required++ - 1];
91
+            $code = $args[$required++ -1];
92 92
         }
93 93
         $orInteger = $code === null ? " or integer" : '';
94 94
         if (!array_key_exists($required - 1, $args)) {
95
-            throw new \InvalidArgumentException(get_called_class() . "::$method() expects parameter $required to be callable$orInteger, none given");
95
+            throw new \InvalidArgumentException(get_called_class()."::$method() expects parameter $required to be callable$orInteger, none given");
96 96
         }
97 97
         if (!is_callable($args[$required - 1])) {
98
-            throw new \InvalidArgumentException(get_called_class() . "::$method() expects parameter $required to be callable$orInteger, " . gettype($args[$required - 1]) . ' given');
98
+            throw new \InvalidArgumentException(get_called_class()."::$method() expects parameter $required to be callable$orInteger, ".gettype($args[$required - 1]).' given');
99 99
         }
100 100
         if (isset($args[$required]) && !is_numeric($args[$required])) {
101
-            throw new \InvalidArgumentException(get_called_class() . "::$method() expects parameter " . ($required + 1) . " to be integer, " . gettype($args[$required]) . ' given');
101
+            throw new \InvalidArgumentException(get_called_class()."::$method() expects parameter ".($required + 1)." to be integer, ".gettype($args[$required]).' given');
102 102
         }
103 103
     }
104 104
 
@@ -110,22 +110,22 @@  discard block
 block discarded – undo
110 110
     public static function __callStatic($method, array $args)
111 111
     {
112 112
         if (strcasecmp(substr($method, 0, 2), 'to')) {
113
-            throw new \BadMethodCallException('Call to undefined method ' . get_called_class() . "::$method()");
113
+            throw new \BadMethodCallException('Call to undefined method '.get_called_class()."::$method()");
114 114
         }
115 115
 
116
-        $class = (string)substr($method, 2);
116
+        $class = (string) substr($method, 2);
117 117
         $required = $class === '' ? 2 : 1;
118 118
         self::validateArgumentTypes($method, $args, $required, $code);
119 119
 
120 120
         if ($class === '') {
121
-            $class = (string)array_shift($args);
121
+            $class = (string) array_shift($args);
122 122
         }
123 123
 
124 124
         if (!class_exists($class) and !is_subclass_of($class, '\Exception') and \PHP_VERSION < 7 || !is_subclass_of($class, '\Throwable')) {
125 125
             throw new \DomainException("The class \"$class\" must be an instance of Exception or Throwable");
126 126
         }
127 127
 
128
-        return Core::handle($args[$code !== null], function ($severity, $message, $file, $line) use ($class, $code) {
128
+        return Core::handle($args[$code !== null], function($severity, $message, $file, $line) use ($class, $code) {
129 129
             if (!(error_reporting() & $severity)) {
130 130
                 return;
131 131
             }
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
             } else {
135 135
                 throw new \ErrorException($message, $code ?: 0, $severity, $file, $line);
136 136
             }
137
-        }, isset($args[1 + ($code !== null)]) ? (int)$args[1 + ($code !== null)] : \E_ALL | \E_STRICT);
137
+        }, isset($args[1 + ($code !== null)]) ? (int) $args[1 + ($code !== null)] : \E_ALL | \E_STRICT);
138 138
     }
139 139
 
140 140
     /**
@@ -146,19 +146,19 @@  discard block
 block discarded – undo
146 146
     public static function silent($callback, $types = null, $captureExceptions = true)
147 147
     {
148 148
         if (!is_callable($callback)) {
149
-            throw new \InvalidArgumentException(get_called_class() . '::' . __METHOD__ . '() expects parameter 1 to be callable, ' . gettype($callback) . ' given');
149
+            throw new \InvalidArgumentException(get_called_class().'::'.__METHOD__.'() expects parameter 1 to be callable, '.gettype($callback).' given');
150 150
         }
151 151
         if ($types !== null && !is_numeric($types)) {
152
-            throw new \InvalidArgumentException(get_called_class() . '::' . __METHOD__ . '() expects parameter 2 to be integer, ' . gettype($types) . ' given');
152
+            throw new \InvalidArgumentException(get_called_class().'::'.__METHOD__.'() expects parameter 2 to be integer, '.gettype($types).' given');
153 153
         }
154 154
 
155 155
         try {
156
-            return Core::handle($callback, function ($severity, $message, $file, $line) use (&$errorException) {
156
+            return Core::handle($callback, function($severity, $message, $file, $line) use (&$errorException) {
157 157
                 if (!(error_reporting() & $severity)) {
158 158
                     return;
159 159
                 }
160 160
                 throw $errorException = new \ErrorException($message, 0, $severity, $file, $line);
161
-            }, (int)($types === null ? \E_ALL | \E_STRICT : $types));
161
+            }, (int) ($types === null ? \E_ALL | \E_STRICT : $types));
162 162
         } catch (\Exception $e) {
163 163
         } catch (\Throwable $e) {
164 164
         }
Please login to merge, or discard this patch.