]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/ReversedFileReader.php
Changes:
[friendica.git] / src / Util / ReversedFileReader.php
index cda78ad0abb0b76037f6cfccf22eb308de262ef5..322c7ec79d10ef4a36782e47bb8274e3271433fb 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2024, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -60,7 +60,7 @@ class ReversedFileReader implements \Iterator
                $this->fh = fopen($filename, 'r');
                if (!$this->fh) {
                        // this should use a custom exception.
-                       throw \Exception("Unable to open $filename");
+                       throw new \Exception("Unable to open $filename");
                }
                $this->filesize = filesize($filename);
                $this->pos      = -1;
@@ -89,7 +89,7 @@ class ReversedFileReader implements \Iterator
         *
         * @return string|null Depending on data being buffered
         */
-       private function _readline()
+       private function _readline(): ?string
        {
                $buffer = & $this->buffer;
                while (true) {
@@ -112,6 +112,7 @@ class ReversedFileReader implements \Iterator
         * @see Iterator::next()
         * @return void
         */
+       #[\ReturnTypeWillChange]
        public function next()
        {
                ++$this->key;
@@ -124,6 +125,7 @@ class ReversedFileReader implements \Iterator
         * @see Iterator::rewind()
         * @return void
         */
+       #[\ReturnTypeWillChange]
        public function rewind()
        {
                if ($this->filesize > 0) {
@@ -158,7 +160,7 @@ class ReversedFileReader implements \Iterator
        }
 
        /**
-        * Checks if current iterator value is valid, that is, we readed all lines in files
+        * Checks if current iterator value is valid, that is, we read all lines in files
         *
         * @see Iterator::valid()
         * @return bool