Skip to content

Commit 0374824

Browse files
committed
Add rector
1 parent 499fc74 commit 0374824

File tree

197 files changed

+917
-801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+917
-801
lines changed

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ jobs:
100100
run: php artisan migrate --no-interaction -vvv --force
101101
- name: Execute code style check via Laravel Pint
102102
run: vendor/bin/pint --test -v
103+
- name: Rector Cache
104+
uses: actions/cache@v4
105+
with:
106+
path: /tmp/rector
107+
key: ${{ runner.os }}-rector-${{ github.run_id }}
108+
restore-keys: ${{ runner.os }}-rector-
109+
- run: mkdir -p /tmp/rector
110+
- name: Rector Dry Run
111+
run: vendor/bin/rector process --dry-run
103112
- name: Execute tests (Unit and Feature tests) via PHPUnit
104113
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork }}
105114
env:

app/Auth/ExternalUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ private function isRuleFulfilled($values, mixed $rule): bool
214214

215215
// Loop through all values and try to match the regex and save the result
216216
foreach ($values as $value) {
217-
$matches[] = preg_match($rule->regex, $value);
217+
$matches[] = preg_match($rule->regex, (string) $value);
218218
}
219219

220220
// Check if regex has to (not) match with all array entries

app/Auth/LDAP/LDAPController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public function login(Request $request)
5757
try {
5858
// Run login method from AuthenticatesUsers trait
5959
return $this->ldapLogin($request);
60-
} catch (MissingAttributeException $e) {
60+
} catch (MissingAttributeException) {
6161
// If an attribute is missing during the login process, return error
6262
return abort(500, __('auth.error.missing_attributes'));
6363
}

app/Auth/LDAP/LDAPProvider.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function __construct(Hasher $hasher, $model)
4040
* @param mixed $identifier
4141
* @return \Illuminate\Contracts\Auth\Authenticatable|null
4242
*/
43+
#[\Override]
4344
public function retrieveById($identifier)
4445
{
4546
return $this->eloquent->retrieveById($identifier);
@@ -52,6 +53,7 @@ public function retrieveById($identifier)
5253
* @param string $token
5354
* @return \Illuminate\Contracts\Auth\Authenticatable|null
5455
*/
56+
#[\Override]
5557
public function retrieveByToken($identifier, $token)
5658
{
5759
return $this->eloquent->retrieveByToken($identifier, $token);
@@ -63,11 +65,13 @@ public function retrieveByToken($identifier, $token)
6365
* @param string $token
6466
* @return void
6567
*/
68+
#[\Override]
6669
public function updateRememberToken(Authenticatable $user, $token)
6770
{
6871
$this->eloquent->updateRememberToken($user, $token);
6972
}
7073

74+
#[\Override]
7175
public function rehashPasswordIfRequired(Authenticatable $user, array $credentials, bool $force = false): void
7276
{
7377
$this->eloquent->rehashPasswordIfRequired($user, $credentials, $force);
@@ -78,6 +82,7 @@ public function rehashPasswordIfRequired(Authenticatable $user, array $credentia
7882
*
7983
* @return \Illuminate\Contracts\Auth\Authenticatable|null
8084
*/
85+
#[\Override]
8186
public function retrieveByCredentials(array $credentials)
8287
{
8388
// Find ldap user by username
@@ -102,6 +107,7 @@ public function retrieveByCredentials(array $credentials)
102107
*
103108
* @return bool
104109
*/
110+
#[\Override]
105111
public function validateCredentials(Authenticatable $user, array $credentials)
106112
{
107113
// Bind to LDAP with user credentials

app/Auth/LDAP/LDAPUser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct(LDAPUserObject $ldap_user)
2525
foreach ($raw_attributes as $attribute_name => $attribute_values) {
2626
// If the current LDAP attribute matches the name of the LDAP attribute in the mapping
2727
// add all values to the attribute of the user
28-
if (strcasecmp($ldap_attribute, $attribute_name) == 0) {
28+
if (strcasecmp((string) $ldap_attribute, $attribute_name) == 0) {
2929
foreach ($attribute_values as $value) {
3030
$this->addAttributeValue($attribute, $value);
3131
}

app/Auth/LDAP/LDAPUserObject.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class LDAPUserObject extends Model
1010
/**
1111
* The "booting" method of the model.
1212
*/
13+
#[\Override]
1314
protected static function boot(): void
1415
{
1516
parent::boot();
@@ -27,6 +28,7 @@ public function __construct(array $attributes = [])
2728
/**
2829
* Get a new query for builder filtered by the current models object classes.
2930
*/
31+
#[\Override]
3032
public function newQuery(): Builder
3133
{
3234
$query = $this->registerModelScopes(

app/Auth/Local/LocalProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ class LocalProvider extends EloquentUserProvider implements UserProvider
1212
*
1313
* @return \Illuminate\Contracts\Auth\Authenticatable|null
1414
*/
15+
#[\Override]
1516
public function retrieveByCredentials(array $credentials)
1617
{
1718
$email = $credentials['email'] ?? null;

app/Auth/Shibboleth/ShibbolethController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public function callback(Request $request)
4545
{
4646
try {
4747
$user = $this->provider->login($request);
48-
} catch (MissingAttributeException $e) {
48+
} catch (MissingAttributeException) {
4949
return redirect('/external_login?error=missing_attributes');
50-
} catch (ShibbolethSessionDuplicateException $e) {
50+
} catch (ShibbolethSessionDuplicateException) {
5151
// Prevented login attempt with duplicate shibboleth session, redirect to logout to kill SP session
5252
return redirect($this->provider->logout(url('/external_login?error=shibboleth_session_duplicate_exception')));
5353
}

app/Auth/Shibboleth/ShibbolethProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,6 @@ public function login(Request $request)
134134

135135
public function hashShibbolethSessionId($shibbolethSessionId)
136136
{
137-
return hash('sha256', $shibbolethSessionId);
137+
return hash('sha256', (string) $shibbolethSessionId);
138138
}
139139
}

app/Auth/Shibboleth/ShibbolethServiceProvider.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ class ShibbolethServiceProvider extends ServiceProvider
1010
/**
1111
* Register the Shibboleth provider.
1212
*/
13+
#[\Override]
1314
public function register(): void
1415
{
15-
$this->app->singleton(ShibbolethProvider::class, function (Application $app) {
16-
return new ShibbolethProvider;
17-
});
16+
$this->app->singleton(fn (Application $app): \App\Auth\Shibboleth\ShibbolethProvider => new ShibbolethProvider);
1817
}
1918
}

0 commit comments

Comments
 (0)