Skip to content

Commit 0ca0932

Browse files
committed
Improve code coverage by removing dead code and skip extension code
1 parent aa49d41 commit 0ca0932

File tree

1 file changed

+23
-8
lines changed

1 file changed

+23
-8
lines changed

src/Readline.php

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function __construct(ReadableStreamInterface $input, WritableStreamInterf
5656
"\033[D" => 'onKeyLeft',
5757

5858
"\033[1~" => 'onKeyHome',
59-
"\033[2~" => 'onKeyInsert',
59+
// "\033[2~" => 'onKeyInsert',
6060
"\033[3~" => 'onKeyDelete',
6161
"\033[4~" => 'onKeyEnd',
6262

@@ -514,12 +514,6 @@ public function onKeyDelete()
514514
$this->deleteChar($this->linepos);
515515
}
516516

517-
/** @internal */
518-
public function onKeyInsert()
519-
{
520-
// TODO: toggle insert mode
521-
}
522-
523517
/** @internal */
524518
public function onKeyHome()
525519
{
@@ -796,6 +790,11 @@ protected function processLine($eol)
796790
$this->emit('data', array($line . $eol));
797791
}
798792

793+
/**
794+
* @param string $str
795+
* @return int
796+
* @codeCoverageIgnore
797+
*/
799798
private function strlen($str)
800799
{
801800
// prefer mb_strlen() if available
@@ -807,6 +806,13 @@ private function strlen($str)
807806
return strlen(preg_replace('/./us', '.', $str));
808807
}
809808

809+
/**
810+
* @param string $str
811+
* @param int $start
812+
* @param ?int $len
813+
* @return string
814+
* @codeCoverageIgnore
815+
*/
810816
private function substr($str, $start = 0, $len = null)
811817
{
812818
if ($len === null) {
@@ -824,7 +830,12 @@ private function substr($str, $start = 0, $len = null)
824830
return implode('', array_slice($matches[0], $start, $len));
825831
}
826832

827-
/** @internal */
833+
/**
834+
* @internal
835+
* @param string $str
836+
* @return int
837+
* @codeCoverageIgnore
838+
*/
828839
public function strwidth($str)
829840
{
830841
// prefer mb_strwidth() if available
@@ -849,6 +860,10 @@ public function strwidth($str)
849860
));
850861
}
851862

863+
/**
864+
* @param string $str
865+
* @return string[]
866+
*/
852867
private function strsplit($str)
853868
{
854869
return preg_split('//u', $str, null, PREG_SPLIT_NO_EMPTY);

0 commit comments

Comments
 (0)