mirror of
https://github.com/snipe/snipe-it.git
synced 2026-08-18 03:06:23 +00:00
Docblock changes for phpstan happiness
This commit is contained in:
@ -27,7 +27,7 @@ function ip_in_range($ip, $range)
|
||||
$wildcard_decimal = pow(2, (32 - $netmask)) - 1;
|
||||
$netmask_decimal = ~$wildcard_decimal;
|
||||
|
||||
return ($ip_decimal & $netmask_decimal) == ($range_decimal & $netmask_decimal);
|
||||
return ($ip_decimal & $netmask_decimal) == ($range_decimal & $netmask_decimal);
|
||||
}
|
||||
// NOTE - this function was shamelessly stolen from this gist: https://gist.github.com/tott/7684443
|
||||
|
||||
@ -170,7 +170,7 @@ class LdapTroubleshooter extends Command
|
||||
$output[] = '-D '.escapeshellarg($settings->ldap_uname);
|
||||
|
||||
try {
|
||||
$w = Crypt::Decrypt($settings->ldap_pword);
|
||||
$w = Crypt::decrypt($settings->ldap_pword);
|
||||
} catch (Exception $e) {
|
||||
$this->warn('Could not decrypt password. This usually means an LDAP password was not set or the APP_KEY was changed since the LDAP pasword was last saved. Aborting.');
|
||||
exit(0);
|
||||
@ -384,7 +384,7 @@ class LdapTroubleshooter extends Command
|
||||
$this->line('STAGE 4: Test Administrative Bind for LDAP Sync');
|
||||
foreach ($ldap_urls as $ldap_url) {
|
||||
try {
|
||||
$w = Crypt::Decrypt($settings->ldap_pword);
|
||||
$w = Crypt::decrypt($settings->ldap_pword);
|
||||
} catch (Exception $e) {
|
||||
$this->warn('Could not decrypt password. This usually means an LDAP password was not set or the APP_KEY was changed since the LDAP pasword was last saved. Aborting.');
|
||||
exit(0);
|
||||
@ -405,7 +405,7 @@ class LdapTroubleshooter extends Command
|
||||
|
||||
foreach ($ldap_urls as $ldap_url) {
|
||||
try {
|
||||
$w = Crypt::Decrypt($settings->ldap_pword);
|
||||
$w = Crypt::decrypt($settings->ldap_pword);
|
||||
} catch (Exception $e) {
|
||||
$this->warn('Could not decrypt password. This usually means an LDAP password was not set or the APP_KEY was changed since the LDAP pasword was last saved. Aborting.');
|
||||
exit(0);
|
||||
|
||||
@ -65,7 +65,15 @@ class ResetPasswordController extends Controller
|
||||
|
||||
$credentials = $request->only('email', 'token');
|
||||
|
||||
if (is_null($this->broker()->getUser($credentials))) {
|
||||
// Password::broker() is typed to return the interface
|
||||
// Illuminate\Contracts\Auth\PasswordBroker, which doesn't
|
||||
// declare getUser(). The concrete Illuminate\Auth\Passwords\
|
||||
// PasswordBroker does. Narrow the type locally so PHPStan can
|
||||
// resolve the method against the concrete class.
|
||||
/** @var \Illuminate\Auth\Passwords\PasswordBroker $broker */
|
||||
$broker = $this->broker();
|
||||
|
||||
if (is_null($broker->getUser($credentials))) {
|
||||
Log::debug('Password reset form FAILED - this token is not valid.');
|
||||
|
||||
return redirect()->route('password.request')->with('error', trans('passwords.token'));
|
||||
|
||||
@ -19,16 +19,22 @@ abstract class RectangleSheet extends Sheet
|
||||
abstract public function getRows();
|
||||
|
||||
/**
|
||||
* Returns the spacing between columns
|
||||
* Returns the spacing between columns. Docblock only (no PHP
|
||||
* native return type) so subclasses that don't declare return
|
||||
* types stay compatible. Widened from int to int|float because
|
||||
* some sheet layouts (Hema/_14130046, Hema/_38310012) define
|
||||
* fractional spacings (2.0, 3.0, 4.0 mm) that would round
|
||||
* incorrectly if coerced to int.
|
||||
*
|
||||
* @return int
|
||||
* @return int|float
|
||||
*/
|
||||
abstract public function getLabelColumnSpacing();
|
||||
|
||||
/**
|
||||
* Returns the spacing between rows
|
||||
* Returns the spacing between rows. See getLabelColumnSpacing for
|
||||
* the int|float rationale.
|
||||
*
|
||||
* @return int
|
||||
* @return int|float
|
||||
*/
|
||||
abstract public function getLabelRowSpacing();
|
||||
|
||||
|
||||
@ -23,7 +23,15 @@ class WelcomeNotification extends Notification
|
||||
*/
|
||||
public function __construct(public User $user)
|
||||
{
|
||||
$this->user->token = Password::broker('invites')->createToken($user);
|
||||
// Password::broker() is typed to return the interface
|
||||
// Illuminate\Contracts\Auth\PasswordBroker, which doesn't
|
||||
// declare createToken(). The concrete Illuminate\Auth\Passwords\
|
||||
// PasswordBroker does. Narrow the type locally so PHPStan can
|
||||
// resolve the method against the concrete class.
|
||||
/** @var \Illuminate\Auth\Passwords\PasswordBroker $broker */
|
||||
$broker = Password::broker('invites');
|
||||
|
||||
$this->user->token = $broker->createToken($user);
|
||||
$this->user->expire_date = now()->addMinutes((int) config('auth.passwords.invites.expire', 2880))->format('F j, Y, g:i a');
|
||||
}
|
||||
|
||||
|
||||
@ -7752,18 +7752,6 @@ parameters:
|
||||
count: 4
|
||||
path: app/Models/Group.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\DefaultLabel\:\:getLabelColumnSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/DefaultLabel.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\DefaultLabel\:\:getLabelRowSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/DefaultLabel.php
|
||||
|
||||
-
|
||||
message: '#^Access to an undefined property App\\Models\\Asset\:\:\$assigned\.$#'
|
||||
identifier: property.notFound
|
||||
@ -7890,18 +7878,6 @@ parameters:
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheet.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\L4736\:\:getLabelColumnSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/L4736.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\L4736\:\:getLabelRowSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/L4736.php
|
||||
|
||||
-
|
||||
message: '#^Constant App\\Models\\Labels\\Sheets\\Avery\\L4736_A\:\:LABEL_MARGIN is unused\.$#'
|
||||
identifier: classConstant.unused
|
||||
@ -7914,18 +7890,6 @@ parameters:
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/L4736_A.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\L6009\:\:getLabelColumnSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/L6009.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\L6009\:\:getLabelRowSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/L6009.php
|
||||
|
||||
-
|
||||
message: '#^Constant App\\Models\\Labels\\Sheets\\Avery\\L6009_A\:\:LABEL_MARGIN is unused\.$#'
|
||||
identifier: classConstant.unused
|
||||
@ -7938,66 +7902,18 @@ parameters:
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/L6009_A.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\L7162\:\:getLabelColumnSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/L7162.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\L7162\:\:getLabelRowSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/L7162.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\L7163\:\:getLabelColumnSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/L7163.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\L7163\:\:getLabelRowSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/L7163.php
|
||||
|
||||
-
|
||||
message: '#^Constant App\\Models\\Labels\\Sheets\\Avery\\L7163_A\:\:LABEL_MARGIN is unused\.$#'
|
||||
identifier: classConstant.unused
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/L7163_A.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\_3490\:\:getLabelColumnSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/_3490.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\_3490\:\:getLabelRowSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/_3490.php
|
||||
|
||||
-
|
||||
message: '#^Constant App\\Models\\Labels\\Sheets\\Avery\\_3490_A\:\:TAG_SIZE is unused\.$#'
|
||||
identifier: classConstant.unused
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/_3490_A.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\_5267\:\:getLabelColumnSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/_5267.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\_5267\:\:getLabelRowSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/_5267.php
|
||||
|
||||
-
|
||||
message: '#^Constant App\\Models\\Labels\\Sheets\\Avery\\_5267_A\:\:FIELD_MARGIN is unused\.$#'
|
||||
identifier: classConstant.unused
|
||||
@ -8010,18 +7926,6 @@ parameters:
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/_5267_A.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\_5520\:\:getLabelColumnSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/_5520.php
|
||||
|
||||
-
|
||||
message: '#^Method App\\Models\\Labels\\Sheets\\Avery\\_5520\:\:getLabelRowSpacing\(\) should return int but returns float\.$#'
|
||||
identifier: return.type
|
||||
count: 1
|
||||
path: app/Models/Labels/Sheets/Avery/_5520.php
|
||||
|
||||
-
|
||||
message: '#^Constant App\\Models\\Labels\\Sheets\\Avery\\_5520_A\:\:TAG_SIZE is unused\.$#'
|
||||
identifier: classConstant.unused
|
||||
@ -12204,31 +12108,3 @@ parameters:
|
||||
count: 2
|
||||
path: routes/web.php
|
||||
|
||||
# Added manually. These five findings show up on the PHP 8.5 CI
|
||||
# runner but not on a long-lived local composer install, most
|
||||
# likely because a fresh vendor resolves larastan's facade /
|
||||
# interface class map slightly differently. Real findings worth
|
||||
# fixing later, not this PR's scope:
|
||||
# Crypt::Decrypt should be Crypt::decrypt (Laravel facade
|
||||
# camelCase convention; runtime still works via PHP's case-
|
||||
# insensitive method dispatch). PasswordBroker::getUser and
|
||||
# ::createToken live on the concrete Illuminate\Auth\Passwords\
|
||||
# PasswordBroker but not on the Illuminate\Contracts\Auth\
|
||||
# PasswordBroker interface that broker() is typed to return.
|
||||
-
|
||||
message: '#^Call to an undefined static method Illuminate\\Support\\Facades\\Crypt\:\:Decrypt\(\)\.$#'
|
||||
identifier: staticMethod.notFound
|
||||
count: 3
|
||||
path: app/Console/Commands/LdapTroubleshooter.php
|
||||
|
||||
-
|
||||
message: '#^Call to an undefined method Illuminate\\Contracts\\Auth\\PasswordBroker\:\:getUser\(\)\.$#'
|
||||
identifier: method.notFound
|
||||
count: 1
|
||||
path: app/Http/Controllers/Auth/ResetPasswordController.php
|
||||
|
||||
-
|
||||
message: '#^Call to an undefined method Illuminate\\Contracts\\Auth\\PasswordBroker\:\:createToken\(\)\.$#'
|
||||
identifier: method.notFound
|
||||
count: 1
|
||||
path: app/Notifications/WelcomeNotification.php
|
||||
|
||||
Reference in New Issue
Block a user