@@ -65,7 +65,7 @@ class HybiFrame extends Frame
6565 */
6666 public function encode ($ payload , $ type = Protocol::TYPE_TEXT , $ masked = false )
6767 {
68- if (!\is_int ($ type ) || !\ in_array ($ type , Protocol::FRAME_TYPES )) {
68+ if (!\is_int ($ type ) || !in_array ($ type , Protocol::FRAME_TYPES , true )) {
6969 throw new InvalidArgumentException ('Invalid frame type ' );
7070 }
7171
@@ -292,39 +292,47 @@ public function receiveData($data)
292292 * @return bool
293293 * @throws FrameException
294294 */
295- public function isFinal ()
295+ public function isFinal (): bool
296296 {
297297 if (!isset ($ this ->buffer [self ::BYTE_HEADER ])) {
298298 throw new FrameException ('Cannot yet tell if frame is final ' );
299299 }
300300
301- return (boolean )(\ord ($ this ->buffer [self ::BYTE_HEADER ]) & self ::BITFIELD_FINAL );
301+ return (bool )(\ord ($ this ->buffer [self ::BYTE_HEADER ]) & self ::BITFIELD_FINAL );
302302 }
303303
304304 /**
305305 * @throws FrameException
306306 */
307- public function getType ()
307+ public function getType (): int
308308 {
309309 if (!isset ($ this ->buffer [self ::BYTE_HEADER ])) {
310310 throw new FrameException ('Cannot yet tell type of frame ' );
311311 }
312312
313- $ type = (int )( \ord ($ this ->buffer [self ::BYTE_HEADER ]) & self ::BITFIELD_TYPE );
313+ $ type = (\ord ($ this ->buffer [self ::BYTE_HEADER ]) & self ::BITFIELD_TYPE );
314314
315- if (!\ in_array ($ type , Protocol::FRAME_TYPES )) {
315+ if (!in_array ($ type , Protocol::FRAME_TYPES , true )) {
316316 throw new FrameException ('Invalid payload type ' );
317317 }
318318
319319 return $ type ;
320320 }
321321
322- protected function getExpectedBufferLength ()
322+ /**
323+ * @return int
324+ * @throws FrameException
325+ */
326+ protected function getExpectedBufferLength (): int
323327 {
324328 return $ this ->getLength () + $ this ->getPayloadOffset ();
325329 }
326330
327- public function getLength ()
331+ /**
332+ * @return int
333+ * @throws FrameException
334+ */
335+ public function getLength (): int
328336 {
329337 if (!$ this ->length ) {
330338 $ initial = $ this ->getInitialLength ();
@@ -353,6 +361,9 @@ public function getLength()
353361 return $ this ->length ;
354362 }
355363
364+ /**
365+ * @throws FrameException
366+ */
356367 protected function decodeFramePayloadFromBuffer ()
357368 {
358369 $ payload = substr ($ this ->buffer , $ this ->getPayloadOffset ());
0 commit comments