@@ -163,6 +163,20 @@ public static function write($stream, string $data, ?int $length = null, $uri =
163163 return $ result ;
164164 }
165165
166+ /**
167+ * Rewind to the beginning of a stream
168+ *
169+ * Equivalent to `File::seek($stream, 0, \SEEK_SET, $uri)`.
170+ *
171+ * @param resource $stream
172+ * @param Stringable|string|null $uri
173+ * @throws FilesystemErrorException on failure.
174+ */
175+ public static function rewind ($ stream , $ uri = null ): void
176+ {
177+ self ::seek ($ stream , 0 , \SEEK_SET , $ uri );
178+ }
179+
166180 /**
167181 * Set the file position indicator for a stream
168182 *
@@ -433,6 +447,8 @@ public static function getEol($resource, $uri = null): ?string
433447 *
434448 * Derived from VS Code's `indentationGuesser`.
435449 *
450+ * Returns `$default` if `$resource` appears to use the default indentation.
451+ *
436452 * @param Stringable|string|resource $resource
437453 * @param Stringable|string|null $uri
438454 *
@@ -579,6 +595,14 @@ public static function guessIndentation(
579595 self ::close ($ handle , $ uri );
580596 }
581597
598+ if (
599+ $ default &&
600+ $ default ->InsertSpaces === $ insertSpaces &&
601+ $ default ->TabSize === $ tabSize
602+ ) {
603+ return $ default ;
604+ }
605+
582606 return new Indentation ($ insertSpaces , $ tabSize );
583607 }
584608
0 commit comments