mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Static analysis
This commit is contained in:
parent
e371721b3f
commit
d22c9a3bd9
@ -57,6 +57,7 @@ class ActivityExport extends BaseExport
|
||||
|
||||
$report = $query->cursor()
|
||||
->map(function ($resource) {
|
||||
/** @var \App\Models\Activity $resource */
|
||||
$row = $this->buildActivityRow($resource);
|
||||
return $this->processMetaData($row, $resource);
|
||||
})->toArray();
|
||||
@ -128,6 +129,9 @@ class ActivityExport extends BaseExport
|
||||
|
||||
$query->cursor()
|
||||
->each(function ($entity) {
|
||||
|
||||
/** @var \App\Models\Activity $entity */
|
||||
|
||||
$this->buildRow($entity);
|
||||
});
|
||||
|
||||
|
@ -102,6 +102,8 @@ class ClientExport extends BaseExport
|
||||
|
||||
$report = $query->cursor()
|
||||
->map(function ($client) {
|
||||
|
||||
/** @var \App\Models\Client $client */
|
||||
$row = $this->buildRow($client);
|
||||
return $this->processMetaData($row, $client);
|
||||
})->toArray();
|
||||
@ -154,6 +156,8 @@ class ClientExport extends BaseExport
|
||||
|
||||
$query->cursor()
|
||||
->each(function ($client) {
|
||||
|
||||
/** @var \App\Models\Client $client */
|
||||
$this->csv->insertOne($this->buildRow($client));
|
||||
});
|
||||
|
||||
|
@ -161,7 +161,7 @@ class TaskExport extends BaseExport
|
||||
|
||||
}
|
||||
|
||||
if (is_null($task->time_log) || (is_array(json_decode($task->time_log, 1)) && count(json_decode($task->time_log, 1)) == 0)) {
|
||||
if (is_null($task->time_log) || (is_array(json_decode($task->time_log, true)) && count(json_decode($task->time_log, true)) == 0)) {
|
||||
$this->storage_array[] = $entity;
|
||||
} else {
|
||||
$this->iterateLogs($task, $entity);
|
||||
@ -178,7 +178,7 @@ class TaskExport extends BaseExport
|
||||
$timezone_name = $timezone->name;
|
||||
}
|
||||
|
||||
$logs = json_decode($task->time_log, 1);
|
||||
$logs = json_decode($task->time_log, true);
|
||||
|
||||
$date_format_default = $this->date_format;
|
||||
|
||||
|
@ -48,7 +48,7 @@ class TaskDecorator extends Decorator implements DecoratorInterface
|
||||
$timezone_name = $timezone->name;
|
||||
}
|
||||
|
||||
$logs = json_decode($task->time_log, 1);
|
||||
$logs = json_decode($task->time_log, true);
|
||||
|
||||
$date_format_default = 'Y-m-d';
|
||||
|
||||
@ -77,7 +77,7 @@ class TaskDecorator extends Decorator implements DecoratorInterface
|
||||
$timezone_name = $timezone->name;
|
||||
}
|
||||
|
||||
$logs = json_decode($task->time_log, 1);
|
||||
$logs = json_decode($task->time_log, true);
|
||||
|
||||
$date_format_default = 'Y-m-d';
|
||||
|
||||
|
@ -175,7 +175,7 @@ class RecurringExpenseToExpenseFactory
|
||||
|
||||
$_value = explode($_operation, $right); // [MONTHYEAR, 4]
|
||||
|
||||
$_right = Carbon::createFromDate(now()->year, now()->month)->addMonths($_value[1])->translatedFormat('F Y');
|
||||
$_right = Carbon::createFromDate(now()->year, now()->month)->addMonths($_value[1])->translatedFormat('F Y'); //@phpstan-ignore-line
|
||||
}
|
||||
|
||||
$replacement = sprintf('%s to %s', $_left, $_right);
|
||||
|
@ -27,7 +27,7 @@ function nlog($output, $context = []): void
|
||||
}
|
||||
|
||||
if (gettype($output) == 'object') {
|
||||
$output = print_r($output, 1);
|
||||
$output = print_r($output, true);
|
||||
}
|
||||
|
||||
// $trace = debug_backtrace();
|
||||
@ -53,7 +53,7 @@ function nrlog($output, $context = []): void
|
||||
}
|
||||
|
||||
if (gettype($output) == 'object') {
|
||||
$output = print_r($output, 1);
|
||||
$output = print_r($output, true);
|
||||
}
|
||||
|
||||
// $trace = debug_backtrace();
|
||||
|
@ -267,7 +267,7 @@ class MigrationController extends BaseController
|
||||
|
||||
if ($request->companies) {
|
||||
//handle Laravel 5.5 UniHTTP
|
||||
$companies = json_decode($request->companies, 1);
|
||||
$companies = json_decode($request->companies, true);
|
||||
} else {
|
||||
//handle Laravel 6 Guzzle
|
||||
$companies = [];
|
||||
@ -275,7 +275,7 @@ class MigrationController extends BaseController
|
||||
foreach ($request->all() as $input) {
|
||||
if ($input instanceof UploadedFile) {
|
||||
} else {
|
||||
$companies[] = json_decode($input, 1);
|
||||
$companies[] = json_decode($input, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ class PreviewController extends BaseController
|
||||
/** @var \App\Models\Company $company */
|
||||
$company = $user->company();
|
||||
|
||||
$design_object = json_decode(json_encode(request()->input('design')), 1);
|
||||
$design_object = json_decode(json_encode(request()->input('design')), true);
|
||||
|
||||
$ts = (new TemplateService());
|
||||
|
||||
|
@ -69,7 +69,7 @@ class StoreTaskRequest extends Request
|
||||
|
||||
foreach ($values as $k) {
|
||||
if (!is_int($k[0]) || !is_int($k[1])) {
|
||||
return $fail('The '.$attribute.' - '.print_r($k, 1).' is invalid. Unix timestamps only.');
|
||||
return $fail('The '.$attribute.' - '.print_r($k, true).' is invalid. Unix timestamps only.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ class UpdateTaskRequest extends Request
|
||||
|
||||
foreach ($values as $k) {
|
||||
if (!is_int($k[0]) || !is_int($k[1])) {
|
||||
return $fail('The '.$attribute.' - '.print_r($k, 1).' is invalid. Unix timestamps only.');
|
||||
return $fail('The '.$attribute.' - '.print_r($k, true).' is invalid. Unix timestamps only.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ class ExpenseTransformer extends BaseTransformer
|
||||
'client_id' => isset($data['expense.client'])
|
||||
? $this->getClientId($data['expense.client'])
|
||||
: null,
|
||||
'date' => strlen($this->getString($data, 'expense.date') > 1) ? $this->parseDate($data['expense.date']) : now()->format('Y-m-d'),
|
||||
'date' => strlen($this->getString($data, 'expense.date')) > 1 ? $this->parseDate($data['expense.date']) : now()->format('Y-m-d'),
|
||||
'public_notes' => $this->getString($data, 'expense.public_notes'),
|
||||
'private_notes' => $this->getString($data, 'expense.private_notes'),
|
||||
'category_id' => isset($data['expense.category'])
|
||||
|
@ -140,6 +140,6 @@ class UpdateOrCreateProduct implements ShouldQueue
|
||||
public function failed($exception = null)
|
||||
{
|
||||
info('update create failed with = ');
|
||||
info(print_r($exception->getMessage(), 1));
|
||||
nlog($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -202,6 +202,6 @@ class SendRecurring implements ShouldQueue
|
||||
LightLogs::create($job_failure)
|
||||
->send();
|
||||
|
||||
nlog(print_r($exception->getMessage(), 1));
|
||||
nlog($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ class Import implements ShouldQueue
|
||||
|
||||
$user->setCompany($this->company);
|
||||
|
||||
$array = json_decode(file_get_contents($this->file_path), 1);
|
||||
$array = json_decode(file_get_contents($this->file_path), true);
|
||||
$data = $array['data'];
|
||||
|
||||
foreach ($this->available_imports as $import) {
|
||||
@ -2010,7 +2010,7 @@ class Import implements ShouldQueue
|
||||
public function transformId($resource, string $old): int
|
||||
{
|
||||
if (! array_key_exists($resource, $this->ids)) {
|
||||
info(print_r($resource, 1));
|
||||
nlog($resource);
|
||||
throw new Exception("Resource {$resource} not available.");
|
||||
}
|
||||
|
||||
@ -2067,11 +2067,10 @@ class Import implements ShouldQueue
|
||||
LightLogs::create($job_failure)
|
||||
->queue();
|
||||
|
||||
nlog(print_r($exception->getMessage(), 1));
|
||||
nlog($exception->getMessage());
|
||||
|
||||
// if (Ninja::isHosted()) {
|
||||
app('sentry')->captureException($exception);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -168,6 +168,6 @@ class StartMigration implements ShouldQueue
|
||||
|
||||
public function failed($exception = null)
|
||||
{
|
||||
info(print_r($exception->getMessage(), 1));
|
||||
nlog($exception->getMessage());
|
||||
}
|
||||
}
|
||||
|
2
app/Jobs/Vendor/CreatePurchaseOrderPdf.php
vendored
2
app/Jobs/Vendor/CreatePurchaseOrderPdf.php
vendored
@ -199,7 +199,7 @@ class CreatePurchaseOrderPdf implements ShouldQueue
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
nlog(print_r($e->getMessage(), 1));
|
||||
nlog($e->getMessage());
|
||||
}
|
||||
|
||||
if (config('ninja.log_pdf_html')) {
|
||||
|
@ -87,7 +87,7 @@ class PaymentMigrationRepository extends BaseRepository
|
||||
|
||||
if (! array_key_exists('status_id', $data)) {
|
||||
info('payment with no status id?');
|
||||
info(print_r($data, 1));
|
||||
info(print_r($data, true));
|
||||
}
|
||||
|
||||
$payment->status_id = $data['status_id'];
|
||||
|
@ -130,7 +130,7 @@ class SubscriptionRepository extends BaseRepository
|
||||
private function convertV3Bundle($bundle): array
|
||||
{
|
||||
if(is_object($bundle)) {
|
||||
$bundle = json_decode(json_encode($bundle), 1);
|
||||
$bundle = json_decode(json_encode($bundle), true);
|
||||
}
|
||||
|
||||
$items = [];
|
||||
|
@ -386,7 +386,7 @@ class PdfConfiguration
|
||||
$decimal = $this->country->decimal_separator;
|
||||
}
|
||||
|
||||
if (isset($this->country->swap_currency_symbol) && strlen($this->country->swap_currency_symbol) >= 1) {
|
||||
if (isset($this->country->swap_currency_symbol) && $this->country->swap_currency_symbol == 1) {
|
||||
$swapSymbol = $this->country->swap_currency_symbol;
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ class PdfService
|
||||
}
|
||||
|
||||
} catch (\Exception $e) {
|
||||
nlog(print_r($e->getMessage(), 1));
|
||||
nlog($e->getMessage());
|
||||
throw new \Exception($e->getMessage(), $e->getCode());
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ class Helpers
|
||||
|
||||
$_value = explode($_operation, $right); // [MONTHYEAR, 4]
|
||||
|
||||
$_right = Carbon::createFromDate($currentDateTime->year, $currentDateTime->month)->addMonths($_value[1])->translatedFormat('F Y');
|
||||
$_right = Carbon::createFromDate($currentDateTime->year, $currentDateTime->month)->addMonths($_value[1])->translatedFormat('F Y'); //@phpstan-ignore-line
|
||||
}
|
||||
|
||||
$replacement = sprintf('%s to %s', $_left, $_right);
|
||||
|
@ -255,7 +255,7 @@ class Number
|
||||
$decimal = $country->decimal_separator;
|
||||
}
|
||||
|
||||
if (isset($country->swap_currency_symbol) && strlen($country->swap_currency_symbol) >= 1) {
|
||||
if (isset($country->swap_currency_symbol) && $country->swap_currency_symbol == 1) {
|
||||
$swapSymbol = $country->swap_currency_symbol;
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,8 @@ trait PdfMaker
|
||||
/**
|
||||
* Returns a PDF stream.
|
||||
*
|
||||
* @param string $header Header to be included in PDF
|
||||
* @param string $footer Footer to be included in PDF
|
||||
* @param string|null $header Header to be included in PDF
|
||||
* @param string|null $footer Footer to be included in PDF
|
||||
* @param string $html The HTML object to be converted into PDF
|
||||
*
|
||||
* @return string The PDF string
|
||||
|
@ -3,7 +3,7 @@ includes:
|
||||
- ./vendor/spaze/phpstan-stripe/extension.neon
|
||||
- phpstan-baseline.neon
|
||||
parameters:
|
||||
level: 4
|
||||
level: 5
|
||||
paths:
|
||||
- app
|
||||
excludePaths:
|
||||
|
Loading…
Reference in New Issue
Block a user