Skip to content

Commit

Permalink
Update and apply PHP CS Fixer config
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromegamez committed Apr 9, 2023
1 parent 6afc948 commit da74275
Show file tree
Hide file tree
Showing 68 changed files with 367 additions and 199 deletions.
27 changes: 0 additions & 27 deletions .git-blame-ignore-revs

This file was deleted.

1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
/tests export-ignore

/.editorconfig export-ignore
/.git-blame-ignore-revs export-ignore
/.gitattributes export-ignore
/.github export-ignore
/.gitignore export-ignore
Expand Down
23 changes: 14 additions & 9 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,34 @@

declare(strict_types=1);

use Beste\PhpCsFixer\Config\Factory;
use Beste\PhpCsFixer\Config\RuleSet\Php81;
use Ergebnis\PhpCsFixer\Config;

$config = Config\Factory::fromRuleSet(new Php81(), [
'phpdoc_line_span' => false,
'concat_space' => [
'spacing' => 'none',
],
$config = Factory::fromRuleSet(new Php81(), [
'final_class' => false,
'final_internal_class' => false,
'final_public_method_for_abstract_class' => false,
'global_namespace_import' => [
'import_classes' => true,
'import_constants' => true,
'import_functions' => true,
],
'php_unit_method_casing' => [
'case' => 'camel_case',
],
'php_unit_test_case_static_method_calls' => [
'call_type' => 'this',
'methods' => [],
],
'php_unit_test_class_requires_covers' => false,
'yoda_style' => false,
]);

$config->getFinder()->in(__DIR__);
$config
->getFinder()
->in(__DIR__)
->ignoreDotFiles(false)
;

$config->setCacheFile(__DIR__ . '/tools/.php-cs-fixer.cache');
$config->setCacheFile(__DIR__.'/tools/.php-cs-fixer.cache');

return $config;
19 changes: 14 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,17 @@
],
"install-php-cs-fixer": [
"mkdir --parents tools/php-cs-fixer",
"composer require --dev --working-dir=tools/php-cs-fixer beste/php-cs-fixer-config"
"composer require --dev --working-dir=tools/php-cs-fixer friendsofphp/php-cs-fixer:~3.16.0 beste/php-cs-fixer-config:~2.0.0"
],
"install-rector": [
"mkdir --parents tools/rector",
"composer require --working-dir=tools/rector rector/rector"
"composer require --dev --working-dir=tools/rector rector/rector"
],
"cs": [
"tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --diff"
"tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --diff --verbose"
],
"lint": [
"XDEBUG_MODE=off vendor/bin/phpstan"
],
"rector": [
"tools/rector/vendor/bin/rector --dry-run"
Expand All @@ -95,12 +98,18 @@
"tools/rector/vendor/bin/rector"
],
"test": [
"XDEBUG_MODE=off vendor/bin/phpstan",
"vendor/bin/phpunit --testsuite=unit"
"@lint",
"vendor/bin/phpunit"
],
"test-coverage": [
"Composer\\Config::disableProcessTimeout",
"XDEBUG_MODE=coverage vendor/bin/phpunit --coverage-html=.build/coverage"
],
"test-units": [
"vendor/bin/phpunit --testsuite=unit"
],
"test-integration": [
"vendor/bin/phpunit --testsuite=integration"
]
},
"extra": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,20 @@ final class ValidatedActionCodeSettings implements ActionCodeSettings
private ?bool $canHandleCodeInApp = null;
private ?UriInterface $dynamicLinkDomain = null;

/** @var non-empty-string|null */
/**
* @var non-empty-string|null
*/
private ?string $androidPackageName = null;

/** @var non-empty-string|null */
/**
* @var non-empty-string|null
*/
private ?string $androidMinimumVersion = null;
private ?bool $androidInstallApp = null;

/** @var non-empty-string|null */
/**
* @var non-empty-string|null
*/
private ?string $iOSBundleId = null;

private function __construct()
Expand Down
6 changes: 4 additions & 2 deletions src/Firebase/Auth/ApiClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,15 @@ public function unlinkProvider(string $uid, array $providers): ResponseInterface
public function createSessionCookie(string $idToken, int|DateInterval $ttl): string
{
return (new GuzzleApiClientHandler($this->client, $this->projectId))
->handle(CreateSessionCookie::forIdToken($idToken, $this->tenantId, $ttl, $this->clock));
->handle(CreateSessionCookie::forIdToken($idToken, $this->tenantId, $ttl, $this->clock))
;
}

