Skip to content

Commit 0b96ed1

Browse files
committed
Use nullable types
1 parent 2463aef commit 0b96ed1

File tree

4 files changed

+16
-16
lines changed

4 files changed

+16
-16
lines changed

src/main/php/peer/ftp/DefaultFtpListParser.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ class DefaultFtpListParser implements FtpListParser {
1414
* Parse raw listing entry.
1515
*
1616
* @param string $raw a single line
17-
* @param peer.ftp.FtpConnection $connection
17+
* @param peer.ftp.FtpConnection $conn
1818
* @param string $base default "/"
19-
* @param util.Date $ref default NULL
19+
* @param ?util.Date $ref default NULL
2020
* @return peer.ftp.FtpEntry
2121
*/
22-
public function entryFrom($raw, FtpConnection $conn= null, $base= '/', Date $ref= null) {
22+
public function entryFrom($raw, FtpConnection $conn, $base= '/', ?Date $ref= null) {
2323
sscanf(
2424
$raw,
2525
'%s %d %s %s %d %s %d %[^ ] %[^$]',

src/main/php/peer/ftp/FtpFile.class.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ public function refresh($state) {
6565
*
6666
* @param io.streams.InputStream|io.Channel in
6767
* @param int mode default FtpTransfer::BINARY
68-
* @param peer.ftp.FtpTransferListener listener default NULL
69-
* @return peer.ftp.FtpFile this file
68+
* @param ?peer.ftp.FtpTransferListener listener default NULL
69+
* @return self
7070
* @throws peer.SocketException in case of an I/O error
7171
*/
72-
public function uploadFrom($in, $mode= FtpTransfer::BINARY, FtpTransferListener $listener= null) {
72+
public function uploadFrom($in, $mode= FtpTransfer::BINARY, ?FtpTransferListener $listener= null) {
7373
$transfer= (new FtpUpload($this, $in))->withListener($listener)->start($mode);
7474
while (!$transfer->complete()) $transfer->perform();
7575

@@ -87,8 +87,8 @@ public function uploadFrom($in, $mode= FtpTransfer::BINARY, FtpTransferListener
8787
/**
8888
* Starts a transfer
8989
*
90-
* @see xp://peer.ftp.FtpDownload#to
91-
* @see xp://peer.ftp.FtpUpload#from
90+
* @see peer.ftp.FtpDownload::to
91+
* @see peer.ftp.FtpUpload::from
9292
* @param peer.ftp.FtpTransfer transfer
9393
* @param int mode default FtpTransfer::BINARY
9494
* @return peer.ftp.FtpTransfer
@@ -104,11 +104,11 @@ public function start(FtpTransfer $transfer, $mode= FtpTransfer::BINARY) {
104104
*
105105
* @param io.streams.OutputStream|io.Channel out
106106
* @param int mode default FtpTransfer::BINARY
107-
* @param peer.ftp.FtpTransferListener listener default NULL
107+
* @param ?peer.ftp.FtpTransferListener listener default NULL
108108
* @return io.streams.OutputStream the output stream passed
109109
* @throws peer.SocketException in case of an I/O error
110110
*/
111-
public function downloadTo($out, $mode= FtpTransfer::BINARY, FtpTransferListener $listener= null) {
111+
public function downloadTo($out, $mode= FtpTransfer::BINARY, ?FtpTransferListener $listener= null) {
112112
$transfer= (new FtpDownload($this, $out))->withListener($listener)->start($mode);
113113
while (!$transfer->complete()) $transfer->perform();
114114

src/main/php/peer/ftp/FtpListParser.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ interface FtpListParser {
2727
* Parse raw listing entry.
2828
*
2929
* @param string $raw a single line
30-
* @param peer.ftp.FtpConnection $connection
30+
* @param peer.ftp.FtpConnection $conn
3131
* @param string $base default "/"
32-
* @param util.Date $ref default NULL
32+
* @param ?util.Date $ref default NULL
3333
* @return peer.ftp.FtpEntry
3434
*/
35-
public function entryFrom($raw, FtpConnection $conn= null, $base= '/', Date $ref= null);
35+
public function entryFrom($raw, FtpConnection $conn, $base= '/', ?Date $ref= null);
3636

3737
}

src/main/php/peer/ftp/WindowsFtpListParser.class.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ class WindowsFtpListParser implements FtpListParser {
1414
* Parse raw listing entry
1515
*
1616
* @param string $raw a single line
17-
* @param peer.ftp.FtpConnection $connection
17+
* @param peer.ftp.FtpConnection $conn
1818
* @param string $base default "/"
19-
* @param util.Date $ref default NULL
19+
* @param ?util.Date $ref default NULL
2020
* @return peer.ftp.FtpEntry
2121
*/
22-
public function entryFrom($raw, FtpConnection $conn= null, $base= '/', Date $ref= null) {
22+
public function entryFrom($raw, FtpConnection $conn, $base= '/', ?Date $ref= null) {
2323
preg_match(
2424
'/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +(<DIR>)?([0-9]+)? +(.+)/',
2525
$raw,

0 commit comments

Comments
 (0)