mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 19:01:58 +00:00
Not sure why I keep calling this tool nestor, it's called rector
This commit is contained in:
@@ -24,8 +24,12 @@
|
||||
declare(strict_types=1);
|
||||
|
||||
use Rector\Config\RectorConfig;
|
||||
use Rector\EarlyReturn\Rector\If_\ChangeOrIfContinueToMultiContinueRector;
|
||||
|
||||
return RectorConfig::configure()
|
||||
->withSkip([
|
||||
ChangeOrIfContinueToMultiContinueRector::class,
|
||||
])
|
||||
->withPaths([
|
||||
// __DIR__ . '/../app',
|
||||
__DIR__ . '/../app/Http',
|
||||
@@ -43,9 +47,9 @@ __DIR__ . '/../app/Http',
|
||||
privatization: false, // leave false.
|
||||
naming : false, // leave false
|
||||
instanceOf : true,
|
||||
earlyReturn : false,
|
||||
strictBooleans : false,
|
||||
carbon : false,
|
||||
earlyReturn : true,
|
||||
strictBooleans : true,
|
||||
carbon : true,
|
||||
rectorPreset : false,
|
||||
phpunitCodeQuality : false,
|
||||
doctrineCodeQuality: false,
|
||||
@@ -61,4 +65,5 @@ __DIR__ . '/../app/Http',
|
||||
->withTypeCoverageLevel(0)
|
||||
->withDeadCodeLevel(0)
|
||||
->withCodeQualityLevel(0)
|
||||
|
||||
->withImportNames(removeUnusedImports: true);// import statements instead of full classes.
|
||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Admin;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Helpers\Update\UpdateTrait;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Middleware\IsDemoUser;
|
||||
@@ -96,7 +97,7 @@ class UpdateController extends Controller
|
||||
$channel = in_array($channel, ['stable', 'beta', 'alpha'], true) ? $channel : 'stable';
|
||||
|
||||
app('fireflyconfig')->set('permission_update_check', $checkForUpdates);
|
||||
app('fireflyconfig')->set('last_update_check', time());
|
||||
app('fireflyconfig')->set('last_update_check', Carbon::now()->getTimestamp());
|
||||
app('fireflyconfig')->set('update_channel', $channel);
|
||||
session()->flash('success', (string) trans('firefly.configuration_updated'));
|
||||
|
||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Auth;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Facades\Cookie;
|
||||
use FireflyIII\Events\ActuallyLoggedIn;
|
||||
@@ -253,7 +254,7 @@ class LoginController extends Controller
|
||||
$storeInCookie = config('google2fa.store_in_cookie', false);
|
||||
if (false !== $storeInCookie) {
|
||||
$cookieName = config('google2fa.cookie_name', 'google2fa_token');
|
||||
Cookie::queue(Cookie::make($cookieName, 'invalid-'.time()));
|
||||
Cookie::queue(Cookie::make($cookieName, 'invalid-'.Carbon::now()->getTimestamp()));
|
||||
}
|
||||
$usernameField = $this->username();
|
||||
|
||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Auth;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Events\Security\MFABackupFewLeft;
|
||||
use FireflyIII\Events\Security\MFABackupNoLeft;
|
||||
use FireflyIII\Events\Security\MFAManyFailedAttempts;
|
||||
@@ -129,7 +130,7 @@ class TwoFactorController extends Controller
|
||||
*/
|
||||
private function inMFAHistory(string $mfaCode, array $mfaHistory): bool
|
||||
{
|
||||
$now = time();
|
||||
$now = Carbon::now()->getTimestamp();
|
||||
foreach ($mfaHistory as $entry) {
|
||||
$time = $entry['time'];
|
||||
$code = $entry['code'];
|
||||
@@ -149,7 +150,7 @@ class TwoFactorController extends Controller
|
||||
/** @var array $mfaHistory */
|
||||
$mfaHistory = app('preferences')->get('mfa_history', [])->data;
|
||||
$newHistory = [];
|
||||
$now = time();
|
||||
$now = Carbon::now()->getTimestamp();
|
||||
foreach ($mfaHistory as $entry) {
|
||||
$time = $entry['time'];
|
||||
$code = $entry['code'];
|
||||
@@ -184,7 +185,7 @@ class TwoFactorController extends Controller
|
||||
/** @var array $mfaHistory */
|
||||
$mfaHistory = app('preferences')->get('mfa_history', [])->data;
|
||||
$entry = [
|
||||
'time' => time(),
|
||||
'time' => Carbon::now()->getTimestamp(),
|
||||
'code' => $mfaCode,
|
||||
];
|
||||
$mfaHistory[] = $entry;
|
||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Export;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
@@ -92,7 +93,7 @@ class IndexController extends Controller
|
||||
$generator->setStart($firstDate);
|
||||
$result = $generator->export();
|
||||
|
||||
$name = sprintf('%s_transaction_export.csv', date('Y_m_d'));
|
||||
$name = sprintf('%s_transaction_export.csv', Carbon::now()->format('Y_m_d'));
|
||||
$quoted = sprintf('"%s"', addcslashes($name, '"\\'));
|
||||
|
||||
// headers for CSV file.
|
||||
|
@@ -153,7 +153,7 @@ class RecurrenceController extends Controller
|
||||
*/
|
||||
public function suggest(Request $request): JsonResponse
|
||||
{
|
||||
$string = '' === (string) $request->get('date') ? date('Y-m-d') : (string) $request->get('date');
|
||||
$string = '' === (string) $request->get('date') ? Carbon::now()->format('Y-m-d') : (string) $request->get('date');
|
||||
$today = today(config('app.timezone'))->startOfDay();
|
||||
|
||||
try {
|
||||
|
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use JsonException;
|
||||
use function Safe\json_decode;
|
||||
use function Safe\file_get_contents;
|
||||
@@ -114,7 +115,7 @@ class PreferencesController extends Controller
|
||||
if (is_array($fiscalYearStartStr)) {
|
||||
$fiscalYearStartStr = '01-01';
|
||||
}
|
||||
$fiscalYearStart = sprintf('%s-%s', date('Y'), (string) $fiscalYearStartStr);
|
||||
$fiscalYearStart = sprintf('%s-%s', Carbon::now()->format('Y'), (string) $fiscalYearStartStr);
|
||||
$tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
|
||||
$availableDarkModes = config('firefly.available_dark_modes');
|
||||
|
||||
@@ -277,7 +278,7 @@ class PreferencesController extends Controller
|
||||
$customFiscalYear = 1 === (int) $request->get('customFiscalYear');
|
||||
$string = strtotime((string) $request->get('fiscalYearStart'));
|
||||
if (false !== $string) {
|
||||
$fiscalYearStart = date('m-d', $string);
|
||||
$fiscalYearStart = Carbon::createFromTimestamp($string)->format('m-d');
|
||||
Preferences::set('customFiscalYear', $customFiscalYear);
|
||||
Preferences::set('fiscalYearStart', $fiscalYearStart);
|
||||
}
|
||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Http\Controllers\Profile;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Cookie;
|
||||
use Google2FA;
|
||||
use FireflyIII\Events\Security\DisabledMFA;
|
||||
@@ -296,7 +297,7 @@ class MfaController extends Controller
|
||||
/** @var array $mfaHistory */
|
||||
$mfaHistory = app('preferences')->get('mfa_history', [])->data;
|
||||
$entry = [
|
||||
'time' => time(),
|
||||
'time' => Carbon::now()->getTimestamp(),
|
||||
'code' => $mfaCode,
|
||||
];
|
||||
$mfaHistory[] = $entry;
|
||||
@@ -313,7 +314,7 @@ class MfaController extends Controller
|
||||
/** @var array $mfaHistory */
|
||||
$mfaHistory = app('preferences')->get('mfa_history', [])->data;
|
||||
$newHistory = [];
|
||||
$now = time();
|
||||
$now = Carbon::now()->getTimestamp();
|
||||
foreach ($mfaHistory as $entry) {
|
||||
$time = $entry['time'];
|
||||
$code = $entry['code'];
|
||||
|
Reference in New Issue
Block a user