| @@ -24,27 +24,24 @@ | ||
| 24 | 24 | /** |
| 25 | 25 | * The used character for the enclosure of a cell. Defaults to quotation mark ". |
| 26 | 26 | * |
| 27 | 27 | * @since 1.0.0 |
| 28 | - * @var string | |
| 29 | 28 | */ |
| 30 | - protected $enclosure = '"'; | |
| 29 | + protected string $enclosure = '"'; | |
| 31 | 30 | |
| 32 | 31 | /** |
| 33 | 32 | * Number of rows to analyze when attempting to auto-detect the CSV delimiter. |
| 34 | 33 | * |
| 35 | 34 | * @since 1.0.0 |
| 36 | - * @var int | |
| 37 | 35 | */ |
| 38 | - protected $delimiter_search_max_lines = 15; | |
| 36 | + protected int $delimiter_search_max_lines = 15; | |
| 39 | 37 | |
| 40 | 38 | /** |
| 41 | 39 | * Characters to ignore when attempting to auto-detect delimiter. |
| 42 | 40 | * |
| 43 | 41 | * @since 1.0.0 |
| 44 | - * @var string | |
| 45 | 42 | */ |
| 46 | - protected $non_delimiter_chars = "a-zA-Z0-9\n\r"; | |
| 43 | + protected string $non_delimiter_chars = "a-zA-Z0-9\n\r"; | |
| 47 | 44 | |
| 48 | 45 | /** |
| 49 | 46 | * The preferred delimiter characters, only used when all filtering method return multiple possible delimiters (happens very rarely). |
| 50 | 47 | * There must not be more than 9 characters in the preferred delimiter character list, see `_check_delimiter_count()`. |
| @@ -49,19 +46,17 @@ | ||
| 49 | 46 | * The preferred delimiter characters, only used when all filtering method return multiple possible delimiters (happens very rarely). |
| 50 | 47 | * There must not be more than 9 characters in the preferred delimiter character list, see `_check_delimiter_count()`. |
| 51 | 48 | * |
| 52 | 49 | * @since 1.0.0 |
| 53 | - * @var string | |
| 54 | 50 | */ |
| 55 | - protected $preferred_delimiter_chars = ";,\t"; | |
| 51 | + protected string $preferred_delimiter_chars = ";,\t"; | |
| 56 | 52 | |
| 57 | 53 | /** |
| 58 | 54 | * The CSV data string that shall be parsed to an array. |
| 59 | 55 | * |
| 60 | 56 | * @since 1.0.0 |
| 61 | - * @var string | |
| 62 | 57 | */ |
| 63 | - protected $import_data; | |
| 58 | + protected string $import_data = ''; | |
| 64 | 59 | |
| 65 | 60 | /** |
| 66 | 61 | * The error state while parsing input data. |
| 67 | 62 | * |
| @@ -70,11 +65,10 @@ | ||
| 70 | 65 | * 2 = The enclosure character was found in a non-enclosed field. This means the file is either corrupt, |
| 71 | 66 | * or does not follow the common CSV standard. Please validate the parsed data manually. |
| 72 | 67 | * |
| 73 | 68 | * @since 1.0.0 |
| 74 | - * @var int | |
| 75 | 69 | */ |
| 76 | - public $error = 0; | |
| 70 | + public int $error = 0; | |
| 77 | 71 | |
| 78 | 72 | /** |
| 79 | 73 | * Detailed error information. |
| 80 | 74 | * |
| @@ -80,9 +74,9 @@ | ||
| 80 | 74 | * |
| 81 | 75 | * @since 1.0.0 |
| 82 | 76 | * @var array<string, array<string, int|string>> |
| 83 | 77 | */ |
| 84 | - public $error_info = array(); | |
| 78 | + public array $error_info = array(); | |
| 85 | 79 | |
| 86 | 80 | /** |
| 87 | 81 | * Class Constructor. |
| 88 | 82 | * |
| @@ -134,9 +128,9 @@ | ||
| 134 | 128 | $enclosed = ! $enclosed; // Flip bool. |
| 135 | 129 | } elseif ( $enclosed ) { |
| 136 | 130 | ++$i; // Skip next character. |
| 137 | 131 | } |
| 138 | - } elseif ( ( "\n" === $curr_char && "\r" !== $prev_char || "\r" === $curr_char ) && ! $enclosed ) { | |
| 132 | + } elseif ( ( ( "\n" === $curr_char && "\r" !== $prev_char ) || "\r" === $curr_char ) && ! $enclosed ) { | |
| 139 | 133 | // Reached end of a line. |
| 140 | 134 | ++$current_line; |
| 141 | 135 | if ( $current_line >= $this->delimiter_search_max_lines ) { |
| 142 | 136 | break; |