@@ -76,23 +76,23 @@ discard block |
||
76 | 76 | { |
77 | 77 | $argc = count($args); |
78 | 78 | if ($argc < $required) { |
79 | - throw new \InvalidArgumentException(get_called_class() . "::$method() expects at least $required parameters, $argc given"); |
|
79 | + throw new \InvalidArgumentException(get_called_class()."::$method() expects at least $required parameters, $argc given"); |
|
80 | 80 | } |
81 | 81 | if ($required === 2 and !is_string($args[0]) and !is_object($args[0]) || !method_exists($args[0], '__toString')) { |
82 | - throw new \InvalidArgumentException(get_called_class() . "::$method() expects parameter 1 to be string, " . gettype($args[0]) . ' given'); |
|
82 | + throw new \InvalidArgumentException(get_called_class()."::$method() expects parameter 1 to be string, ".gettype($args[0]).' given'); |
|
83 | 83 | } |
84 | 84 | if (isset($args[$required - 1]) && is_numeric($args[$required - 1])) { |
85 | - $code = $args[$required++ - 1]; |
|
85 | + $code = $args[$required++ -1]; |
|
86 | 86 | } |
87 | 87 | $orInteger = $code === null ? " or integer" : ''; |
88 | 88 | if (!array_key_exists($required - 1, $args)) { |
89 | - throw new \InvalidArgumentException(get_called_class() . "::$method() expects parameter $required to be callable$orInteger, none given"); |
|
89 | + throw new \InvalidArgumentException(get_called_class()."::$method() expects parameter $required to be callable$orInteger, none given"); |
|
90 | 90 | } |
91 | 91 | if (!is_callable($args[$required - 1])) { |
92 | - throw new \InvalidArgumentException(get_called_class() . "::$method() expects parameter $required to be callable$orInteger, " . gettype($args[$required - 1]) . ' given'); |
|
92 | + throw new \InvalidArgumentException(get_called_class()."::$method() expects parameter $required to be callable$orInteger, ".gettype($args[$required - 1]).' given'); |
|
93 | 93 | } |
94 | 94 | if (isset($args[$required]) && !is_numeric($args[$required])) { |
95 | - throw new \InvalidArgumentException(get_called_class() . "::$method() expects parameter " . ($required + 1) . " to be integer, " . gettype($args[$required]) . ' given'); |
|
95 | + throw new \InvalidArgumentException(get_called_class()."::$method() expects parameter ".($required + 1)." to be integer, ".gettype($args[$required]).' given'); |
|
96 | 96 | } |
97 | 97 | } |
98 | 98 | |
@@ -104,22 +104,22 @@ discard block |
||
104 | 104 | public static function __callStatic($method, array $args) |
105 | 105 | { |
106 | 106 | if (strcasecmp(substr($method, 0, 2), 'to')) { |
107 | - throw new \BadMethodCallException('Call to undefined method ' . get_called_class() . "::$method()"); |
|
107 | + throw new \BadMethodCallException('Call to undefined method '.get_called_class()."::$method()"); |
|
108 | 108 | } |
109 | 109 | |
110 | - $class = (string)substr($method, 2); |
|
110 | + $class = (string) substr($method, 2); |
|
111 | 111 | $required = $class === '' ? 2 : 1; |
112 | 112 | self::validateArgumentTypes($method, $args, $required, $code); |
113 | 113 | |
114 | 114 | if ($class === '') { |
115 | - $class = (string)array_shift($args); |
|
115 | + $class = (string) array_shift($args); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | if (!class_exists($class) and !is_subclass_of($class, '\Exception') and \PHP_VERSION < 7 || !is_subclass_of($class, '\Throwable')) { |
119 | 119 | throw new \DomainException("The class \"$class\" must be an instance of Exception or Throwable"); |
120 | 120 | } |
121 | 121 | |
122 | - return Core::handle($args[$code !== null], function ($severity, $message, $file, $line) use ($class, $code) { |
|
122 | + return Core::handle($args[$code !== null], function($severity, $message, $file, $line) use ($class, $code) { |
|
123 | 123 | if (!(error_reporting() & $severity)) { |
124 | 124 | return; |
125 | 125 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | } else { |
129 | 129 | throw new \ErrorException($message, 0, $severity, $file, $line); |
130 | 130 | } |
131 | - }, isset($args[1 + ($code !== null)]) ? (int)$args[1 + ($code !== null)] : \E_ALL | \E_STRICT); |
|
131 | + }, isset($args[1 + ($code !== null)]) ? (int) $args[1 + ($code !== null)] : \E_ALL | \E_STRICT); |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
@@ -140,20 +140,20 @@ discard block |
||
140 | 140 | public static function silent($callback, $types = null, $captureExceptions = true) |
141 | 141 | { |
142 | 142 | if (!is_callable($callback)) { |
143 | - throw new \InvalidArgumentException(get_called_class() . '::' . __METHOD__ . '() expects parameter 1 to be callable, ' . gettype($callback) . ' given'); |
|
143 | + throw new \InvalidArgumentException(get_called_class().'::'.__METHOD__.'() expects parameter 1 to be callable, '.gettype($callback).' given'); |
|
144 | 144 | } |
145 | 145 | if ($types !== null && !is_numeric($types)) { |
146 | - throw new \InvalidArgumentException(get_called_class() . '::' . __METHOD__ . '() expects parameter 2 to be integer, ' . gettype($types) . ' given'); |
|
146 | + throw new \InvalidArgumentException(get_called_class().'::'.__METHOD__.'() expects parameter 2 to be integer, '.gettype($types).' given'); |
|
147 | 147 | } |
148 | 148 | |
149 | 149 | $dummyException = new \Exception; |
150 | 150 | try { |
151 | - return Core::handle($callback, function ($severity) use ($dummyException) { |
|
151 | + return Core::handle($callback, function($severity) use ($dummyException) { |
|
152 | 152 | if (!(error_reporting() & $severity)) { |
153 | 153 | return; |
154 | 154 | } |
155 | 155 | throw $dummyException; |
156 | - }, (int)($types === null ? \E_ALL | \E_STRICT : $types)); |
|
156 | + }, (int) ($types === null ? \E_ALL | \E_STRICT : $types)); |
|
157 | 157 | } catch (\Exception $e) { |
158 | 158 | } catch (\Throwable $e) { |
159 | 159 | } |