@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | { |
45 | 45 | $this->stream = Stream::new(32); |
46 | 46 | |
47 | - $this->stream->onRead(function (string $sources) { |
|
47 | + $this->stream->onRead(function(string $sources) { |
|
48 | 48 | foreach ($this->then as $handler) { |
49 | 49 | $sources = $handler($sources); |
50 | 50 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | return $sources; |
53 | 53 | }); |
54 | 54 | |
55 | - $this->where(function (string $class, string $pathname) use ($vendorDirectory): bool { |
|
55 | + $this->where(function(string $class, string $pathname) use ($vendorDirectory): bool { |
|
56 | 56 | if ($this->vendor) { |
57 | 57 | return true; |
58 | 58 | } |
@@ -109,10 +109,10 @@ discard block |
||
109 | 109 | */ |
110 | 110 | public function through(CacheInterface $cache, callable $then): self |
111 | 111 | { |
112 | - return $this->then(function (string $sources) use ($cache, $then) { |
|
112 | + return $this->then(function(string $sources) use ($cache, $then) { |
|
113 | 113 | $key = \md5($sources); |
114 | 114 | |
115 | - if (! $cache->has($key)) { |
|
115 | + if (!$cache->has($key)) { |
|
116 | 116 | $cache->set($key, $then($sources)); |
117 | 117 | } |
118 | 118 |
@@ -52,10 +52,10 @@ discard block |
||
52 | 52 | |
53 | 53 | $this->stream = Stream::get($this->protocol); |
54 | 54 | |
55 | - if (\STREAM_USE_PATH & $options && ! \is_file($this->pathname)) { |
|
55 | + if (\STREAM_USE_PATH & $options && !\is_file($this->pathname)) { |
|
56 | 56 | $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS); |
57 | 57 | |
58 | - $this->pathname = \dirname($trace[1]['file']) . '/' . $this->pathname; |
|
58 | + $this->pathname = \dirname($trace[1]['file']).'/'.$this->pathname; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | $this->resource = \fopen('php://memory', 'rb+'); |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function stream_read(int $length): string |
90 | 90 | { |
91 | - return ! \feof($this->resource) ? \fread($this->resource, $length) : ''; |
|
91 | + return !\feof($this->resource) ? \fread($this->resource, $length) : ''; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | /** |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public function stream_tell(): int |
129 | 129 | { |
130 | - return (int)\ftell($this->resource); |
|
130 | + return (int) \ftell($this->resource); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -101,7 +101,7 @@ |
||
101 | 101 | return false; |
102 | 102 | } |
103 | 103 | |
104 | - if (! \is_string($file = $this->composer->findFile($class))) { |
|
104 | + if (!\is_string($file = $this->composer->findFile($class))) { |
|
105 | 105 | return false; |
106 | 106 | } |
107 | 107 |
@@ -21,7 +21,7 @@ |
||
21 | 21 | public function match(string $class, string $pathname): bool |
22 | 22 | { |
23 | 23 | foreach ($this->filters as $filter) { |
24 | - if (! $filter($class, $pathname)) { |
|
24 | + if (!$filter($class, $pathname)) { |
|
25 | 25 | return false; |
26 | 26 | } |
27 | 27 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function not(callable $filter): self |
36 | 36 | { |
37 | - return $this->where(function (string $class, string $file) use ($filter): bool { |
|
38 | - return ! $filter($class, $file); |
|
37 | + return $this->where(function(string $class, string $file) use ($filter): bool { |
|
38 | + return !$filter($class, $file); |
|
39 | 39 | }); |
40 | 40 | } |
41 | 41 | |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | */ |
57 | 57 | public function every(\Closure $then): self |
58 | 58 | { |
59 | - return $this->where(function (string $class, string $file) use ($then): bool { |
|
59 | + return $this->where(function(string $class, string $file) use ($then): bool { |
|
60 | 60 | $then($conjunction = new Conjunction()); |
61 | 61 | |
62 | 62 | return $conjunction->match($class, $file); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function any(\Closure $then): self |
71 | 71 | { |
72 | - return $this->where(function (string $class, string $file) use ($then): bool { |
|
72 | + return $this->where(function(string $class, string $file) use ($then): bool { |
|
73 | 73 | $then($disjunction = new Disjunction()); |
74 | 74 | |
75 | 75 | return $disjunction->match($class, $file); |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | */ |
83 | 83 | public function fqn(string $fqn): self |
84 | 84 | { |
85 | - return $this->where(function (string $class) use ($fqn): bool { |
|
85 | + return $this->where(function(string $class) use ($fqn): bool { |
|
86 | 86 | return \trim($class, '\\') === \trim($fqn, '\\'); |
87 | 87 | }); |
88 | 88 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | { |
96 | 96 | $name = \trim($name, '\\'); |
97 | 97 | |
98 | - return $this->where(function (string $fqn) use ($name): bool { |
|
98 | + return $this->where(function(string $fqn) use ($name): bool { |
|
99 | 99 | return \substr($fqn, -\strlen($name)) === $name; |
100 | 100 | }); |
101 | 101 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | { |
109 | 109 | $prefix = \trim($prefix, '\\'); |
110 | 110 | |
111 | - return $this->where(function (string $class) use ($prefix): bool { |
|
111 | + return $this->where(function(string $class) use ($prefix): bool { |
|
112 | 112 | return \strpos(\trim($class, '\\'), $prefix) === 0; |
113 | 113 | }); |
114 | 114 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | */ |
120 | 120 | public function fileName(string $name): self |
121 | 121 | { |
122 | - return $this->where(function (string $_, string $file) use ($name): bool { |
|
122 | + return $this->where(function(string $_, string $file) use ($name): bool { |
|
123 | 123 | $file = \str_replace('\\', '/', $file); |
124 | 124 | |
125 | 125 | return \pathinfo($file, \PATHINFO_FILENAME) === $name; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | { |
135 | 135 | $regex = $this->regex($regex, false); |
136 | 136 | |
137 | - return $this->where(function (string $_, string $file) use ($regex): bool { |
|
137 | + return $this->where(function(string $_, string $file) use ($regex): bool { |
|
138 | 138 | return \preg_match($regex, $file) !== 0; |
139 | 139 | }); |
140 | 140 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | $regex = $this->regex($regex); |
149 | 149 | |
150 | - return $this->where(function (string $_, string $file) use ($regex): bool { |
|
150 | + return $this->where(function(string $_, string $file) use ($regex): bool { |
|
151 | 151 | return \preg_match($regex, \pathinfo($file, \PATHINFO_FILENAME)) !== 0; |
152 | 152 | }); |
153 | 153 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | { |
161 | 161 | $regex = $this->regex($regex, true); |
162 | 162 | |
163 | - return $this->where(function (string $fqn) use ($regex): bool { |
|
163 | + return $this->where(function(string $fqn) use ($regex): bool { |
|
164 | 164 | $class = \basename(\str_replace('\\', '/', $fqn)); |
165 | 165 | |
166 | 166 | return \preg_match($regex, $class) !== 0; |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | { |
176 | 176 | $regex = $this->regex($regex); |
177 | 177 | |
178 | - return $this->where(function (string $fqn) use ($regex): bool { |
|
178 | + return $this->where(function(string $fqn) use ($regex): bool { |
|
179 | 179 | return \preg_match($regex, $fqn) !== 0; |
180 | 180 | }); |
181 | 181 | } |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | */ |
188 | 188 | private function regex(string $regex, bool $strict = false): string |
189 | 189 | { |
190 | - $regex = $strict ? '^' . $regex . '$' : $regex; |
|
190 | + $regex = $strict ? '^'.$regex.'$' : $regex; |
|
191 | 191 | |
192 | 192 | return \sprintf('/%s/isuS', \addcslashes($regex, '/')); |
193 | 193 | } |
@@ -13,7 +13,7 @@ |
||
13 | 13 | use Serafim\Stream\Stream; |
14 | 14 | use Serafim\Stream\StreamInterface; |
15 | 15 | |
16 | -if (! \function_exists('\\restream')) { |
|
16 | +if (!\function_exists('\\restream')) { |
|
17 | 17 | /** |
18 | 18 | * @param string $protocol |
19 | 19 | * @param \Closure $then |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @var string |
32 | 32 | */ |
33 | 33 | private const STREAM_DUPLICATION_EXCEPTION = |
34 | - 'Could not create stream "%s", because stream ' . |
|
34 | + 'Could not create stream "%s", because stream '. |
|
35 | 35 | 'with same name already has been registered.'; |
36 | 36 | |
37 | 37 | /** |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | { |
100 | 100 | assert($complexity > 0, 'Name complexity should be greater than 0'); |
101 | 101 | |
102 | - $name = 'stream' . \bin2hex(\random_bytes($complexity)); |
|
102 | + $name = 'stream'.\bin2hex(\random_bytes($complexity)); |
|
103 | 103 | |
104 | 104 | return static::create($name, $wrapper); |
105 | 105 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | public static function get(string $protocol): StreamInterface |
191 | 191 | { |
192 | - if (! isset(static::$streams[$protocol])) { |
|
192 | + if (!isset(static::$streams[$protocol])) { |
|
193 | 193 | $error = \sprintf('Protocol "%s://" should be registered', $protocol); |
194 | 194 | throw new StreamCreatingException($error); |
195 | 195 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | private function assertIsFile(string $pathname): void |
321 | 321 | { |
322 | - if (! \is_file($pathname)) { |
|
322 | + if (!\is_file($pathname)) { |
|
323 | 323 | $error = \sprintf('File %s not found', $pathname); |
324 | 324 | throw new NotFoundException($error); |
325 | 325 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | */ |
333 | 333 | private function assertIsReadable(string $pathname): void |
334 | 334 | { |
335 | - if (! \is_readable($pathname)) { |
|
335 | + if (!\is_readable($pathname)) { |
|
336 | 336 | $error = \sprintf('File %s not readable', $pathname); |
337 | 337 | throw new NotReadableException($error); |
338 | 338 | } |