Skip to content

Commit 776b261

Browse files
committed
run php-cs-fix against the changes on 1.x branch
1 parent 129f43f commit 776b261

File tree

14 files changed

+86
-98
lines changed

14 files changed

+86
-98
lines changed

spec/Gaufrette/Adapter/AzureBlobStorageSpec.php

+23-23
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,33 @@
1919

2020
class AzureBlobStorageSpec extends ObjectBehavior
2121
{
22-
public function let(BlobProxyFactoryInterface $blobFactory)
22+
function let(BlobProxyFactoryInterface $blobFactory)
2323
{
2424
$this->beConstructedWith($blobFactory, 'containerName');
2525
}
2626

27-
public function it_should_be_initializable()
27+
function it_should_be_initializable()
2828
{
2929
$this->shouldHaveType('Gaufrette\Adapter\AzureBlobStorage');
3030
$this->shouldHaveType('Gaufrette\Adapter');
3131
$this->shouldHaveType('Gaufrette\Adapter\MetadataSupporter');
3232
}
3333

34-
public function it_reads_file(BlobProxyFactoryInterface $blobFactory, IBlob $blob, GetBlobResult $blobContent)
34+
function it_reads_file(BlobProxyFactoryInterface $blobFactory, IBlob $blob, GetBlobResult $blobContent)
3535
{
3636
$blobFactory->create()->willReturn($blob);
3737

3838
$blob->getBlob('containerName', 'filename')->willReturn($blobContent);
3939
$blobContent
4040
->getContentStream()
4141
//azure blob content is handled as stream so we need to fake it
42-
->willReturn(fopen('data://text/plain,some content','r'))
42+
->willReturn(fopen('data://text/plain,some content', 'r'))
4343
;
4444

4545
$this->read('filename')->shouldReturn('some content');
4646
}
4747

48-
public function it_throws_storage_failure_if_it_fails_to_read_file(
48+
function it_throws_storage_failure_if_it_fails_to_read_file(
4949
BlobProxyFactoryInterface $blobFactory,
5050
IBlob $blob,
5151
ServiceException $azureException,
@@ -60,7 +60,7 @@ public function it_throws_storage_failure_if_it_fails_to_read_file(
6060
$this->shouldThrow(StorageFailure::class)->duringRead('filename');
6161
}
6262

63-
public function it_throws_file_not_found_if_read_file_does_not_exist(
63+
function it_throws_file_not_found_if_read_file_does_not_exist(
6464
BlobProxyFactoryInterface $blobFactory,
6565
IBlob $blob,
6666
ServiceException $azureException,
@@ -75,7 +75,7 @@ public function it_throws_file_not_found_if_read_file_does_not_exist(
7575
$this->shouldThrow(FileNotFound::class)->duringRead('filename');
7676
}
7777

78-
public function it_renames_file(BlobProxyFactoryInterface $blobFactory, IBlob $blob)
78+
function it_renames_file(BlobProxyFactoryInterface $blobFactory, IBlob $blob)
7979
{
8080
$blobFactory->create()->willReturn($blob);
8181

@@ -85,7 +85,7 @@ public function it_renames_file(BlobProxyFactoryInterface $blobFactory, IBlob $b
8585
$this->shouldNotThrow(\Exception::class)->duringRename('filename1', 'filename2');
8686
}
8787

88-
public function it_throws_storage_failure_when_rename_fail(
88+
function it_throws_storage_failure_when_rename_fail(
8989
BlobProxyFactoryInterface $blobFactory,
9090
IBlob $blob,
9191
ServiceException $azureException,
@@ -103,7 +103,7 @@ public function it_throws_storage_failure_when_rename_fail(
103103
$this->shouldThrow(StorageFailure::class)->duringRename('filename1', 'filename2');
104104
}
105105

106-
public function it_throws_file_not_found_when_renamed_file_does_not_exist(
106+
function it_throws_file_not_found_when_renamed_file_does_not_exist(
107107
BlobProxyFactoryInterface $blobFactory,
108108
IBlob $blob,
109109
ServiceException $azureException,
@@ -121,7 +121,7 @@ public function it_throws_file_not_found_when_renamed_file_does_not_exist(
121121
$this->shouldThrow(FileNotFound::class)->duringRename('filename1', 'filename2');
122122
}
123123

124-
public function it_writes_file(BlobProxyFactoryInterface $blobFactory, IBlob $blob)
124+
function it_writes_file(BlobProxyFactoryInterface $blobFactory, IBlob $blob)
125125
{
126126
$blobFactory->create()->willReturn($blob);
127127

@@ -133,7 +133,7 @@ public function it_writes_file(BlobProxyFactoryInterface $blobFactory, IBlob $bl
133133
$this->shouldNotThrow(StorageFailure::class)->duringWrite('filename', 'some content');
134134
}
135135

136-
public function it_throws_storage_failure_when_write_fail(
136+
function it_throws_storage_failure_when_write_fail(
137137
BlobProxyFactoryInterface $blobFactory,
138138
IBlob $blob,
139139
ServiceException $azureException,
@@ -150,7 +150,7 @@ public function it_throws_storage_failure_when_write_fail(
150150
$this->shouldThrow(StorageFailure::class)->duringWrite('filename', 'some content');
151151
}
152152

153-
public function it_checks_if_file_exists(
153+
function it_checks_if_file_exists(
154154
BlobProxyFactoryInterface $blobFactory,
155155
IBlob $blob,
156156
GetBlobResult $blobContent,
@@ -168,7 +168,7 @@ public function it_checks_if_file_exists(
168168
$this->exists('filename2')->shouldReturn(true);
169169
}
170170

171-
public function it_throws_storage_failure_when_it_fails_to_assert_if_a_file_exists(
171+
function it_throws_storage_failure_when_it_fails_to_assert_if_a_file_exists(
172172
BlobProxyFactoryInterface $blobFactory,
173173
IBlob $blob,
174174
ServiceException $azureException,
@@ -186,7 +186,7 @@ public function it_throws_storage_failure_when_it_fails_to_assert_if_a_file_exis
186186
$this->shouldThrow(StorageFailure::class)->duringExists('filename');
187187
}
188188

189-
public function it_gets_file_mtime(
189+
function it_gets_file_mtime(
190190
BlobProxyFactoryInterface $blobFactory,
191191
IBlob $blob,
192192
GetBlobPropertiesResult $blobPropertiesResult,
@@ -201,7 +201,7 @@ public function it_gets_file_mtime(
201201
$this->mtime('filename')->shouldReturn(strtotime('1987-12-28 20:00:00'));
202202
}
203203

204-
public function it_throws_storage_failure_when_it_fails_to_get_file_mtime(
204+
function it_throws_storage_failure_when_it_fails_to_get_file_mtime(
205205
BlobProxyFactoryInterface $blobFactory,
206206
IBlob $blob,
207207
ServiceException $azureException,
@@ -216,7 +216,7 @@ public function it_throws_storage_failure_when_it_fails_to_get_file_mtime(
216216
$this->shouldThrow(StorageFailure::class)->duringMtime('filename');
217217
}
218218

219-
public function it_throws_file_not_found_when_it_fails_to_get_file_mtime(
219+
function it_throws_file_not_found_when_it_fails_to_get_file_mtime(
220220
BlobProxyFactoryInterface $blobFactory,
221221
IBlob $blob,
222222
ServiceException $azureException,
@@ -231,7 +231,7 @@ public function it_throws_file_not_found_when_it_fails_to_get_file_mtime(
231231
$this->shouldThrow(FileNotFound::class)->duringMtime('filename');
232232
}
233233

234-
public function it_deletes_file(BlobProxyFactoryInterface $blobFactory, IBlob $blob)
234+
function it_deletes_file(BlobProxyFactoryInterface $blobFactory, IBlob $blob)
235235
{
236236
$blobFactory->create()->willReturn($blob);
237237

@@ -240,7 +240,7 @@ public function it_deletes_file(BlobProxyFactoryInterface $blobFactory, IBlob $b
240240
$this->shouldNotThrow(StorageFailure::class)->duringDelete('filename');
241241
}
242242

243-
public function it_throws_storage_failure_when_it_fails_to_delete_file(
243+
function it_throws_storage_failure_when_it_fails_to_delete_file(
244244
BlobProxyFactoryInterface $blobFactory,
245245
IBlob $blob,
246246
ServiceException $azureException,
@@ -255,7 +255,7 @@ public function it_throws_storage_failure_when_it_fails_to_delete_file(
255255
$this->shouldThrow(StorageFailure::class)->duringDelete('filename');
256256
}
257257

258-
public function it_throws_file_not_found_when_it_fails_to_delete_file(
258+
function it_throws_file_not_found_when_it_fails_to_delete_file(
259259
BlobProxyFactoryInterface $blobFactory,
260260
IBlob $blob,
261261
ServiceException $azureException,
@@ -270,7 +270,7 @@ public function it_throws_file_not_found_when_it_fails_to_delete_file(
270270
$this->shouldThrow(FileNotFound::class)->duringDelete('filename');
271271
}
272272

273-
public function it_should_get_keys(
273+
function it_should_get_keys(
274274
BlobProxyFactoryInterface $blobFactory,
275275
IBlob $blob,
276276
Blob $blobFooBar,
@@ -288,7 +288,7 @@ public function it_should_get_keys(
288288
$this->keys()->shouldReturn(['foo/bar', 'baz']);
289289
}
290290

291-
public function it_throws_storage_failure_when_it_fails_to_get_keys(
291+
function it_throws_storage_failure_when_it_fails_to_get_keys(
292292
BlobProxyFactoryInterface $blobFactory,
293293
IBlob $blob,
294294
ServiceException $azureException,
@@ -303,7 +303,7 @@ public function it_throws_storage_failure_when_it_fails_to_get_keys(
303303
$this->shouldThrow(StorageFailure::class)->duringKeys();
304304
}
305305

306-
public function it_creates_container(BlobProxyFactoryInterface $blobFactory, IBlob $blob)
306+
function it_creates_container(BlobProxyFactoryInterface $blobFactory, IBlob $blob)
307307
{
308308
$blobFactory->create()->willReturn($blob);
309309

@@ -312,7 +312,7 @@ public function it_creates_container(BlobProxyFactoryInterface $blobFactory, IBl
312312
$this->createContainer('containerName');
313313
}
314314

315-
public function it_throws_storage_failure_when_it_fails_to_create_container(
315+
function it_throws_storage_failure_when_it_fails_to_create_container(
316316
BlobProxyFactoryInterface $blobFactory,
317317
IBlob $blob,
318318
ServiceException $azureException,

spec/Gaufrette/Adapter/InMemorySpec.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ class InMemorySpec extends ObjectBehavior
1010
function let()
1111
{
1212
$this->beConstructedWith([
13-
'filename' => ['mtime' => 12345, 'content' => 'content'],
14-
'filename2' => 'other content'
13+
'filename' => ['mtime' => 12345, 'content' => 'content'],
14+
'filename2' => 'other content',
1515
]);
1616
}
1717

@@ -42,10 +42,10 @@ function it_writes_file()
4242

4343
function it_renames_file()
4444
{
45-
$this->rename('filename', 'aaa/filename2');
45+
$this->rename('filename', 'aaa/filename2');
4646

47-
$this->exists('filename')->shouldReturn(false);
48-
$this->exists('aaa/filename2')->shouldReturn(true);
47+
$this->exists('filename')->shouldReturn(false);
48+
$this->exists('aaa/filename2')->shouldReturn(true);
4949
}
5050

5151
function it_checks_if_file_exists()

src/Gaufrette/Adapter/AwsS3.php

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Aws\S3\S3Client;
88
use Gaufrette\Exception\FileNotFound;
99
use Gaufrette\Exception\StorageFailure;
10-
use Gaufrette\Util;
1110

1211
/**
1312
* Amazon S3 adapter using the AWS SDK for PHP v2.x.

src/Gaufrette/Adapter/DoctrineDbal.php

+17-17
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,19 @@ class DoctrineDbal implements Adapter, ChecksumCalculator, ListKeysAware
1919
{
2020
protected $connection;
2121
protected $table;
22-
protected $columns = array(
22+
protected $columns = [
2323
'key' => 'key',
2424
'content' => 'content',
2525
'mtime' => 'mtime',
2626
'checksum' => 'checksum',
27-
);
27+
];
2828

2929
/**
3030
* @param Connection $connection The DBAL connection
3131
* @param string $table The files table
3232
* @param array $columns The column names
3333
*/
34-
public function __construct(Connection $connection, $table, array $columns = array())
34+
public function __construct(Connection $connection, $table, array $columns = [])
3535
{
3636
$this->connection = $connection;
3737
$this->table = $table;
@@ -64,8 +64,8 @@ public function rename($sourceKey, $targetKey)
6464
try {
6565
$updated = $this->connection->update(
6666
$this->table,
67-
array($this->getQuotedColumn('key') => $targetKey),
68-
array($this->getQuotedColumn('key') => $sourceKey)
67+
[$this->getQuotedColumn('key') => $targetKey],
68+
[$this->getQuotedColumn('key') => $sourceKey]
6969
);
7070
} catch (\Exception $e) {
7171
throw StorageFailure::unexpectedFailure('rename', [
@@ -128,7 +128,7 @@ public function exists($key)
128128
$this->getQuotedTable(),
129129
$this->getQuotedColumn('key')
130130
),
131-
array('key' => $key)
131+
['key' => $key]
132132
);
133133
} catch (\Exception $e) {
134134
throw StorageFailure::unexpectedFailure('exists', ['key' => $key], $e);
@@ -161,7 +161,7 @@ public function delete($key)
161161
try {
162162
$deleted = $this->connection->delete(
163163
$this->table,
164-
array($this->getQuotedColumn('key') => $key)
164+
[$this->getQuotedColumn('key') => $key]
165165
);
166166
} catch (\Exception $e) {
167167
throw StorageFailure::unexpectedFailure('delete', ['key' => $key], $e);
@@ -177,11 +177,11 @@ public function delete($key)
177177
*/
178178
public function write($key, $content)
179179
{
180-
$values = array(
180+
$values = [
181181
$this->getQuotedColumn('content') => $content,
182182
$this->getQuotedColumn('mtime') => time(),
183183
$this->getQuotedColumn('checksum') => Util\Checksum::fromContent($content),
184-
);
184+
];
185185

186186
try {
187187
$this->upsert($key, $values);
@@ -200,7 +200,7 @@ private function upsert($key, array $values)
200200
$this->connection->update(
201201
$this->table,
202202
$values,
203-
array($this->getQuotedColumn('key') => $key)
203+
[$this->getQuotedColumn('key') => $key]
204204
);
205205
} else {
206206
$values[$this->getQuotedColumn('key')] = $key;
@@ -227,7 +227,7 @@ private function getColumnValue($key, $column)
227227
$this->getQuotedTable(),
228228
$this->getQuotedColumn('key')
229229
),
230-
array('key' => $key)
230+
['key' => $key]
231231
);
232232

233233
return $value;
@@ -247,16 +247,16 @@ public function listKeys($prefix = '')
247247
$this->getQuotedTable(),
248248
$this->getQuotedColumn('key')
249249
),
250-
array('pattern' => sprintf('%s%%', $prefix))
250+
['pattern' => sprintf('%s%%', $prefix)]
251251
);
252252

253-
return array(
254-
'dirs' => array(),
253+
return [
254+
'dirs' => [],
255255
'keys' => array_map(function ($value) {
256-
return $value['_key'];
257-
},
256+
return $value['_key'];
257+
},
258258
$keys),
259-
);
259+
];
260260
}
261261

262262
private function getQuotedTable()

src/Gaufrette/Adapter/Ftp.php

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ public function write($key, $content)
9090

9191
if (!ftp_fput($this->getConnection(), $path, $temp, $this->mode)) {
9292
fclose($temp);
93+
9394
throw StorageFailure::unexpectedFailure('write', ['key' => $this->computePath($key)]);
9495
}
9596

0 commit comments

Comments
 (0)