Skip to content

Commit c9f72c0

Browse files
authored
Enforce Symfony rule check (#223)
1 parent 9210914 commit c9f72c0

File tree

133 files changed

+1675
-1398
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+1675
-1398
lines changed

.php_cs.dist

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
<?php
2+
23
if (!file_exists(__DIR__.'/src')) {
34
exit(0);
45
}
6+
57
return PhpCsFixer\Config::create()
68
->setRules(
79
[
8-
'@PSR2' => true,
9-
'array_syntax' => ['syntax' => 'short'],
10-
'protected_to_private' => false
10+
'@PSR2' => true,
11+
'@Symfony' => true,
12+
'array_syntax' => ['syntax' => 'short'],
13+
'binary_operator_spaces' => ['default' => 'align'],
14+
'protected_to_private' => false,
1115
]
1216
)
1317
->setUsingCache(false)

src/BlockStorage/v2/Api.php

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace OpenStack\BlockStorage\v2;
46

@@ -8,7 +10,7 @@ class Api extends AbstractApi
810
{
911
public function __construct()
1012
{
11-
$this->params = new Params;
13+
$this->params = new Params();
1214
}
1315

1416
public function postVolumes(): array
@@ -37,9 +39,9 @@ public function getVolumes(): array
3739
'method' => 'GET',
3840
'path' => 'volumes',
3941
'params' => [
40-
'limit' => $this->params->limit(),
41-
'marker' => $this->params->marker(),
42-
'sort' => $this->params->sort(),
42+
'limit' => $this->params->limit(),
43+
'marker' => $this->params->marker(),
44+
'sort' => $this->params->sort(),
4345
'allTenants' => $this->params->allTenants(),
4446
],
4547
];
@@ -62,11 +64,11 @@ public function getVolumesDetail(): array
6264
public function getVolume(): array
6365
{
6466
return [
65-
'method' => 'GET',
66-
'path' => 'volumes/{id}',
67-
'params' => [
68-
'id' => $this->params->idPath()
69-
]
67+
'method' => 'GET',
68+
'path' => 'volumes/{id}',
69+
'params' => [
70+
'id' => $this->params->idPath(),
71+
],
7072
];
7173
}
7274

@@ -139,10 +141,10 @@ public function postTypes(): array
139141
public function putType(): array
140142
{
141143
return [
142-
'method' => 'PUT',
143-
'path' => 'types/{id}',
144+
'method' => 'PUT',
145+
'path' => 'types/{id}',
144146
'jsonKey' => 'volume_type',
145-
'params' => [
147+
'params' => [
146148
'id' => $this->params->idPath(),
147149
'name' => $this->params->name('volume type'),
148150
'specs' => $this->params->typeSpecs(),
@@ -171,10 +173,10 @@ public function deleteType(): array
171173
public function postSnapshots(): array
172174
{
173175
return [
174-
'method' => 'POST',
175-
'path' => 'snapshots',
176+
'method' => 'POST',
177+
'path' => 'snapshots',
176178
'jsonKey' => 'snapshot',
177-
'params' => [
179+
'params' => [
178180
'volumeId' => $this->params->volId(),
179181
'force' => $this->params->force(),
180182
'name' => $this->params->snapshotName(),
@@ -218,10 +220,10 @@ public function getSnapshot(): array
218220
public function putSnapshot(): array
219221
{
220222
return [
221-
'method' => 'PUT',
222-
'path' => 'snapshots/{id}',
223+
'method' => 'PUT',
224+
'path' => 'snapshots/{id}',
223225
'jsonKey' => 'snapshot',
224-
'params' => [
226+
'params' => [
225227
'id' => $this->params->idPath(),
226228
'name' => $this->params->snapshotName(),
227229
'description' => $this->params->desc(),
@@ -265,8 +267,8 @@ public function getQuotaSet(): array
265267
'method' => 'GET',
266268
'path' => 'os-quota-sets/{tenantId}',
267269
'params' => [
268-
'tenantId' => $this->params->idPath('quota-sets')
269-
]
270+
'tenantId' => $this->params->idPath('quota-sets'),
271+
],
270272
];
271273
}
272274

@@ -277,8 +279,8 @@ public function deleteQuotaSet(): array
277279
'path' => 'os-quota-sets/{tenantId}',
278280
'jsonKey' => 'quota_set',
279281
'params' => [
280-
'tenantId' => $this->params->idPath('quota-sets')
281-
]
282+
'tenantId' => $this->params->idPath('quota-sets'),
283+
],
282284
];
283285
}
284286

@@ -299,7 +301,7 @@ public function putQuotaSet(): array
299301
'snapshotsIscsi' => $this->params->quotaSetSnapshotsIscsi(),
300302
'volumes' => $this->params->quotaSetVolumes(),
301303
'volumesIscsi' => $this->params->quotaSetVolumesIscsi(),
302-
]
304+
],
303305
];
304306
}
305307
}

src/BlockStorage/v2/Models/QuotaSet.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace OpenStack\BlockStorage\v2\Models;
46

@@ -8,7 +10,7 @@
810
use OpenStack\Common\Resource\Updateable;
911

1012
/**
11-
* Represents a BlockStorage v2 Quota Set
13+
* Represents a BlockStorage v2 Quota Set.
1214
*
1315
* @property \OpenStack\BlockStorage\v2\Api $api
1416
*/
@@ -51,22 +53,22 @@ class QuotaSet extends OperatorResource implements Retrievable, Updateable, Dele
5153
'per_volume_gigabytes' => 'perVolumeGigabytes',
5254
'snapshots_iscsi' => 'snapshotsIscsi',
5355
'volumes_iscsi' => 'volumesIscsi',
54-
'id' => 'tenantId'
56+
'id' => 'tenantId',
5557
];
5658

5759
protected $resourceKey = 'quota_set';
5860

5961
/**
60-
* @inheritdoc
62+
* {@inheritdoc}
6163
*/
6264
public function retrieve()
6365
{
64-
$response = $this->execute($this->api->getQuotaSet(), ['tenantId' => (string)$this->tenantId]);
66+
$response = $this->execute($this->api->getQuotaSet(), ['tenantId' => (string) $this->tenantId]);
6567
$this->populateFromResponse($response);
6668
}
6769

6870
/**
69-
* @inheritdoc
71+
* {@inheritdoc}
7072
*/
7173
public function update()
7274
{
@@ -75,7 +77,7 @@ public function update()
7577
}
7678

7779
/**
78-
* @inheritdoc
80+
* {@inheritdoc}
7981
*/
8082
public function delete()
8183
{

src/BlockStorage/v2/Models/Snapshot.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace OpenStack\BlockStorage\v2\Models;
46

@@ -45,28 +47,29 @@ class Snapshot extends OperatorResource implements Listable, Creatable, Updateab
4547
/** @var int */
4648
public $size;
4749

48-
protected $resourceKey = 'snapshot';
50+
protected $resourceKey = 'snapshot';
4951
protected $resourcesKey = 'snapshots';
50-
protected $markerKey = 'id';
52+
protected $markerKey = 'id';
5153

5254
protected $aliases = [
53-
'volume_id' => 'volumeId',
55+
'volume_id' => 'volumeId',
5456
];
5557

5658
/**
57-
* @inheritdoc
59+
* {@inheritdoc}
5860
*/
5961
protected function getAliases(): array
6062
{
6163
return parent::getAliases() + [
62-
'created_at' => new Alias('createdAt', \DateTimeImmutable::class)
64+
'created_at' => new Alias('createdAt', \DateTimeImmutable::class),
6365
];
6466
}
6567

6668
public function populateFromResponse(ResponseInterface $response): self
6769
{
6870
parent::populateFromResponse($response);
6971
$this->metadata = $this->parseMetadata($response);
72+
7073
return $this;
7174
}
7275

@@ -84,6 +87,7 @@ public function retrieve()
8487
public function create(array $userOptions): Creatable
8588
{
8689
$response = $this->execute($this->api->postSnapshots(), $userOptions);
90+
8791
return $this->populateFromResponse($response);
8892
}
8993

@@ -99,8 +103,9 @@ public function delete()
99103

100104
public function getMetadata(): array
101105
{
102-
$response = $this->executeWithState($this->api->getSnapshotMetadata());
106+
$response = $this->executeWithState($this->api->getSnapshotMetadata());
103107
$this->metadata = $this->parseMetadata($response);
108+
104109
return $this->metadata;
105110
}
106111

@@ -120,6 +125,7 @@ public function resetMetadata(array $metadata)
120125
public function parseMetadata(ResponseInterface $response): array
121126
{
122127
$json = Utils::jsonDecode($response);
128+
123129
return isset($json['metadata']) ? $json['metadata'] : [];
124130
}
125131
}

src/BlockStorage/v2/Models/Volume.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
4+
25
namespace OpenStack\BlockStorage\v2\Models;
36

47
use OpenStack\Common\Resource\Alias;
@@ -65,9 +68,9 @@ class Volume extends OperatorResource implements Creatable, Listable, Updateable
6568
/** @var array */
6669
public $volumeImageMetadata = [];
6770

68-
protected $resourceKey = 'volume';
71+
protected $resourceKey = 'volume';
6972
protected $resourcesKey = 'volumes';
70-
protected $markerKey = 'id';
73+
protected $markerKey = 'id';
7174

7275
protected $aliases = [
7376
'availability_zone' => 'availabilityZone',
@@ -80,19 +83,20 @@ class Volume extends OperatorResource implements Creatable, Listable, Updateable
8083
];
8184

8285
/**
83-
* @inheritdoc
86+
* {@inheritdoc}
8487
*/
8588
protected function getAliases(): array
8689
{
8790
return parent::getAliases() + [
88-
'created_at' => new Alias('createdAt', \DateTimeImmutable::class)
91+
'created_at' => new Alias('createdAt', \DateTimeImmutable::class),
8992
];
9093
}
9194

9295
public function populateFromResponse(ResponseInterface $response): self
9396
{
9497
parent::populateFromResponse($response);
9598
$this->metadata = $this->parseMetadata($response);
99+
96100
return $this;
97101
}
98102

@@ -110,6 +114,7 @@ public function retrieve()
110114
public function create(array $userOptions): Creatable
111115
{
112116
$response = $this->execute($this->api->postVolumes(), $userOptions);
117+
113118
return $this->populateFromResponse($response);
114119
}
115120

@@ -126,8 +131,9 @@ public function delete()
126131

127132
public function getMetadata(): array
128133
{
129-
$response = $this->executeWithState($this->api->getVolumeMetadata());
134+
$response = $this->executeWithState($this->api->getVolumeMetadata());
130135
$this->metadata = $this->parseMetadata($response);
136+
131137
return $this->metadata;
132138
}
133139

@@ -147,6 +153,7 @@ public function resetMetadata(array $metadata)
147153
public function parseMetadata(ResponseInterface $response): array
148154
{
149155
$json = Utils::jsonDecode($response);
156+
150157
return isset($json['metadata']) ? $json['metadata'] : [];
151158
}
152159
}

src/BlockStorage/v2/Models/VolumeAttachment.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
4+
25
namespace OpenStack\BlockStorage\v2\Models;
36

47
use OpenStack\Common\Resource\Listable;
@@ -21,6 +24,6 @@ class VolumeAttachment extends OperatorResource implements Listable
2124
/** @var string */
2225
public $volumeId;
2326

24-
protected $resourceKey = 'volumeAttachment';
27+
protected $resourceKey = 'volumeAttachment';
2528
protected $resourcesKey = 'volumeAttachments';
2629
}

src/BlockStorage/v2/Models/VolumeType.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
<?php declare(strict_types=1);
1+
<?php
2+
3+
declare(strict_types=1);
24

35
namespace OpenStack\BlockStorage\v2\Models;
46

@@ -30,6 +32,7 @@ class VolumeType extends OperatorResource implements Listable, Creatable, Update
3032
public function create(array $userOptions): Creatable
3133
{
3234
$response = $this->execute($this->api->postTypes(), $userOptions);
35+
3336
return $this->populateFromResponse($response);
3437
}
3538

0 commit comments

Comments
 (0)