Skip to content

Commit

Permalink
Update php cs fixer, enable disabled rule (because of php7.4 compatib…
Browse files Browse the repository at this point in the history
…ility)
  • Loading branch information
jkniest committed Oct 21, 2023
1 parent eb618dc commit 59ede25
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
run: 'composer update -W --prefer-${{ matrix.composer-strategy }} --no-ansi --no-interaction --no-progress --optimize-autoloader'

- name: Run PHP CS fixer
run: 'PHP_CS_FIXER_IGNORE_ENV=True ./vendor/bin/php-cs-fixer check --config=.php-cs-fixer.php'
run: './vendor/bin/php-cs-fixer check --config=.php-cs-fixer.php'

phpstan:
name: PHPstan
Expand Down
8 changes: 1 addition & 7 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,4 @@
->ignoreDotFiles(true)
->ignoreVCS(true);

$config = jkniest\Linting\styles($finder);

$rules = array_merge($config->getRules(), [
'trailing_comma_in_multiline' => ['elements' => ['arrays', 'arguments']] // Until PHP 7.4 support is dropped
]);

return $config->setRules($rules);
return jkniest\Linting\styles($finder);
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"friends-of-phpspec/phpspec-code-coverage": "^6.0.0",
"phpunit/php-code-coverage": "^9.2.5|^10.0.2",
"jkniest/linting": ">=1.10.0",
"friendsofphp/php-cs-fixer": "3.34.1",
"friendsofphp/php-cs-fixer": "3.35.1",
"nikic/php-parser": "^4.13.2",
"webmozart/assert": "^1.11.0"
},
Expand All @@ -39,7 +39,7 @@
},
"scripts": {
"test": [
"PHP_CS_FIXER_IGNORE_ENV=True php-cs-fixer fix --config=.php-cs-fixer.php",
"php-cs-fixer fix --config=.php-cs-fixer.php",
"phpspec run --config phpspec_coverage.yml",
"@php test-coverage.php",
"phpstan analyse src --level=max"
Expand Down
4 changes: 2 additions & 2 deletions src/Cloud/CloudHueClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CloudHueClient implements PhillipsHueClient

public function __construct(
private ?string $username = null,
private ?string $accessToken = null
private ?string $accessToken = null,
) {
$this->client = HttpClient::createForBaseUri('https://api.meethue.com');
}
Expand Down Expand Up @@ -65,7 +65,7 @@ public function rawRequest(
string $method,
string $resource,
?array $body = null,
array $options = []
array $options = [],
): ResponseInterface {
return $this->client->request($method, "/{$resource}", array_merge([
'json' => $body,
Expand Down
2 changes: 1 addition & 1 deletion src/Cloud/HueClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class HueClient
{
public function __construct(
private string $clientId,
private string $clientSecret
private string $clientSecret,
) {}

public function getClientId(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Cloud/HueDevice.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class HueDevice
{
public function __construct(
private string $id,
private ?string $name = null
private ?string $name = null,
) {}

public function getId(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Cloud/HueTokens.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class HueTokens implements Arrayable
public function __construct(
private string $accessToken,
private string $refreshToken,
private PhillipsHueCloud $cloud
private PhillipsHueCloud $cloud,
) {}

public function getAccessToken(): string
Expand Down
2 changes: 1 addition & 1 deletion src/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class Group implements IsControllable
public function __construct(
private int $id,
array $rawData,
private PhillipsHueClient $client
private PhillipsHueClient $client,
) {
$this->mapData($rawData);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Light.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Light implements IsControllable
public function __construct(
private int $id,
array $rawData,
private PhillipsHueClient $client
private PhillipsHueClient $client,
) {
$this->mapData($rawData);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Local/LocalHueClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class LocalHueClient implements PhillipsHueClient

public function __construct(
private string $ip,
private ?string $username = null
private ?string $username = null,
) {
$this->client = HttpClient::createForBaseUri('http://'.$ip);
}
Expand Down
2 changes: 1 addition & 1 deletion src/PhillipsHueCloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PhillipsHueCloud extends PhillipsHueGateway
public function __construct(
private HueClient $connectionClient,
private HueDevice $device,
private string $appId
private string $appId,
) {
parent::__construct(new CloudHueClient());
}
Expand Down
2 changes: 1 addition & 1 deletion src/PhillipsHueConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class PhillipsHueConfig
private Collection $whitelist;

public function __construct(
private array $rawData
private array $rawData,
) {
$this->name = $this->rawData['name'];
$this->zigBeeChannel = $this->rawData['zigbeechannel'];
Expand Down
2 changes: 1 addition & 1 deletion src/PhillipsHueGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
abstract class PhillipsHueGateway
{
public function __construct(
protected PhillipsHueClient $client
protected PhillipsHueClient $client,
) {}

public function getConfig(): PhillipsHueConfig
Expand Down
2 changes: 1 addition & 1 deletion src/WhitelistDevice.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class WhitelistDevice

public function __construct(
private string $id,
array $rawData
array $rawData,
) {
$this->name = $rawData['name'];

Expand Down

0 comments on commit 59ede25

Please sign in to comment.