Skip to content

Commit 587ff49

Browse files
committed
Declare tentative return types for ext/spl - part 1
1 parent 0192fd2 commit 587ff49

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+567
-563
lines changed

Zend/tests/foreach_004.phpt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ class IT extends ArrayIterator {
1616
}
1717
}
1818

19-
function rewind() {$this->trap(__FUNCTION__); return parent::rewind();}
20-
function valid() {$this->trap(__FUNCTION__); return parent::valid();}
21-
function key() {$this->trap(__FUNCTION__); return parent::key();}
22-
function next() {$this->trap(__FUNCTION__); return parent::next();}
19+
function rewind(): void {$this->trap(__FUNCTION__); parent::rewind();}
20+
function valid(): bool {$this->trap(__FUNCTION__); return parent::valid();}
21+
function key(): mixed {$this->trap(__FUNCTION__); return parent::key();}
22+
function next(): void {$this->trap(__FUNCTION__); parent::next();}
2323
}
2424

2525
foreach(['rewind', 'valid', 'key', 'next'] as $trap) {

Zend/tests/iterator_key_by_ref.phpt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Iterator::key() with by-ref return
33
--FILE--
44
<?php
55
class Test extends ArrayIterator {
6+
#[ReturnTypeWillChange]
67
function &key() {
78
return $foo;
89
}

ext/phar/tests/phar_oo_004.phpt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,31 +31,31 @@ class MyDirectoryIterator extends DirectoryIterator
3131
parent::__construct($dir);
3232
}
3333

34-
function rewind()
34+
function rewind(): void
3535
{
3636
echo __METHOD__ . "\n";
3737
parent::rewind();
3838
}
3939

40-
function valid()
40+
function valid(): bool
4141
{
4242
echo __METHOD__ . "\n";
4343
return parent::valid();
4444
}
4545

46-
function key()
46+
function key(): mixed
4747
{
4848
echo __METHOD__ . "\n";
4949
return parent::key();
5050
}
5151

52-
function current()
52+
function current(): mixed
5353
{
5454
echo __METHOD__ . "\n";
5555
return parent::current();
5656
}
5757

58-
function next()
58+
function next(): void
5959
{
6060
echo __METHOD__ . "\n";
6161
parent::next();

ext/phar/tests/phar_oo_008.phpt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ foreach($f as $k => $v)
3131

3232
class MyCSVFile extends SplFileObject
3333
{
34-
function current()
34+
function current(): string|array|false
3535
{
3636
return parent::fgetcsv(',', '"');
3737
}
@@ -62,7 +62,7 @@ foreach($v as $k => $d)
6262

6363
class MyCSVFile2 extends SplFileObject
6464
{
65-
function getCurrentLine()
65+
function getCurrentLine(): string
6666
{
6767
echo __METHOD__ . "\n";
6868
return implode('|', parent::fgetcsv(',', '"'));

0 commit comments

Comments
 (0)