Skip to content

Commit 414d60d

Browse files
committed
style fixes
1 parent a426214 commit 414d60d

File tree

2 files changed

+23
-18
lines changed

2 files changed

+23
-18
lines changed

src/DataSources/CsvDataSource.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,16 @@ public function getNextLine()
8888
{
8989
$row = $this->nextRow;
9090
if ($row === null) {
91-
if (!$this->resource) $this->open();
92-
if ($this->isEof()) throw new \Exception("EOF");
91+
if (!$this->resource) {
92+
$this->open();
93+
}
94+
if ($this->isEof()) {
95+
throw new \Exception('EOF');
96+
}
9397
$row = $this->nextRow;
94-
if ($row === null) throw new \Exception("cannot get valid row, but isEof returns false");
98+
if ($row === null) {
99+
throw new \Exception('cannot get valid row, but isEof returns false');
100+
}
95101
}
96102
$this->nextRow = null;
97103
$colNum = 0;

tests/TableTest.php

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -345,18 +345,16 @@ public function testReadOptions()
345345

346346
public function testInvalidTabularData()
347347
{
348-
349348
$schema = new Schema((object) [
350-
"fields" => [
351-
(object) ["name" => "id", "type" => "integer"],
352-
(object) ["name" => "email", "type" => "string", "format" => "email"]
353-
]
349+
'fields' => [
350+
(object) ['name' => 'id', 'type' => 'integer'],
351+
(object) ['name' => 'email', 'type' => 'string', 'format' => 'email'],
352+
],
354353
]);
355354
$dataSource = new CsvDataSource($this->fixture('invalid_tabular_data.csv'));
356355
$table = new Table($dataSource, $schema);
357356
try {
358357
foreach ($table as $row) {
359-
360358
}
361359
$this->assertTrue(false);
362360
} catch (\Exception $e) {
@@ -378,35 +376,36 @@ public function testInvalidTabularData()
378376
}
379377
$this->assertEquals(
380378
['id' => '1', 'email' => 'good@email.and.nice'],
381-
$table->read(["cast" => false])[0]
379+
$table->read(['cast' => false])[0]
382380
);
383381
}
384382

385383
public function testEmailsTabularData()
386384
{
387385
$schema = new Schema((object) [
388-
"fields" => [
389-
(object) ["name" => "id", "type" => "integer"],
390-
(object) ["name" => "email", "type" => "string", "format" => "email"]
391-
]
386+
'fields' => [
387+
(object) ['name' => 'id', 'type' => 'integer'],
388+
(object) ['name' => 'email', 'type' => 'string', 'format' => 'email'],
389+
],
392390
]);
393391
$dataSource = new CsvDataSource($this->fixture('valid_emails_tabular_data.csv'));
394392
$table = new Table($dataSource, $schema);
395-
foreach ($table as $row) {}
393+
foreach ($table as $row) {
394+
}
396395
$dataSource = new CsvDataSource($this->fixture('valid_emails_tabular_data.csv'));
397396
$table = new Table($dataSource, $schema);
398397
$this->assertEquals(
399398
['id' => '1', 'email' => 'good@email.and.nice'],
400-
$table->read(["cast" => false])[0]
399+
$table->read(['cast' => false])[0]
401400
);
402401
}
403402

404403
public function testIterateWithoutEof()
405404
{
406405
$dataSource = new CsvDataSource($this->fixture('valid_emails_tabular_data.csv'));
407406
$row = $dataSource->getNextLine();
408-
$this->assertTrue($row["id"] === '1');
409-
$this->assertTrue($row["email"] === 'good@email.and.nice');
407+
$this->assertTrue($row['id'] === '1');
408+
$this->assertTrue($row['email'] === 'good@email.and.nice');
410409
}
411410

412411
protected $fixturesPath;

0 commit comments

Comments
 (0)