Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade/l10 #1352

Merged
merged 6 commits into from
Mar 22, 2023
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Laravel

on:
push:
branches: [ 1.x, 2.x ]
branches: [ 2.x, 3.x ]
pull_request:
branches: [ 1.x, 2.x ]
branches: [ 2.x, 3.x ]

jobs:
laravel:
Expand Down
76 changes: 0 additions & 76 deletions composer-dev.json

This file was deleted.

26 changes: 13 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,28 @@
"Seatplus\\Web\\Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"require": {
"php": "^8.1",
"laravel/framework": "^9.0",
"laravel/framework": "^10.0",
"laravel/socialite": "^5.0",
"seatplus/eveapi": "^2.0",
"seatplus/auth": "^2.0",
"inertiajs/inertia-laravel": "^0.5.4",
"seatplus/eveapi": "^3.0",
"seatplus/auth": "^3.0",
"tightenco/ziggy": "^1.0.4",
"spatie/laravel-permission": "^5.4",
"spatie/data-transfer-object": "^3.7",
"conedevelopment/i18n": "^1.1",
"doctrine/dbal": "^3.0"
"doctrine/dbal": "^3.0",
"inertiajs/inertia-laravel": "^0.6.9"
},
"require-dev": {
"orchestra/testbench": "^7.0",
"nunomaduro/collision": "^6.1",
"rector/rector": "^0.14.3",
"brianium/paratest": "^6.2",
"pestphp/pest": "^1.20",
"pestphp/pest-plugin-laravel": "^1.2"
"orchestra/testbench": "^8.0",
"nunomaduro/collision": "^7.0",
"rector/rector": "^0.15.21",
"driftingly/rector-laravel": "^0.17.0",
"pestphp/pest": "^2.0",
"pestphp/pest-plugin-laravel": "^2.0"
},
"extra": {
"laravel": {
Expand Down
60 changes: 26 additions & 34 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src/</directory>
</whitelist>
</filter>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="REDIS_HOST" value="redis"/>
<env name="REDIS_PASSWORD" value="null"/>
<env name="REDIS_PORT" value="6379"/>
<env name="DB_HOST" value="127.0.0.1" />
<env name="DB_PORT" value="3308" />
<env name="DB_DATABASE" value="testbench" />
<env name="DB_USERNAME" value="default" />
<env name="DB_PASSWORD" value="secret" />
</php>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
<coverage>
<include>
<directory suffix=".php">./src/</directory>
</include>
<report>
<clover outputFile="build/logs/clover.xml"/>
</report>
</coverage>
<testsuites>
<testsuite name="Package Test Suite">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
<php>
<env name="APP_KEY" value="AckfSECXIvnK5r28GVIWUAxmbBSjTsmF"/>
<env name="REDIS_HOST" value="redis"/>
<env name="REDIS_PASSWORD" value="null"/>
<env name="REDIS_PORT" value="6379"/>
<env name="DB_HOST" value="127.0.0.1"/>
<env name="DB_PORT" value="3308"/>
<env name="DB_DATABASE" value="testbench"/>
<env name="DB_USERNAME" value="default"/>
<env name="DB_PASSWORD" value="secret"/>
</php>
<logging/>
</phpunit>
45 changes: 27 additions & 18 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,36 @@

declare(strict_types=1);

use Rector\Core\Configuration\Option;
use Rector\Laravel\Set\LaravelSetList;
use Rector\Php74\Rector\Property\TypedPropertyRector;
use Rector\Set\ValueObject\LevelSetList;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Rector\Config\RectorConfig;
use Rector\Core\ValueObject\PhpVersion;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php81\Rector\Array_\FirstClassCallableRector;
use Rector\Set\ValueObject\SetList;
use RectorLaravel\Set\LaravelSetList;

return static function (ContainerConfigurator $containerConfigurator): void {
// get parameters
$parameters = $containerConfigurator->parameters();
$parameters->set(Option::PATHS, [
__DIR__ . '/src',
__DIR__ . '/tests'
return static function (RectorConfig $rectorConfig): void {
// here we can define, what sets of rules will be applied
// tip: use "SetList" class to autocomplete sets
$rectorConfig->sets([
//SetList::CODE_QUALITY,
LaravelSetList::LARAVEL_100,
LaravelSetList::LARAVEL_CODE_QUALITY,
SetList::PHP_81,
]);
// paths to refactor; solid alternative to CLI arguments
$rectorConfig->paths([__DIR__ . '/src', __DIR__ . '/tests']);

// Define what rule sets will be applied
$containerConfigurator->import(LevelSetList::UP_TO_PHP_80);
$containerConfigurator->import(LaravelSetList::LARAVEL_80);
// is your PHP version different from the one you refactor to? [default: your PHP version], uses PHP_VERSION_ID format
$rectorConfig->phpVersion(PhpVersion::PHP_81);

// get services (needed for register a single rule)
// $services = $containerConfigurator->services();
$rectorConfig->skip([
RemoveExtraParametersRector::class => [ __DIR__ . '/src/Services/SsoSettings/UpdateOrCreateSsoSettings.php'],
FirstClassCallableRector::class => [
__DIR__ . '/src/Http/Controllers/AccessControl/ControlGroupsController.php',
__DIR__ . '/src/Http/Controllers/Shared/ManualLocationController.php',
]
]);

// register a single rule
// $services->set(TypedPropertyRector::class);
// register single rule
//$rectorConfig->rule(TypedPropertyRector::class);
};
2 changes: 1 addition & 1 deletion src/Http/Actions/Wallet/GetRefTypesAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ private function getRefTypes(): Collection

private function alphabetToNumber($string): float
{
$string = strtoupper($string);
$string = strtoupper((string) $string);
$length = strlen($string);
$number = 0;
$level = 1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ private function getAffiliatedCorporations(object $dispatchTransferObject)
->get()
->map(function ($corporation) {
$corporation->required_scopes = collect([
json_decode($corporation->corporation_scopes, true),
json_decode($corporation->alliance_scopes, true),
json_decode((string) $corporation->corporation_scopes, true),
json_decode((string) $corporation->alliance_scopes, true),
])->flatten()->filter()->unique()->toArray();

return $corporation;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

class GetRecruitmentIndexController extends Controller
{
public const MANAGEPERMISSION = 'can open or close corporations for recruitment';
public const RECRUITERPERMISSION = 'can accept or deny applications';
final public const MANAGEPERMISSION = 'can open or close corporations for recruitment';
final public const RECRUITERPERMISSION = 'can accept or deny applications';

public function __invoke()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Http/Controllers/Queue/DispatchJobController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class DispatchJobController extends Controller
protected array $dispatch_transfer_object;

public function __construct(
private WebJobsRepository $web_jobs
private readonly WebJobsRepository $web_jobs
) {
}

Expand Down
4 changes: 2 additions & 2 deletions src/Services/ACL/SyncRoleAffiliations.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class SyncRoleAffiliations
{
private $current_affiliations;

private \Illuminate\Support\Collection $target_affiliations;
private readonly \Illuminate\Support\Collection $target_affiliations;

public function __construct(/**
* @var \Seatplus\Auth\Models\Permissions\Role
*/
private Role $role
private readonly Role $role
) {
$this->current_affiliations = $role->affiliations;
$this->target_affiliations = collect();
Expand Down
2 changes: 1 addition & 1 deletion src/Services/ACL/SyncRoleName.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SyncRoleName
/**
* SyncRoleName constructor.
*/
public function __construct(private Role $role)
public function __construct(private readonly Role $role)
{
}

Expand Down
6 changes: 3 additions & 3 deletions src/Services/ACL/SyncRolePermissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@

class SyncRolePermissions
{
private \Illuminate\Support\Collection $current_permissions;
private readonly \Illuminate\Support\Collection $current_permissions;

private \Illuminate\Support\Collection $target_permissions;
private readonly \Illuminate\Support\Collection $target_permissions;

public function __construct(/**
* @var \Seatplus\Auth\Models\Permissions\Role
*/
private Role $role
private readonly Role $role
) {
$this->current_permissions = $role->permissions()->pluck('name');
$this->target_permissions = collect();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class GetCorporationMemberComplianceAffiliatedIdsService
{
public function __construct(
private AffiliationsDto $affiliationsDto
private readonly AffiliationsDto $affiliationsDto
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Services/Controller/CreateDispatchTransferObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

class CreateDispatchTransferObject
{
private array $transferObjectArray;
private readonly array $transferObjectArray;

private bool $isCharacter = true;

Expand Down
8 changes: 4 additions & 4 deletions src/Services/GetEntityFromId.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ class GetEntityFromId
{
private string $type;

private Collection $names;
private readonly Collection $names;

private GetNamesFromIdsService $get_names_from_ids_service;
private readonly GetNamesFromIdsService $get_names_from_ids_service;

private string $cache_key;
private readonly string $cache_key;

private ?array $cached_affiliation;
private readonly ?array $cached_affiliation;

public function __construct(public int $id)
{
Expand Down
2 changes: 1 addition & 1 deletion src/Services/GetIdsFromNamesService.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class GetIdsFromNamesService
{
private Collection $result;
private readonly Collection $result;

public function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Services/GetNamesFromIdsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

class GetNamesFromIdsService
{
private Collection $result;
private readonly Collection $result;

public function __construct()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Services/Mails/EveMailService.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@

class EveMailService
{
private Collection $namesToResolve;
private readonly Collection $namesToResolve;

public function __construct(private Mail $mail)
public function __construct(private readonly Mail $mail)
{
$this->namesToResolve = collect();
}
Expand Down
Loading