Skip to content

Commit 5ad491c

Browse files
authored
Merge pull request #27 from mensbeam/master
Address PHP 8.1 deprecations
2 parents c507828 + 590a812 commit 5ad491c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/docopt.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ public function __construct($source, $error='ExitException')
876876
public static function fromPattern($source)
877877
{
878878
$source = preg_replace('@([\[\]\(\)\|]|\.\.\.)@', ' $1 ', $source);
879-
$source = preg_split('@\s+|(\S*<.*?'.'>)@', $source, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
879+
$source = preg_split('@\s+|(\S*<.*?'.'>)@', $source, 0, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
880880

881881
return new static($source, 'LanguageError');
882882
}
@@ -1207,7 +1207,7 @@ function parse_defaults($doc)
12071207
foreach (parse_section('options:', $doc) as $s) {
12081208
# FIXME corner case "bla: options: --foo"
12091209
list (, $s) = explode(':', $s, 2);
1210-
$splitTmp = array_slice(preg_split("@\n[ \t]*(-\S+?)@", "\n".$s, null, PREG_SPLIT_DELIM_CAPTURE), 1);
1210+
$splitTmp = array_slice(preg_split("@\n[ \t]*(-\S+?)@", "\n".$s, 0, PREG_SPLIT_DELIM_CAPTURE), 1);
12111211
$split = array();
12121212
for ($cnt = count($splitTmp), $i=0; $i < $cnt; $i+=2) {
12131213
$split[] = $splitTmp[$i] . (isset($splitTmp[$i+1]) ? $splitTmp[$i+1] : '');
@@ -1412,26 +1412,31 @@ public function __get($name)
14121412
}
14131413
}
14141414

1415+
#[\ReturnTypeWillChange]
14151416
public function offsetExists($offset)
14161417
{
14171418
return isset($this->args[$offset]);
14181419
}
14191420

1421+
#[\ReturnTypeWillChange]
14201422
public function offsetGet($offset)
14211423
{
14221424
return $this->args[$offset];
14231425
}
14241426

1427+
#[\ReturnTypeWillChange]
14251428
public function offsetSet($offset, $value)
14261429
{
14271430
$this->args[$offset] = $value;
14281431
}
14291432

1433+
#[\ReturnTypeWillChange]
14301434
public function offsetUnset($offset)
14311435
{
14321436
unset($this->args[$offset]);
14331437
}
14341438

1439+
#[\ReturnTypeWillChange]
14351440
public function getIterator()
14361441
{
14371442
return new \ArrayIterator($this->args);

0 commit comments

Comments
 (0)