Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "*",
Expand All @@ -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"
}
Binary file added composer.phar
Binary file not shown.
6 changes: 6 additions & 0 deletions pint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"preset": "psr12",
"exclude": [
"tests/resources"
]
}
10 changes: 5 additions & 5 deletions src/Storage/Device/Backblaze.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/Storage/Device/DOSpaces.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/Storage/Device/Linode.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
88 changes: 44 additions & 44 deletions src/Storage/Device/S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Copy link

Copilot AI Aug 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SA_EAST_1 constant has an incorrect value. It should be 'sa-east-1' but is set to 'eu-north-1', which is the value for EU_NORTH_1.

Suggested change
public const SA_EAST_1 = 'eu-north-1';
public const SA_EAST_1 = 'sa-east-1';

Copilot uses AI. Check for mistakes.

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;

Expand Down Expand Up @@ -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 = [];

Expand Down
20 changes: 10 additions & 10 deletions src/Storage/Device/Wasabi.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/Storage/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions src/Storage/Validator/FileExt.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
8 changes: 4 additions & 4 deletions src/Storage/Validator/FileType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down