@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | public function __construct(string $body, string $class) |
| 37 | 37 | { |
| 38 | 38 | $this->body = $body; |
| 39 | - $this->as($class . '.php'); |
|
| 39 | + $this->as($class.'.php'); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | /** |
@@ -65,14 +65,14 @@ discard block |
||
| 65 | 65 | */ |
| 66 | 66 | public function saveTo(string $directory): Readable |
| 67 | 67 | { |
| 68 | - $path = $directory . \DIRECTORY_SEPARATOR . $this->file; |
|
| 68 | + $path = $directory.\DIRECTORY_SEPARATOR.$this->file; |
|
| 69 | 69 | |
| 70 | - if (\is_file($path) && ! @\unlink($path)) { |
|
| 71 | - throw new NotReadableException('Could not save a new source into ' . $path); |
|
| 70 | + if (\is_file($path) && !@\unlink($path)) { |
|
| 71 | + throw new NotReadableException('Could not save a new source into '.$path); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | - if (! @\file_put_contents($path, $this->body)) { |
|
| 75 | - throw new NotReadableException('Could not save a new source into ' . $path); |
|
| 74 | + if (!@\file_put_contents($path, $this->body)) { |
|
| 75 | + throw new NotReadableException('Could not save a new source into '.$path); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | return File::fromPathname($path); |
@@ -49,7 +49,7 @@ |
||
| 49 | 49 | public function lex(Readable $input): \Traversable |
| 50 | 50 | { |
| 51 | 51 | foreach ($this->exec($this->pattern, $input->getContents()) as $token) { |
| 52 | - if (! \in_array($token->name(), $this->skipped, true)) { |
|
| 52 | + if (!\in_array($token->name(), $this->skipped, true)) { |
|
| 53 | 53 | yield $token; |
| 54 | 54 | } |
| 55 | 55 | } |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | public function __construct(string $name, $value, int $offset = 0) |
| 39 | 39 | { |
| 40 | 40 | $this->name = $name; |
| 41 | - $this->value = (array)$value; |
|
| 41 | + $this->value = (array) $value; |
|
| 42 | 42 | $this->offset = $offset; |
| 43 | 43 | } |
| 44 | 44 | |
@@ -31,12 +31,12 @@ |
||
| 31 | 31 | */ |
| 32 | 32 | public function __toString(): string |
| 33 | 33 | { |
| 34 | - $format = function (string $value) { |
|
| 35 | - $value = (string)(\preg_replace('/\s+/iu', ' ', $value) ?? $value); |
|
| 34 | + $format = function(string $value) { |
|
| 35 | + $value = (string) (\preg_replace('/\s+/iu', ' ', $value) ?? $value); |
|
| 36 | 36 | $value = \addcslashes($value, '"'); |
| 37 | 37 | |
| 38 | 38 | if (\mb_strlen($value) > 35) { |
| 39 | - $value = \mb_substr($value, 0, 30) . |
|
| 39 | + $value = \mb_substr($value, 0, 30). |
|
| 40 | 40 | \sprintf('… (%s+)', \mb_strlen($value) - 30); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | public function lex(Readable $input): \Traversable |
| 39 | 39 | { |
| 40 | 40 | foreach ($this->exec($this->pcre->compile(), $input->getContents()) as $token) { |
| 41 | - if (! \in_array($token->name(), $this->skipped, true)) { |
|
| 41 | + if (!\in_array($token->name(), $this->skipped, true)) { |
|
| 42 | 42 | yield $token; |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | $message = \error_get_last()['message'] ?? \sprintf('Unprocessable PCRE %s', $pcre); |
| 70 | 70 | $message = \str_replace('preg_match(): Compilation failed: ', '', $message); |
| 71 | 71 | |
| 72 | - throw new BadLexemeException('Unprocessable PCRE (' . $message . ')'); |
|
| 72 | + throw new BadLexemeException('Unprocessable PCRE ('.$message.')'); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | return true; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | private function flags(): string |
| 91 | 91 | { |
| 92 | - return self::FLAG_UNICODE . self::FLAG_DOT_ALL . self::FLAG_ANALYZED; |
|
| 92 | + return self::FLAG_UNICODE.self::FLAG_DOT_ALL.self::FLAG_ANALYZED; |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
@@ -175,6 +175,6 @@ discard block |
||
| 175 | 175 | */ |
| 176 | 176 | private function escapeString(string $value): string |
| 177 | 177 | { |
| 178 | - return \str_replace(self::REGEX_DELIMITER, '\\' . self::REGEX_DELIMITER, $value); |
|
| 178 | + return \str_replace(self::REGEX_DELIMITER, '\\'.self::REGEX_DELIMITER, $value); |
|
| 179 | 179 | } |
| 180 | 180 | } |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | declare(strict_types=1); |
| 9 | 9 | |
| 10 | 10 | |
| 11 | -if (! \function_exists('\\class_basename')) { |
|
| 11 | +if (!\function_exists('\\class_basename')) { |
|
| 12 | 12 | /** |
| 13 | 13 | * Get the class "basename" of the given object / class. |
| 14 | 14 | * |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | { |
| 52 | 52 | $result = new \SplQueue(); |
| 53 | 53 | |
| 54 | - $status = @\preg_replace_callback($this->pattern, function (array $matches) use ($result): void { |
|
| 54 | + $status = @\preg_replace_callback($this->pattern, function(array $matches) use ($result): void { |
|
| 55 | 55 | $result->push($matches); |
| 56 | 56 | }, $this->subject); |
| 57 | 57 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | case \PREG_BAD_UTF8_OFFSET_ERROR: |
| 100 | 100 | return self::PREG_BAD_UTF8_OFFSET_ERROR; |
| 101 | 101 | } |
| 102 | - return 'Unexpected PCRE error (Code ' . $code . ')'; |
|
| 102 | + return 'Unexpected PCRE error (Code '.$code.')'; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | public function __construct(\Traversable $iterator, int $size = 10) |
| 40 | 40 | { |
| 41 | 41 | \assert($size > 0, 'Buffer size must be greater than 0'); |
| 42 | - \assert($size <= \PHP_INT_MAX, 'Buffer size must less than ' . \PHP_INT_MAX); |
|
| 42 | + \assert($size <= \PHP_INT_MAX, 'Buffer size must less than '.\PHP_INT_MAX); |
|
| 43 | 43 | |
| 44 | 44 | $this->size = $size; |
| 45 | 45 | $this->iterator = $iterator; |