Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5932390

Browse files
committed
style:#43 Slevomat
1 parente4622cd commit5932390

25 files changed

+266
-24
lines changed

‎composer.json‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"mockery/mockery":"^1.4",
1414
"phpmd/phpmd":"^2.10",
1515
"phpunit/phpunit":"^9.5",
16+
"slevomat/coding-standard":"^7.0",
1617
"squizlabs/php_codesniffer":"^3.6"
1718
},
1819
"license":"Apache-2.0",
@@ -25,6 +26,13 @@
2526
"scripts": {
2627
"post-install-cmd": [
2728
"php -r\"if (is_dir('.git/hooks/')) {copy('.git-pre-commit', '.git/hooks/pre-commit'); chmod('.git/hooks/pre-commit', 0755);}\""
28-
]
29+
],
30+
"lint":"phpcs --standard=phpcs.xml .",
31+
"lint-fix":"phpcbf --standard=phpcs.xml ."
32+
},
33+
"config": {
34+
"allow-plugins": {
35+
"dealerdirect/phpcodesniffer-composer-installer":true
36+
}
2937
}
3038
}

‎composer.lock-php8.0‎

Lines changed: 182 additions & 2 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎lang/en/validation.php‎

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

3+
declare(strict_types=1);
4+
35
return [
46

57
/*

‎phpcs.xml‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
11
<?xml version="1.0"?>
2-
<rulesetname="PSR12-FOO">
3-
<description>The PSR12 standard.</description>
2+
<rulesetname="PSR12-Slevomat">
43
<exclude-pattern>/vendor/</exclude-pattern>
54
<argname="extensions"value="php" />
65

76
<!-- Include the whole PSR12 standard-->
8-
<ruleref="PSR12"/>
7+
<ruleref="PSR12" />
8+
9+
<configname="installed_paths"value="../../slevomat/coding-standard" />
10+
<ruleref="SlevomatCodingStandard.ControlStructures.DisallowYodaComparison" />
11+
<ruleref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes">
12+
<properties>
13+
<propertyname="declareOnFirstLine"value="false" />
14+
<propertyname="linesCountBeforeDeclare"value="1" />
15+
<propertyname="linesCountAfterDeclare"value="1" />
16+
<propertyname="spacesCountAroundEqualsSign"value="0" />
17+
</properties>
18+
</rule>
919
</ruleset>

‎src/Base.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespaceCoding;
46

57
useCoding\Exceptions\ValidationException;
@@ -14,7 +16,7 @@ public function __construct(Client $client = null)
1416
$this->client =$client ??newClient();
1517
}
1618

17-
protectedfunctionvalidate(array$data,array$rules)
19+
protectedfunctionvalidate(array$data,array$rules):void
1820
{
1921
$validator = Validator::getInstance()->make($data,$rules);
2022
if ($validator->fails()) {

‎src/Client.php‎

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

3+
declare(strict_types=1);
4+
35
namespaceCoding;
46

57
useCoding\Exceptions\ApiError;
@@ -34,14 +36,14 @@ public function setHttpClient(ClientInterface $http): void
3436

3537
publicfunctiongetHttpClient():ClientInterface
3638
{
37-
if (null ===$this->http) {
39+
if (is_null($this->http)) {
3840
$this->http =newGuzzleClient();
3941
}
4042

4143
return$this->http;
4244
}
4345

44-
publicfunctionrequest(string$action,array$data)
46+
publicfunctionrequest(string$action,array$data):array
4547
{
4648
$params = ['Action' =>$action];
4749
$response =$this->getHttpClient()->request('POST',$this->config['api_url'], [
@@ -52,14 +54,14 @@ public function request(string $action, array $data)
5254
],
5355
'json' =>array_merge($params,$data),
5456
]);
55-
$result =json_decode($response->getBody(),true);
57+
$result =json_decode($response->getBody()->getContents(),true);
5658
if (isset($result['Response']['Error']['Message'])) {
5759
thrownewApiError($result['Response']['Error']['Message']);
5860
}
5961
return$result['Response'];
6062
}
6163

62-
publicfunctionrequestProjectApi(string$action,array$data = [])
64+
publicfunctionrequestProjectApi(string$action,array$data = []):array
6365
{
6466
if (empty($this->config['project_name'])) {
6567
thrownewValidationException('Need set project name first.');
@@ -68,22 +70,22 @@ public function requestProjectApi(string $action, array $data = [])
6870
return$this->request($action,$data);
6971
}
7072

71-
publicfunctionsetPersonalToken(string$token)
73+
publicfunctionsetPersonalToken(string$token):void
7274
{
7375
$this->config['personal_token'] =$token;
7476
}
7577

76-
publicfunctionsetProjectName(string$projectName)
78+
publicfunctionsetProjectName(string$projectName):void
7779
{
7880
$this->config['project_name'] =$projectName;
7981
}
8082

81-
publicfunctionsetProjectToken(string$token)
83+
publicfunctionsetProjectToken(string$token):void
8284
{
8385
$this->config['project_token'] =$token;
8486
}
8587

86-
privatefunctiongetToken()
88+
privatefunctiongetToken():string
8789
{
8890
if ($this->usePersonalToken) {
8991
if (empty($this->config['personal_token'])) {

‎src/Exceptions/ApiError.php‎

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

3+
declare(strict_types=1);
4+
35
namespaceCoding\Exceptions;
46

57
useException;

‎src/Exceptions/ValidationException.php‎

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

3+
declare(strict_types=1);
4+
35
namespaceCoding\Exceptions;
46

57
useException;

‎src/GitBranch.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespaceCoding;
46

57
useIlluminate\Validation\Rule;
68

79
class GitBranchextends Base
810
{
9-
publicfunctionindex(array$data)
11+
publicfunctionindex(array$data):array
1012
{
1113
$this->validate($data, [
1214
'DepotId' =>'integer|required',

‎src/Handlers/Validator.php‎

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

3+
declare(strict_types=1);
4+
35
namespaceCoding\Handlers;
46

57
useIlluminate\Filesystem\Filesystem;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp