Skip to content

Commit

Permalink
fix rector parallel process error and strict types declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
mattvb91 committed Feb 4, 2024
1 parent a443040 commit 9393209
Show file tree
Hide file tree
Showing 61 changed files with 143 additions and 12 deletions.
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"phpstan": "phpstan analyse",
"codesniffer": "phpcs ./src ./tests/**/*.php --standard=./codesniffer.xml -p",
"codefixer": "phpcbf ./src ./tests/**/*.php --standard=./codesniffer.xml",
"rector": "rector --dry-run",
"rector-fix": "rector"
"rector": "rector process --dry-run",
"rector-fix": "rector process"
},
"autoload": {
"psr-4": {
Expand All @@ -33,6 +33,6 @@
"dms/phpunit-arraysubset-asserts": "^0.4.0",
"phpstan/phpstan": "^1.10",
"squizlabs/php_codesniffer": "^3.7",
"rector/rector": "^0.18.13"
"rector/rector": "^0.17"
}
}
17 changes: 10 additions & 7 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,23 @@

use Rector\CodeQuality\Rector\Class_\InlineConstructorDefaultToPropertyRector;
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\StmtsAwareInterface\DeclareStrictTypesRector;

return static function (RectorConfig $rectorConfig): void {

$rectorConfig->paths([
__DIR__ . '/src',
]);

// register a single rule
$rectorConfig->rule(InlineConstructorDefaultToPropertyRector::class);
$rectorConfig->rules([
InlineConstructorDefaultToPropertyRector::class,
DeclareStrictTypesRector::class,
]);

// define sets of rules
$rectorConfig->sets([
\Rector\Set\ValueObject\SetList::DEAD_CODE,
\Rector\Set\ValueObject\SetList::CODE_QUALITY,
\Rector\Set\ValueObject\SetList::TYPE_DECLARATION,
]);
$rectorConfig->sets([
\Rector\Set\ValueObject\SetList::DEAD_CODE,
\Rector\Set\ValueObject\SetList::CODE_QUALITY,
\Rector\Set\ValueObject\SetList::TYPE_DECLARATION,
]);
};
16 changes: 14 additions & 2 deletions src/Caddy.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp;

use GuzzleHttp\Client;
Expand Down Expand Up @@ -72,7 +74,12 @@ public function syncHosts(string $hostIdentifier): void
$this->buildHostsCache($hostIdentifier);

/** @var string[] $hosts */
$hosts = json_decode($this->client->get($this->hostsCache[$hostIdentifier]['path'])->getBody(), true);
$hosts = json_decode(
$this->client->get($this->hostsCache[$hostIdentifier]['path'])
->getBody()
->getContents(),
true
);

$this->hostsCache[$hostIdentifier]['host']->setHosts($hosts);
}
Expand Down Expand Up @@ -129,7 +136,12 @@ public function removeHostname(string $hostIdentifier, string $hostname): bool
public function getRemoteConfig(): object
{
/** @var object */
return json_decode($this->client->get('/config')->getBody(), false, 512, JSON_THROW_ON_ERROR);
return json_decode(
$this->client->get('/config')->getBody()->getContents(),
false,
512,
JSON_THROW_ON_ERROR
);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Admin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config;

use mattvb91\CaddyPhp\Interfaces\Arrayable;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Cache.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps;

use mattvb91\CaddyPhp\Config\Apps\Cache\Api;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Cache/Api.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Cache;

use mattvb91\CaddyPhp\Config\Apps\Cache\Api\Souin;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Cache/Api/Souin.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Cache\Api;

use mattvb91\CaddyPhp\Interfaces\Arrayable;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Cache/Cdn.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Cache;

use mattvb91\CaddyPhp\Interfaces\Arrayable;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Cache/Key.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Cache;

use mattvb91\CaddyPhp\Interfaces\Arrayable;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Cache/Nuts.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Cache;

use mattvb91\CaddyPhp\Interfaces\Arrayable;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Cache/Redis.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Cache;

use mattvb91\CaddyPhp\Interfaces\Arrayable;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps;

use mattvb91\CaddyPhp\Config\Apps\Http\Server;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http;

use mattvb91\CaddyPhp\Config\Apps\Http\Server\Route;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Route.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Handle\HandlerInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Handle/Authentication.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Handle\Authentication\ProviderInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle\Authentication\Providers;

use mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle\Authentication\Providers\HttpBasic\Account;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle\Authentication\Providers\HttpBasic;

use mattvb91\CaddyPhp\Interfaces\Arrayable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle\Authentication\Providers\HttpBasic\Hash;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Handle\Authentication\Providers\HttpBasic\HashInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Handle/Cache.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle;

use mattvb91\CaddyPhp\Config\Logs\LogLevel;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Handle/Error.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Handle\HandlerInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Handle/FileServer.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Handle\HandlerInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Handle/Headers.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle;

use mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle\Headers\Request;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Handle/Headers/Request.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle\Headers;

use mattvb91\CaddyPhp\Interfaces\Arrayable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle\Headers;

use mattvb91\CaddyPhp\Interfaces\Arrayable;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Handle/ReverseProxy.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle;

use mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle\ReverseProxy\Upstream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle\ReverseProxy\Transport;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Handle\ReverseProxy\TransportInterface;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle\ReverseProxy;

use mattvb91\CaddyPhp\Interfaces\Arrayable;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Handle/Rewrite.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Handle\HandlerInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Handle/StaticResponse.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Handle\HandlerInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Handle/Subroute.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Handle;

use mattvb91\CaddyPhp\Config\Apps\Http\Server\Route;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Match/File.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Match;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Match\MatcherInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Match/Host.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Match;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Match\MatcherInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Match/MatchProtocol.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Match;

enum MatchProtocol: string
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Match/Not.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Match;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Match\MatcherInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Match/Path.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Match;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Match\MatcherInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Http/Server/Routes/Match/Protocol.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Http\Server\Routes\Match;

use mattvb91\CaddyPhp\Interfaces\Apps\Servers\Routes\Match\MatcherInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Tls.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps;

use mattvb91\CaddyPhp\Config\Apps\Tls\Automation;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Tls/Automation.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Tls;

use mattvb91\CaddyPhp\Config\Apps\Tls\Automation\OnDemand;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Tls/Automation/OnDemand.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Tls\Automation;

use mattvb91\CaddyPhp\Config\Apps\Tls\Automation\OnDemand\RateLimit;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Tls/Automation/OnDemand/RateLimit.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Tls\Automation\OnDemand;

use mattvb91\CaddyPhp\Interfaces\Arrayable;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Tls/Automation/Policies.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Tls\Automation;

use mattvb91\CaddyPhp\Interfaces\Apps\Tls\Automation\Policies\IssuerInterface;
Expand Down
2 changes: 2 additions & 0 deletions src/Config/Apps/Tls/Automation/Policies/Issuers/Acme.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace mattvb91\CaddyPhp\Config\Apps\Tls\Automation\Policies\Issuers;

use mattvb91\CaddyPhp\Config\Apps\Tls\Automation\Policies\Issuers\Acme\Challenges;
Expand Down
Loading

0 comments on commit 9393209

Please sign in to comment.