Skip to content

Commit c91f16d

Browse files
committed
Fix code style
1 parent 31908df commit c91f16d

File tree

4 files changed

+33
-16
lines changed

4 files changed

+33
-16
lines changed

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
"@analyse",
5252
"@test"
5353
],
54-
"cs": "php-cs-fixer fix src -v --diff --dry-run",
55-
"cs-fix": "php-cs-fixer fix src -v --diff",
54+
"cs": "php-cs-fixer fix -v --diff --dry-run",
55+
"cs-fix": "php-cs-fixer fix -v --diff",
5656
"test": "vendor/bin/phpunit",
5757
"analyse": "php vendor/bin/phpstan.phar analyse --no-interaction"
5858
},

tests/Shorthand/ShorthandTest.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
<?php
2+
3+
/**
4+
* @see https://github.com/open-code-modeling/json-schema-to-php for the canonical source repository
5+
* @copyright https://github.com/open-code-modeling/json-schema-to-php/blob/master/COPYRIGHT.md
6+
* @license https://github.com/open-code-modeling/json-schema-to-php/blob/master/LICENSE.md MIT License
7+
*/
8+
29
declare(strict_types=1);
310

411
namespace OpenCodeModelingTest\JsonSchemaToPhp\Shorthand;
@@ -31,7 +38,7 @@ public function it_converts_enum_shorthand_to_json_schema_string(): void
3138
$schema = Shorthand::convertToJsonSchema(['test' => 'enum|available|blocked|bought']);
3239

3340
$this->assertEquals($this->jsonSchemaObject(
34-
['test' => ['enum' => ["available", "blocked", "bought"]]],
41+
['test' => ['enum' => ['available', 'blocked', 'bought']]],
3542
['test']
3643
), $schema);
3744
}
@@ -117,7 +124,7 @@ public function it_parses_shorthand_validation_and_adds_it_to_json_schema(): voi
117124
'test2' => 'number|minimum:0.5|maximum:10',
118125
'test3' => 'string|null|format:email',
119126
'test4' => 'boolean|default:false',
120-
'test5' => 'boolean|null|default:true'
127+
'test5' => 'boolean|null|default:true',
121128
]);
122129

123130
$this->assertEquals($this->jsonSchemaObject(
@@ -178,7 +185,7 @@ public function it_converts_shorthand_object_to_json_schema_object(): void
178185
'searchProfile?' => [
179186
'roomsMin' => 'number|null|minimum:0.5',
180187
'roomsMax' => 'number|null|minimum:0.5',
181-
]
188+
],
182189
]);
183190

184191
$this->assertEquals(
@@ -194,7 +201,7 @@ public function it_converts_shorthand_object_to_json_schema_object(): void
194201
'searchProfile' => $this->jsonSchemaObject([
195202
'roomsMin' => ['type' => ['number', 'null'], 'minimum' => 0.5],
196203
'roomsMax' => ['type' => ['number', 'null'], 'minimum' => 0.5],
197-
], ['roomsMin', 'roomsMax'])
204+
], ['roomsMin', 'roomsMax']),
198205
], ['name', 'email', 'address', 'tags'], 'Prospect'),
199206
$schema
200207
);
@@ -212,10 +219,10 @@ private function jsonSchemaObject(array $properties, array $required = [], strin
212219
'type' => 'object',
213220
'properties' => $properties,
214221
'additionalProperties' => false,
215-
'required' => $required
222+
'required' => $required,
216223
];
217224

218-
if($title) {
225+
if ($title) {
219226
$obj['title'] = $title;
220227
}
221228

tests/Type/ArrayTypeTest.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<?php
22

3+
/**
4+
* @see https://github.com/open-code-modeling/json-schema-to-php for the canonical source repository
5+
* @copyright https://github.com/open-code-modeling/json-schema-to-php/blob/master/COPYRIGHT.md
6+
* @license https://github.com/open-code-modeling/json-schema-to-php/blob/master/LICENSE.md MIT License
7+
*/
8+
39
declare(strict_types=1);
410

511
namespace OpenCodeModelingTest\JsonSchemaToPhp\Type;
@@ -20,7 +26,7 @@ final class ArrayTypeTest extends TestCase
2026
*/
2127
public function it_supports_array_type(): void
2228
{
23-
$json = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'schema_with_array.json');
29+
$json = \file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'schema_with_array.json');
2430
$decodedJson = \json_decode($json, true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR);
2531

2632
$typeSet = Type::fromDefinition($decodedJson);
@@ -48,7 +54,7 @@ public function it_supports_array_type(): void
4854
*/
4955
public function it_supports_array_with_one_type(): void
5056
{
51-
$json = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'schema_with_array_one_type.json');
57+
$json = \file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'schema_with_array_one_type.json');
5258
$decodedJson = \json_decode($json, true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR);
5359

5460
$typeSet = Type::fromDefinition($decodedJson);
@@ -71,7 +77,7 @@ public function it_supports_array_with_one_type(): void
7177
*/
7278
public function it_supports_array_with_one_type_ref(): void
7379
{
74-
$json = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'schema_with_array_one_type_ref.json');
80+
$json = \file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'schema_with_array_one_type_ref.json');
7581
$decodedJson = \json_decode($json, true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR);
7682

7783
$typeSet = Type::fromDefinition($decodedJson);
@@ -102,7 +108,7 @@ public function it_supports_array_with_one_type_ref(): void
102108
*/
103109
public function it_supports_array_shorthand_with_no_ref(): void
104110
{
105-
$json = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'schema_with_array_shorthand_no_ref.json');
111+
$json = \file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'schema_with_array_shorthand_no_ref.json');
106112
$decodedJson = \json_decode($json, true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR);
107113

108114
$typeSet = Type::fromShorthand($decodedJson);
@@ -191,7 +197,5 @@ private function assertItemFour(TypeSet $itemFour): void
191197
$itemFourType = $itemFour->first();
192198
$this->assertInstanceOf(StringType::class, $itemFourType);
193199
$this->assertCount(4, $itemFourType->enum());
194-
195200
}
196-
197201
}

tests/Type/ObjectTypeTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
<?php
22

3+
/**
4+
* @see https://github.com/open-code-modeling/json-schema-to-php for the canonical source repository
5+
* @copyright https://github.com/open-code-modeling/json-schema-to-php/blob/master/COPYRIGHT.md
6+
* @license https://github.com/open-code-modeling/json-schema-to-php/blob/master/LICENSE.md MIT License
7+
*/
8+
39
declare(strict_types=1);
410

511
namespace OpenCodeModelingTest\JsonSchemaToPhp\Type;
@@ -18,7 +24,7 @@ final class ObjectTypeTest extends TestCase
1824
*/
1925
public function it_supports_object_type(): void
2026
{
21-
$json = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'schema_with_object.json');
27+
$json = \file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'schema_with_object.json');
2228
$decodedJson = \json_decode($json, true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR);
2329

2430
$typeSet = Type::fromDefinition($decodedJson);
@@ -79,7 +85,7 @@ public function it_supports_object_type(): void
7985
*/
8086
public function it_supports_definition_of_objects(): void
8187
{
82-
$json = file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'schema_with_objects.json');
88+
$json = \file_get_contents(__DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'schema_with_objects.json');
8389
$decodedJson = \json_decode($json, true, 512, \JSON_BIGINT_AS_STRING | \JSON_THROW_ON_ERROR);
8490

8591
$typeSet = Type::fromDefinition($decodedJson);

0 commit comments

Comments
 (0)