@@ -43,9 +43,9 @@ class Content
4343 /**
4444 * Content constructor.
4545 *
46- * @param $content
46+ * @param string $content
4747 */
48- public function __construct ($ content )
48+ public function __construct (string $ content = '' )
4949 {
5050 $ this ->content = $ content ;
5151 $ this ->size = strlen ($ content );
@@ -57,7 +57,7 @@ public function __construct($content)
5757 *
5858 * @return int
5959 */
60- public function getPosition ()
60+ public function getPosition (): int
6161 {
6262 return $ this ->pos ;
6363 }
@@ -68,7 +68,7 @@ public function getPosition()
6868 * @param int $char
6969 * @return string
7070 */
71- public function char ($ char = null )
71+ public function char (int $ char = null ): string
7272 {
7373 $ pos = $ this ->pos ;
7474 if ( ! is_null ($ char )) {
@@ -86,9 +86,10 @@ public function char($char = null)
8686 * Moves the current position forward.
8787 *
8888 * @param int $count
89- * @return $this
89+ * @return Content
90+ * @chainable
9091 */
91- public function fastForward ($ count )
92+ public function fastForward (int $ count ): Content
9293 {
9394 $ this ->pos += $ count ;
9495
@@ -99,9 +100,10 @@ public function fastForward($count)
99100 * Moves the current position backward.
100101 *
101102 * @param int $count
102- * @return $this
103+ * @return Content
104+ * @chainable
103105 */
104- public function rewind ($ count )
106+ public function rewind (int $ count ): Content
105107 {
106108 $ this ->pos -= $ count ;
107109 if ($ this ->pos < 0 ) {
@@ -119,7 +121,7 @@ public function rewind($count)
119121 * @param bool $escape
120122 * @return string
121123 */
122- public function copyUntil ($ string , $ char = false , $ escape = false )
124+ public function copyUntil (string $ string , bool $ char = false , bool $ escape = false ): string
123125 {
124126 if ($ this ->pos >= $ this ->size ) {
125127 // nothing left
@@ -180,7 +182,7 @@ public function copyUntil($string, $char = false, $escape = false)
180182 * @param string $unless
181183 * @return string
182184 */
183- public function copyUntilUnless ($ string , $ unless )
185+ public function copyUntilUnless (string $ string , string $ unless )
184186 {
185187 $ lastPos = $ this ->pos ;
186188 $ this ->fastForward (1 );
@@ -205,7 +207,7 @@ public function copyUntilUnless($string, $unless)
205207 * @return string
206208 * @uses $this->copyUntil()
207209 */
208- public function copyByToken ($ token , $ char = false , $ escape = false )
210+ public function copyByToken (string $ token , bool $ char = false , bool $ escape = false )
209211 {
210212 $ string = $ this ->$ token ;
211213
@@ -219,7 +221,7 @@ public function copyByToken($token, $char = false, $escape = false)
219221 * @param bool $copy
220222 * @return $this|string
221223 */
222- public function skip ($ string , $ copy = false )
224+ public function skip (string $ string , bool $ copy = false )
223225 {
224226 $ len = strspn ($ this ->content , $ string , $ this ->pos );
225227
@@ -243,7 +245,7 @@ public function skip($string, $copy = false)
243245 * @return null|string
244246 * @uses $this->skip()
245247 */
246- public function skipByToken ($ token , $ copy = false )
248+ public function skipByToken (string $ token , bool $ copy = false )
247249 {
248250 $ string = $ this ->$ token ;
249251
0 commit comments