Skip to content

Commit

Permalink
Fix compatibility by removing type constraints
Browse files Browse the repository at this point in the history
  • Loading branch information
thekid committed Mar 24, 2024
1 parent 3f2ee93 commit 8194ea5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/main/php/text/csv/CsvMapReader.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class CsvMapReader extends CsvReader {
*
* @param io.streams.Reader|io.streams.InputStream|io.Channel|string $in
* @param string[] $keys
* @param text.csv.CsvFormat $format
* @param ?text.csv.CsvFormat $format
*/
public function __construct($in, array $keys= [], CsvFormat $format= null) {
public function __construct($in, array $keys= [], $format= null) {
parent::__construct($in, $format);
$this->keys= $keys;
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/php/text/csv/CsvReader.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ abstract class CsvReader implements Closeable {
* Creates a new CSV reader reading data
*
* @param io.streams.Reader|io.streams.InputStream|io.Channel|string $in
* @param text.csv.CsvFormat $format
* @param ?text.csv.CsvFormat $format
*/
public function __construct($in, CsvFormat $format= null) {
public function __construct($in, $format= null) {
$this->reader= $in instanceof Reader ? $in : new StringReader($in);
with ($f= $format ?: CsvFormat::$DEFAULT); {
$this->delimiter= $f->getDelimiter();
$this->quote= $f->getQuote();
}

$format ?? $format= CsvFormat::$DEFAULT;
$this->delimiter= $format->getDelimiter();
$this->quote= $format->getQuote();
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/main/php/text/csv/CsvWriter.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ abstract class CsvWriter implements Closeable {
* Creates a new CSV writer writing data
*
* @param io.streams.Writer|io.streams.OutputStream|io.Channel|string $out
* @param text.csv.CsvFormat $format
* @param ?text.csv.CsvFormat $format
*/
public function __construct($out, CsvFormat $format= null) {
public function __construct($out, $format= null) {
$this->writer= $out instanceof Writer ? $out : new StringWriter($out);
$this->format= $format ? $format : CsvFormat::$DEFAULT;
$this->format= $format ?? CsvFormat::$DEFAULT;
}

/**
Expand Down

0 comments on commit 8194ea5

Please sign in to comment.