diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index bca79de9..7ca3471a 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -8,13 +8,13 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 2 - run: git checkout HEAD^2 - name: Run Linter - run: | + run: | docker run --rm -v $PWD:/app composer sh -c \ - "composer install --profile --ignore-platform-reqs && composer lint" + "composer install --profile --ignore-platform-reqs && composer lint" \ No newline at end of file diff --git a/composer.json b/composer.json index 5d588d68..cc3c73b5 100644 --- a/composer.json +++ b/composer.json @@ -12,8 +12,8 @@ "psr-4": {"Utopia\\Tests\\Storage\\":"tests/Storage"} }, "scripts": { - "lint": "./vendor/bin/pint --test", - "format": "./vendor/bin/pint" + "lint": "./vendor/bin/pint --test --config pint.json", + "format": "./vendor/bin/pint --config pint.json" }, "require": { "ext-fileinfo": "*", @@ -30,7 +30,8 @@ "require-dev": { "phpunit/phpunit": "^9.3", "vimeo/psalm": "4.0.1", - "laravel/pint": "1.2.*" + "phpstan/phpstan": "^1.12", + "laravel/pint": "^1.2" }, "minimum-stability": "stable" } diff --git a/composer.phar b/composer.phar new file mode 100755 index 00000000..f5d9d1ab Binary files /dev/null and b/composer.phar differ diff --git a/pint.json b/pint.json new file mode 100644 index 00000000..70add709 --- /dev/null +++ b/pint.json @@ -0,0 +1,6 @@ +{ + "preset": "psr12", + "exclude": [ + "tests/resources" + ] +} \ No newline at end of file diff --git a/src/Storage/Device/Backblaze.php b/src/Storage/Device/Backblaze.php index 7420098e..ce60c224 100644 --- a/src/Storage/Device/Backblaze.php +++ b/src/Storage/Device/Backblaze.php @@ -12,15 +12,15 @@ class Backblaze extends S3 * (Technically, these are clusters. There are two Backblaze regions, * US West and EU Central.) */ - const US_WEST_000 = 'us-west-000'; + public const US_WEST_000 = 'us-west-000'; - const US_WEST_001 = 'us-west-001'; + public const US_WEST_001 = 'us-west-001'; - const US_WEST_002 = 'us-west-002'; + public const US_WEST_002 = 'us-west-002'; - const US_WEST_004 = 'us-west-004'; + public const US_WEST_004 = 'us-west-004'; - const EU_CENTRAL_003 = 'eu-central-003'; + public const EU_CENTRAL_003 = 'eu-central-003'; /** * Backblaze Constructor diff --git a/src/Storage/Device/DOSpaces.php b/src/Storage/Device/DOSpaces.php index 853c2dfc..77cdf10f 100644 --- a/src/Storage/Device/DOSpaces.php +++ b/src/Storage/Device/DOSpaces.php @@ -9,17 +9,17 @@ class DOSpaces extends S3 /** * Regions constants */ - const SGP1 = 'sgp1'; + public const SGP1 = 'sgp1'; - const NYC3 = 'nyc3'; + public const NYC3 = 'nyc3'; - const FRA1 = 'fra1'; + public const FRA1 = 'fra1'; - const SFO2 = 'sfo2'; + public const SFO2 = 'sfo2'; - const SFO3 = 'sfo3'; + public const SFO3 = 'sfo3'; - const AMS3 = 'AMS3'; + public const AMS3 = 'AMS3'; /** * DOSpaces Constructor diff --git a/src/Storage/Device/Linode.php b/src/Storage/Device/Linode.php index fd8c79b8..17936470 100644 --- a/src/Storage/Device/Linode.php +++ b/src/Storage/Device/Linode.php @@ -9,13 +9,13 @@ class Linode extends S3 /** * Regions constants */ - const EU_CENTRAL_1 = 'eu-central-1'; + public const EU_CENTRAL_1 = 'eu-central-1'; - const US_SOUTHEAST_1 = 'us-southeast-1'; + public const US_SOUTHEAST_1 = 'us-southeast-1'; - const US_EAST_1 = 'us-east-1'; + public const US_EAST_1 = 'us-east-1'; - const AP_SOUTH_1 = 'ap-south-1'; + public const AP_SOUTH_1 = 'ap-south-1'; /** * Object Storage Constructor diff --git a/src/Storage/Device/S3.php b/src/Storage/Device/S3.php index c21bb9cb..9c465a0f 100644 --- a/src/Storage/Device/S3.php +++ b/src/Storage/Device/S3.php @@ -8,97 +8,97 @@ class S3 extends Device { - const METHOD_GET = 'GET'; + public const METHOD_GET = 'GET'; - const METHOD_POST = 'POST'; + public const METHOD_POST = 'POST'; - const METHOD_PUT = 'PUT'; + public const METHOD_PUT = 'PUT'; - const METHOD_PATCH = 'PATCH'; + public const METHOD_PATCH = 'PATCH'; - const METHOD_DELETE = 'DELETE'; + public const METHOD_DELETE = 'DELETE'; - const METHOD_HEAD = 'HEAD'; + public const METHOD_HEAD = 'HEAD'; - const METHOD_OPTIONS = 'OPTIONS'; + public const METHOD_OPTIONS = 'OPTIONS'; - const METHOD_CONNECT = 'CONNECT'; + public const METHOD_CONNECT = 'CONNECT'; - const METHOD_TRACE = 'TRACE'; + public const METHOD_TRACE = 'TRACE'; - const HTTP_VERSION_1_1 = CURL_HTTP_VERSION_1_1; + public const HTTP_VERSION_1_1 = CURL_HTTP_VERSION_1_1; - const HTTP_VERSION_2_0 = CURL_HTTP_VERSION_2_0; + public const HTTP_VERSION_2_0 = CURL_HTTP_VERSION_2_0; - const HTTP_VERSION_2 = CURL_HTTP_VERSION_2; + public const HTTP_VERSION_2 = CURL_HTTP_VERSION_2; - const HTTP_VERSION_1_0 = CURL_HTTP_VERSION_1_0; + public const HTTP_VERSION_1_0 = CURL_HTTP_VERSION_1_0; /** * AWS Regions constants */ - const US_EAST_1 = 'us-east-1'; + public const US_EAST_1 = 'us-east-1'; - const US_EAST_2 = 'us-east-2'; + public const US_EAST_2 = 'us-east-2'; - const US_WEST_1 = 'us-west-1'; + public const US_WEST_1 = 'us-west-1'; - const US_WEST_2 = 'us-west-2'; + public const US_WEST_2 = 'us-west-2'; - const AF_SOUTH_1 = 'af-south-1'; + public const AF_SOUTH_1 = 'af-south-1'; - const AP_EAST_1 = 'ap-east-1'; + public const AP_EAST_1 = 'ap-east-1'; - const AP_SOUTH_1 = 'ap-south-1'; + public const AP_SOUTH_1 = 'ap-south-1'; - const AP_NORTHEAST_3 = 'ap-northeast-3'; + public const AP_NORTHEAST_3 = 'ap-northeast-3'; - const AP_NORTHEAST_2 = 'ap-northeast-2'; + public const AP_NORTHEAST_2 = 'ap-northeast-2'; - const AP_NORTHEAST_1 = 'ap-northeast-1'; + public const AP_NORTHEAST_1 = 'ap-northeast-1'; - const AP_SOUTHEAST_1 = 'ap-southeast-1'; + public const AP_SOUTHEAST_1 = 'ap-southeast-1'; - const AP_SOUTHEAST_2 = 'ap-southeast-2'; + public const AP_SOUTHEAST_2 = 'ap-southeast-2'; - const CA_CENTRAL_1 = 'ca-central-1'; + public const CA_CENTRAL_1 = 'ca-central-1'; - const EU_CENTRAL_1 = 'eu-central-1'; + public const EU_CENTRAL_1 = 'eu-central-1'; - const EU_WEST_1 = 'eu-west-1'; + public const EU_WEST_1 = 'eu-west-1'; - const EU_SOUTH_1 = 'eu-south-1'; + public const EU_SOUTH_1 = 'eu-south-1'; - const EU_WEST_2 = 'eu-west-2'; + public const EU_WEST_2 = 'eu-west-2'; - const EU_WEST_3 = 'eu-west-3'; + public const EU_WEST_3 = 'eu-west-3'; - const EU_NORTH_1 = 'eu-north-1'; + public const EU_NORTH_1 = 'eu-north-1'; - const SA_EAST_1 = 'eu-north-1'; + public const SA_EAST_1 = 'eu-north-1'; - const CN_NORTH_1 = 'cn-north-1'; + public const CN_NORTH_1 = 'cn-north-1'; - const CN_NORTH_4 = 'cn-north-4'; + public const CN_NORTH_4 = 'cn-north-4'; - const CN_NORTHWEST_1 = 'cn-northwest-1'; + public const CN_NORTHWEST_1 = 'cn-northwest-1'; - const ME_SOUTH_1 = 'me-south-1'; + public const ME_SOUTH_1 = 'me-south-1'; - const US_GOV_EAST_1 = 'us-gov-east-1'; + public const US_GOV_EAST_1 = 'us-gov-east-1'; - const US_GOV_WEST_1 = 'us-gov-west-1'; + public const US_GOV_WEST_1 = 'us-gov-west-1'; /** * AWS ACL Flag constants */ - const ACL_PRIVATE = 'private'; + public const ACL_PRIVATE = 'private'; - const ACL_PUBLIC_READ = 'public-read'; + public const ACL_PUBLIC_READ = 'public-read'; - const ACL_PUBLIC_READ_WRITE = 'public-read-write'; + public const ACL_PUBLIC_READ_WRITE = 'public-read-write'; - const ACL_AUTHENTICATED_READ = 'authenticated-read'; + public const ACL_AUTHENTICATED_READ = 'authenticated-read'; protected const MAX_PAGE_SIZE = 1000; @@ -870,7 +870,7 @@ protected function call(string $method, string $uri, string $data = '', array $p { $uri = $this->getAbsolutePath($uri); $url = 'https://'.$this->headers['host'].$uri.'?'.\http_build_query($parameters, '', '&', PHP_QUERY_RFC3986); - $response = new \stdClass; + $response = new \stdClass(); $response->body = ''; $response->headers = []; diff --git a/src/Storage/Device/Wasabi.php b/src/Storage/Device/Wasabi.php index dbde5bcb..604cce08 100644 --- a/src/Storage/Device/Wasabi.php +++ b/src/Storage/Device/Wasabi.php @@ -9,25 +9,25 @@ class Wasabi extends S3 /** * Regions constants */ - const US_WEST_1 = 'us-west-1'; + public const US_WEST_1 = 'us-west-1'; - const AP_NORTHEAST_1 = 'ap-northeast-1'; + public const AP_NORTHEAST_1 = 'ap-northeast-1'; - const AP_NORTHEAST_2 = 'ap-northeast-2'; + public const AP_NORTHEAST_2 = 'ap-northeast-2'; - const EU_CENTRAL_1 = 'eu-central-1'; + public const EU_CENTRAL_1 = 'eu-central-1'; - const EU_CENTRAL_2 = 'eu-central-2'; + public const EU_CENTRAL_2 = 'eu-central-2'; - const EU_WEST_1 = 'eu-west-1'; + public const EU_WEST_1 = 'eu-west-1'; - const EU_WEST_2 = 'eu-west-2'; + public const EU_WEST_2 = 'eu-west-2'; - const US_CENTRAL_1 = 'us-central-1'; + public const US_CENTRAL_1 = 'us-central-1'; - const US_EAST_1 = 'us-east-1'; + public const US_EAST_1 = 'us-east-1'; - const US_EAST_2 = 'us-east-2'; + public const US_EAST_2 = 'us-east-2'; /** * Wasabi Constructor diff --git a/src/Storage/Storage.php b/src/Storage/Storage.php index cabd18c8..a0cc3dc7 100644 --- a/src/Storage/Storage.php +++ b/src/Storage/Storage.php @@ -9,17 +9,17 @@ class Storage /** * Supported devices */ - const DEVICE_LOCAL = 'local'; + public const DEVICE_LOCAL = 'local'; - const DEVICE_S3 = 's3'; + public const DEVICE_S3 = 's3'; - const DEVICE_DO_SPACES = 'dospaces'; + public const DEVICE_DO_SPACES = 'dospaces'; - const DEVICE_WASABI = 'wasabi'; + public const DEVICE_WASABI = 'wasabi'; - const DEVICE_BACKBLAZE = 'backblaze'; + public const DEVICE_BACKBLAZE = 'backblaze'; - const DEVICE_LINODE = 'linode'; + public const DEVICE_LINODE = 'linode'; /** * Devices. diff --git a/src/Storage/Validator/FileExt.php b/src/Storage/Validator/FileExt.php index 0ed243a8..164f204e 100644 --- a/src/Storage/Validator/FileExt.php +++ b/src/Storage/Validator/FileExt.php @@ -6,15 +6,15 @@ class FileExt extends Validator { - const TYPE_JPEG = 'jpeg'; + public const TYPE_JPEG = 'jpeg'; - const TYPE_JPG = 'jpg'; + public const TYPE_JPG = 'jpg'; - const TYPE_GIF = 'gif'; + public const TYPE_GIF = 'gif'; - const TYPE_PNG = 'png'; + public const TYPE_PNG = 'png'; - const TYPE_GZIP = 'gz'; + public const TYPE_GZIP = 'gz'; const TYPE_ZIP = 'zip'; diff --git a/src/Storage/Validator/FileType.php b/src/Storage/Validator/FileType.php index a5e366bc..f8af16b1 100644 --- a/src/Storage/Validator/FileType.php +++ b/src/Storage/Validator/FileType.php @@ -10,13 +10,13 @@ class FileType extends Validator /** * File Types Constants. */ - const FILE_TYPE_JPEG = 'jpeg'; + public const FILE_TYPE_JPEG = 'jpeg'; - const FILE_TYPE_GIF = 'gif'; + public const FILE_TYPE_GIF = 'gif'; - const FILE_TYPE_PNG = 'png'; + public const FILE_TYPE_PNG = 'png'; - const FILE_TYPE_GZIP = 'gz'; + public const FILE_TYPE_GZIP = 'gz'; /** * File Type Binaries.