public function getEmailActionLink(string $type, string $email, ActionCodeSettings $actionCodeSettings, ?string $locale = null): string
{
return (new CreateActionLink\GuzzleApiClientHandler($this->client, $this->projectId))
->handle(CreateActionLink::new($type, $email, $actionCodeSettings, $this->tenantId, $locale));
->handle(CreateActionLink::new($type, $email, $actionCodeSettings, $this->tenantId, $locale))
;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Firebase/Auth/CreateActionLink/GuzzleApiClientHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
use Kreait\Firebase\Auth\TenantAwareAuthResourceUrlBuilder;
use Psr\Http\Message\RequestInterface;

use const JSON_FORCE_OBJECT;

use function array_filter;

use const JSON_FORCE_OBJECT;

/**
* @internal
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
use Kreait\Firebase\Auth\TenantAwareAuthResourceUrlBuilder;
use Psr\Http\Message\RequestInterface;

use const JSON_FORCE_OBJECT;

use function array_filter;

use const JSON_FORCE_OBJECT;

/**
* @internal
*/
Expand Down
4 changes: 2 additions & 2 deletions src/Firebase/Auth/SendActionLink/GuzzleApiClientHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
use Kreait\Firebase\Auth\TenantAwareAuthResourceUrlBuilder;
use Psr\Http\Message\RequestInterface;

use const JSON_FORCE_OBJECT;

use function array_filter;

use const JSON_FORCE_OBJECT;

/**
* @internal
*/
Expand Down
12 changes: 8 additions & 4 deletions src/Firebase/Auth/SignIn/GuzzleHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,27 @@
use Psr\Http\Message\RequestInterface;
use UnexpectedValueException;

use const JSON_FORCE_OBJECT;

use function array_merge;
use function http_build_query;
use function str_replace;

use const JSON_FORCE_OBJECT;

/**
* @internal
*/
final class GuzzleHandler implements Handler
{
/** @var array<non-empty-string, mixed> */
/**
* @var array<non-empty-string, mixed>
*/
private static array $defaultBody = [
'returnSecureToken' => true,
];

/** @var array<non-empty-string, mixed> */
/**
* @var array<non-empty-string, mixed>
*/
private static array $defaultHeaders = [
'Content-Type' => 'application/json; charset=UTF-8',
];
Expand Down
28 changes: 21 additions & 7 deletions src/Firebase/Auth/SignInResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,39 @@

final class SignInResult
{
/** @var non-empty-string|null */
/**
* @var non-empty-string|null
*/
private ?string $idToken = null;

/** @var non-empty-string|null */
/**
* @var non-empty-string|null
*/
private ?string $accessToken = null;

/** @var non-empty-string|null */
/**
* @var non-empty-string|null
*/
private ?string $refreshToken = null;

/** @var positive-int|null */
/**
* @var positive-int|null
*/
private ?int $ttl = null;

/** @var array<non-empty-string, mixed> */
/**
* @var array<non-empty-string, mixed>
*/
private array $data = [];

/** @var non-empty-string|null */
/**
* @var non-empty-string|null
*/
private ?string $firebaseUserId = null;

/** @var non-empty-string|null */
/**
* @var non-empty-string|null
*/
private ?string $tenantId = null;
private Parser $parser;

Expand Down
20 changes: 15 additions & 5 deletions src/Firebase/Auth/UserQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,29 @@ class UserQuery implements JsonSerializable
public const ORDER_DESC = 'DESC';
public const MAX_LIMIT = 500;

/** @var int<1, self::MAX_LIMIT>|null */
/**
* @var int<1, self::MAX_LIMIT>|null
*/
private ?int $limit = null;

/** @var int<0, max>|null */
/**
* @var int<0, max>|null
*/
private ?int $offset = null;

/** @var self::FIELD_*|null */
/**
* @var self::FIELD_*|null
*/
private ?string $sortBy = null;

/** @var self::ORDER_*|null */
/**
* @var self::ORDER_*|null
*/
private ?string $order = null;

/** @var array<self::FILTER_*, non-empty-string>|null */
/**
* @var array<self::FILTER_*, non-empty-string>|null
*/
private ?array $filter = null;

private function __construct()
Expand Down
4 changes: 3 additions & 1 deletion src/Firebase/Database/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ class Query
private Reference $reference;
private ApiClient $apiClient;

/** @var Filter[] */
/**
* @var Filter[]
*/
private array $filters = [];
private ?Sorter $sorter = null;

Expand Down
4 changes: 3 additions & 1 deletion src/Firebase/Database/RuleSet.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

class RuleSet implements JsonSerializable
{
/** @var array<string, array<mixed>> */
/**
* @var array<string, array<mixed>>
*/
private array $rules;

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Firebase/Database/Transaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

class Transaction
{
/** @var array<string, string> */
/**
* @var array<string, string>
*/
private array $etags;

/**
Expand Down
4 changes: 3 additions & 1 deletion src/Firebase/DynamicLink/DynamicLinkStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

final class DynamicLinkStatistics
{
/** @var array<string, list<array<string, string>>> */
/**
* @var array<string, list<array<string, string>>>
*/
private array $rawData = [];
private EventStatistics $events;

Expand Down
4 changes: 3 additions & 1 deletion src/Firebase/DynamicLink/EventStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ final class EventStatistics implements Countable, IteratorAggregate
// Re-opens of an app
public const TYPE_APP_RE_OPEN = 'APP_RE_OPEN';

/** @var list<EventStatisticsShape> */
/**
* @var list<EventStatisticsShape>
*/
private array $events;

/**
Expand Down

0 comments on commit da74275

Please sign in to comment.