diff --git a/.azure/azure.sig b/.azure/azure.sig index 7a35d72a9..651239a59 100644 Binary files a/.azure/azure.sig and b/.azure/azure.sig differ diff --git a/.azure/job-analyzers.yml b/.azure/job-analyzers.yml index 02c3a6be2..a3e1ef20a 100644 --- a/.azure/job-analyzers.yml +++ b/.azure/job-analyzers.yml @@ -16,5 +16,5 @@ jobs: - template: step-prepare-environment.yml - template: step-composer-install.yml - - script: php artisan code:analyse + - script: vendor/bin/phpstan analyse displayName: Run phpstan diff --git a/.styleci.yml b/.styleci.yml index 40b5214e3..33d0075b7 100644 --- a/.styleci.yml +++ b/.styleci.yml @@ -4,6 +4,7 @@ enabled: - fully_qualified_strict_types disabled: - alpha_ordered_imports + - no_useless_return finder: not-name: - index.php diff --git a/app/Console/Commands/ImportCSV.php b/app/Console/Commands/ImportCSV.php index f06d5b054..fa46de236 100644 --- a/app/Console/Commands/ImportCSV.php +++ b/app/Console/Commands/ImportCSV.php @@ -35,14 +35,14 @@ class ImportCSV extends Command /** * The contact field email object. * - * @var array + * @var int|null */ public $contactFieldEmailId; /** * The contact field phone object. * - * @var array + * @var int|null */ public $contactFieldPhoneId; diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index e22bbd56b..e3c2389ac 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -78,13 +78,4 @@ class Handler extends ExceptionHandler return parent::render($request, $e); } - - protected function whoopsHandler() - { - try { - return app(\Whoops\Handler\HandlerInterface::class); - } catch (\Illuminate\Contracts\Container\BindingResolutionException $e) { - return parent::whoopsHandler(); - } - } } diff --git a/app/Helpers/DateHelper.php b/app/Helpers/DateHelper.php index ffb4b88c6..2661d8da2 100644 --- a/app/Helpers/DateHelper.php +++ b/app/Helpers/DateHelper.php @@ -90,7 +90,7 @@ class DateHelper $date = $date->date; } if (! $date instanceof Carbon) { - $date = Carbon::create($date); + $date = Carbon::parse($date); } return $date->translatedFormat(config('api.timestamp_format')); @@ -111,7 +111,7 @@ class DateHelper $date = $date->date; } if (! $date instanceof Carbon) { - $date = Carbon::create($date); + $date = Carbon::parse($date); } return $date->translatedFormat(config('api.date_timestamp_format')); @@ -122,11 +122,9 @@ class DateHelper * * @return string|null */ - public static function getTimezone() + public static function getTimezone(): ?string { - if (Auth::check()) { - return Auth::user()->timezone; - } + return Auth::check() ? Auth::user()->timezone : null; } /** diff --git a/app/Helpers/LocaleHelper.php b/app/Helpers/LocaleHelper.php index eda040d2d..81b8f9bb0 100644 --- a/app/Helpers/LocaleHelper.php +++ b/app/Helpers/LocaleHelper.php @@ -72,7 +72,7 @@ class LocaleHelper * * @return string|null country, uppercase form. */ - public static function extractCountry($locale = null) + public static function extractCountry($locale = null): ?string { if (is_null($locale)) { $locale = App::getLocale(); @@ -82,6 +82,8 @@ class LocaleHelper return mb_strtoupper($locale); } + + return null; } /** diff --git a/app/Helpers/RequestHelper.php b/app/Helpers/RequestHelper.php index 89f37946f..a40c5abd6 100644 --- a/app/Helpers/RequestHelper.php +++ b/app/Helpers/RequestHelper.php @@ -35,13 +35,11 @@ class RequestHelper * @param string $ip * @return string|null */ - public static function country($ip) + public static function country($ip): ?string { $position = Location::get($ip); - if ($position) { - return $position->countryCode; - } + return $position ? $position->countryCode : null; } /** diff --git a/app/Helpers/TimezoneHelper.php b/app/Helpers/TimezoneHelper.php index 068cfee08..44fddf379 100644 --- a/app/Helpers/TimezoneHelper.php +++ b/app/Helpers/TimezoneHelper.php @@ -18,13 +18,15 @@ class TimezoneHelper $list = []; $timezones = DateTimeZone::listIdentifiers(); - foreach ($timezones as $timezone) { - [$tz, $name] = self::formatTimezone($timezone); - array_push($list, [ - 'id' => $tz, - 'timezone' => $timezone, - 'name' => $name, - ]); + if ($timezones !== false) { + foreach ($timezones as $timezone) { + [$tz, $name] = self::formatTimezone($timezone); + array_push($list, [ + 'id' => $tz, + 'timezone' => $timezone, + 'name' => $name, + ]); + } } $collect = collect($list) diff --git a/app/Helpers/VCardHelper.php b/app/Helpers/VCardHelper.php index 3fc6d2e26..a278c1c2d 100644 --- a/app/Helpers/VCardHelper.php +++ b/app/Helpers/VCardHelper.php @@ -13,17 +13,16 @@ class VCardHelper * @param VCard $vCard * @return string|null */ - public static function getCountryISOFromSabreVCard(VCard $vCard) + public static function getCountryISOFromSabreVCard(VCard $vCard): ?string { $vCardAddress = $vCard->ADR; if (empty($vCardAddress)) { - return; + return null; } $country = Arr::get($vCardAddress->getParts(), '6'); - if (! empty($country)) { - return CountriesHelper::find($country); - } + + return empty($country) ? null : CountriesHelper::find($country); } } diff --git a/app/Helpers/helpers.php b/app/Helpers/helpers.php index 8c410f66d..b595743b1 100644 --- a/app/Helpers/helpers.php +++ b/app/Helpers/helpers.php @@ -2,6 +2,7 @@ use App\Helpers\LocaleHelper; use Illuminate\Support\Facades\Storage; +use League\Flysystem\Adapter\AbstractAdapter; if (! function_exists('htmldir')) { /** @@ -21,9 +22,9 @@ if (! function_exists('disk_adapter')) { * Get the adapter for a disk. * * @param string|null $disk - * @return \League\Flysystem\Adapter\AbstractAdapter + * @return \League\Flysystem\Adapter\AbstractAdapter|null */ - function disk_adapter($disk = null) + function disk_adapter($disk = null): ?AbstractAdapter { $driver = Storage::disk($disk)->getDriver(); if ($driver instanceof \League\Flysystem\Filesystem) { @@ -32,5 +33,7 @@ if (! function_exists('disk_adapter')) { return $adapter; } } + + return null; } } diff --git a/app/Http/Controllers/Api/Auth/OAuthController.php b/app/Http/Controllers/Api/Auth/OAuthController.php index 05ef3333a..764aed87a 100644 --- a/app/Http/Controllers/Api/Auth/OAuthController.php +++ b/app/Http/Controllers/Api/Auth/OAuthController.php @@ -86,6 +86,8 @@ class OAuthController extends Controller return Route::respondWithRoute('oauth.verify'); } + + return; } /** @@ -188,6 +190,7 @@ class OAuthController extends Controller private function proxy(array $data = []): array { $url = App::runningUnitTests() ? config('app.url').'/oauth/token' : route('passport.token'); + /** @var \Illuminate\Http\Response */ $response = app(Kernel::class)->handle(Request::create($url, 'POST', [ 'grant_type' => $data['grantType'], 'client_id' => config('monica.mobile_client_id'), diff --git a/app/Http/Controllers/Auth/PasswordChangeController.php b/app/Http/Controllers/Auth/PasswordChangeController.php index ef556bee2..fcc03320a 100644 --- a/app/Http/Controllers/Auth/PasswordChangeController.php +++ b/app/Http/Controllers/Auth/PasswordChangeController.php @@ -61,7 +61,7 @@ class PasswordChangeController extends Controller return $user; } - if ($user instanceof Authenticatable) { + if ($user instanceof User) { $this->setNewPassword($user, $credentials['password']); } diff --git a/app/Http/Controllers/Contacts/CallsController.php b/app/Http/Controllers/Contacts/CallsController.php index 9b18d85ec..6c7223ed2 100644 --- a/app/Http/Controllers/Contacts/CallsController.php +++ b/app/Http/Controllers/Contacts/CallsController.php @@ -90,5 +90,7 @@ class CallsController extends Controller } catch (\Exception $e) { return $this->respondNotFound(); } + + return; } } diff --git a/app/Http/Controllers/Contacts/DocumentsController.php b/app/Http/Controllers/Contacts/DocumentsController.php index 4c95c9940..61c5431df 100644 --- a/app/Http/Controllers/Contacts/DocumentsController.php +++ b/app/Http/Controllers/Contacts/DocumentsController.php @@ -63,9 +63,13 @@ class DocumentsController extends Controller ]; try { - app(DestroyDocument::class)->execute($data); + if (app(DestroyDocument::class)->execute($data)) { + return $this->respondObjectDeleted($document->id); + } } catch (\Exception $e) { return $this->respondNotFound(); } + + return; } } diff --git a/app/Http/Controllers/Contacts/PhotosController.php b/app/Http/Controllers/Contacts/PhotosController.php index 94655da04..57554e8a8 100644 --- a/app/Http/Controllers/Contacts/PhotosController.php +++ b/app/Http/Controllers/Contacts/PhotosController.php @@ -81,5 +81,7 @@ class PhotosController extends Controller 'source' => 'adorable', ]); } + + return $this->respondObjectDeleted($photo->id); } } diff --git a/app/Http/Controllers/DAV/Backend/CalDAV/CalDAVBackend.php b/app/Http/Controllers/DAV/Backend/CalDAV/CalDAVBackend.php index 0a0eb558b..5754f4e0f 100644 --- a/app/Http/Controllers/DAV/Backend/CalDAV/CalDAVBackend.php +++ b/app/Http/Controllers/DAV/Backend/CalDAV/CalDAVBackend.php @@ -128,6 +128,8 @@ class CalDAVBackend extends AbstractBackend implements SyncSupport if ($backend) { return $backend->getChanges($syncToken); } + + return []; } /** @@ -176,6 +178,8 @@ class CalDAVBackend extends AbstractBackend implements SyncSupport }) ->toArray(); } + + return []; } /** @@ -204,6 +208,8 @@ class CalDAVBackend extends AbstractBackend implements SyncSupport return $backend->prepareData($obj); } } + + return []; } /** @@ -247,12 +253,13 @@ class CalDAVBackend extends AbstractBackend implements SyncSupport * @param string $calendarData * @return string|null */ - public function updateCalendarObject($calendarId, $objectUri, $calendarData) + public function updateCalendarObject($calendarId, $objectUri, $calendarData): ?string { $backend = $this->getBackend($calendarId); - if ($backend) { - return $backend->updateOrCreateCalendarObject($objectUri, $calendarData); - } + + return $backend ? + $backend->updateOrCreateCalendarObject($objectUri, $calendarData) + : null; } /** diff --git a/app/Http/Controllers/DAV/Backend/CalDAV/CalDAVBirthdays.php b/app/Http/Controllers/DAV/Backend/CalDAV/CalDAVBirthdays.php index 11065be09..1608b1e84 100644 --- a/app/Http/Controllers/DAV/Backend/CalDAV/CalDAVBirthdays.php +++ b/app/Http/Controllers/DAV/Backend/CalDAV/CalDAVBirthdays.php @@ -76,6 +76,8 @@ class CalDAVBirthdays extends AbstractCalDAVBackend Log::debug(__CLASS__.' prepareData: '.(string) $e); } } + + return []; } private function hasBirthday($contact) @@ -126,8 +128,12 @@ class CalDAVBirthdays extends AbstractCalDAVBackend }); } - public function updateOrCreateCalendarObject($objectUri, $calendarData) + /** + * @return string|null + */ + public function updateOrCreateCalendarObject($objectUri, $calendarData): ?string { + return null; } public function deleteCalendarObject($objectUri) diff --git a/app/Http/Controllers/DAV/Backend/CalDAV/CalDAVTasks.php b/app/Http/Controllers/DAV/Backend/CalDAV/CalDAVTasks.php index 708603171..a08a94e70 100644 --- a/app/Http/Controllers/DAV/Backend/CalDAV/CalDAVTasks.php +++ b/app/Http/Controllers/DAV/Backend/CalDAV/CalDAVTasks.php @@ -102,6 +102,8 @@ class CalDAVTasks extends AbstractCalDAVBackend Log::debug(__CLASS__.' prepareData: '.(string) $e); } } + + return []; } /** @@ -121,7 +123,7 @@ class CalDAVTasks extends AbstractCalDAVBackend * @param string $calendarData * @return string|null */ - public function updateOrCreateCalendarObject($objectUri, $calendarData) + public function updateOrCreateCalendarObject($objectUri, $calendarData): ?string { $task_id = null; if ($objectUri) { @@ -151,6 +153,8 @@ class CalDAVTasks extends AbstractCalDAVBackend } catch (\Exception $e) { Log::debug(__CLASS__.' updateOrCreateCalendarObject: '.(string) $e); } + + return null; } /** diff --git a/app/Http/Controllers/DAV/Backend/CalDAV/ICalDAVBackend.php b/app/Http/Controllers/DAV/Backend/CalDAV/ICalDAVBackend.php index 2e732944d..14a13d2fe 100644 --- a/app/Http/Controllers/DAV/Backend/CalDAV/ICalDAVBackend.php +++ b/app/Http/Controllers/DAV/Backend/CalDAV/ICalDAVBackend.php @@ -102,7 +102,7 @@ interface ICalDAVBackend * @param string $calendarData * @return string|null */ - public function updateOrCreateCalendarObject($objectUri, $calendarData); + public function updateOrCreateCalendarObject($objectUri, $calendarData): ?string; /** * Deletes an existing calendar object. diff --git a/app/Http/Controllers/DAV/Backend/CardDAV/AddressBook.php b/app/Http/Controllers/DAV/Backend/CardDAV/AddressBook.php index bd151cb47..fc78b30b5 100644 --- a/app/Http/Controllers/DAV/Backend/CardDAV/AddressBook.php +++ b/app/Http/Controllers/DAV/Backend/CardDAV/AddressBook.php @@ -74,5 +74,7 @@ class AddressBook extends BaseAddressBook return $date->timestamp; } } + + return; } } diff --git a/app/Http/Controllers/DAV/Backend/CardDAV/CardDAVBackend.php b/app/Http/Controllers/DAV/Backend/CardDAV/CardDAVBackend.php index 36f1f4c1e..6b57040bd 100644 --- a/app/Http/Controllers/DAV/Backend/CardDAV/CardDAVBackend.php +++ b/app/Http/Controllers/DAV/Backend/CardDAV/CardDAVBackend.php @@ -159,9 +159,9 @@ class CardDAVBackend extends AbstractBackend implements SyncSupport, IDAVBackend * Prepare datas for this contact. * * @param Contact $contact - * @return array|null + * @return array */ - private function prepareCard($contact) + private function prepareCard($contact): array { try { $vcard = app(ExportVCard::class) @@ -351,6 +351,8 @@ class CardDAVBackend extends AbstractBackend implements SyncSupport, IDAVBackend Log::debug(__CLASS__.' updateCard: '.(string) $e); throw $e; } + + return; } /** @@ -381,7 +383,7 @@ class CardDAVBackend extends AbstractBackend implements SyncSupport, IDAVBackend * @param \Sabre\DAV\PropPatch $propPatch * @return bool|null */ - public function updateAddressBook($addressBookId, DAV\PropPatch $propPatch) + public function updateAddressBook($addressBookId, DAV\PropPatch $propPatch): ?bool { $propPatch->handle('{'.CalDAVPlugin::NS_CALENDARSERVER.'}me-card', function ($props) { $contact = $this->getObject($props->getHref()); @@ -396,6 +398,8 @@ class CardDAVBackend extends AbstractBackend implements SyncSupport, IDAVBackend return true; }); + + return null; } /** diff --git a/app/Http/Controllers/DAV/Backend/SyncDAVBackend.php b/app/Http/Controllers/DAV/Backend/SyncDAVBackend.php index c14ea002b..4ffa4d9f5 100644 --- a/app/Http/Controllers/DAV/Backend/SyncDAVBackend.php +++ b/app/Http/Controllers/DAV/Backend/SyncDAVBackend.php @@ -64,14 +64,14 @@ trait SyncDAVBackend { $max = $this->getLastModified(); - if ($max) { - return SyncToken::create([ + return $max ? + SyncToken::create([ 'account_id' => Auth::user()->account_id, 'user_id' => Auth::user()->id, 'name' => $this->backendUri(), 'timestamp' => $max, - ]); - } + ]) + : null; } /** diff --git a/app/Http/Controllers/DAV/DAVACL/PrincipalBackend.php b/app/Http/Controllers/DAV/DAVACL/PrincipalBackend.php index addddbd30..384e9997e 100644 --- a/app/Http/Controllers/DAV/DAVACL/PrincipalBackend.php +++ b/app/Http/Controllers/DAV/DAVACL/PrincipalBackend.php @@ -78,6 +78,8 @@ class PrincipalBackend extends AbstractBackend return $principal; } } + + return []; } /** diff --git a/app/Http/Controllers/JournalController.php b/app/Http/Controllers/JournalController.php index 68840f68b..a570ce1c8 100644 --- a/app/Http/Controllers/JournalController.php +++ b/app/Http/Controllers/JournalController.php @@ -39,7 +39,7 @@ class JournalController extends Controller $previousEntryYear = 0; $showCalendar = true; - foreach ($journalEntries as $journalEntry) { + foreach ($journalEntries->items() as $journalEntry) { if ($previousEntryMonth == $journalEntry->date->month && $previousEntryYear == $journalEntry->date->year) { $showCalendar = false; } diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php index 77b3beb28..1aeee7c2b 100644 --- a/app/Http/Controllers/SettingsController.php +++ b/app/Http/Controllers/SettingsController.php @@ -146,7 +146,7 @@ class SettingsController ->withErrors($e->getMessage()); } - auth()->logout(); + auth('')->logout(); return redirect()->route('login'); } diff --git a/app/Http/Controllers/TasksController.php b/app/Http/Controllers/TasksController.php index 858a4eead..cc5a3569a 100644 --- a/app/Http/Controllers/TasksController.php +++ b/app/Http/Controllers/TasksController.php @@ -68,11 +68,17 @@ class TasksController extends Controller */ public function destroy(Task $task) { - if (app(DestroyTask::class)->execute([ - 'task_id' => $task->id, - 'account_id' => auth()->user()->account_id, - ])) { - return $this->respondObjectDeleted($task->id); + try { + if (app(DestroyTask::class)->execute([ + 'task_id' => $task->id, + 'account_id' => auth()->user()->account_id, + ])) { + return $this->respondObjectDeleted($task->id); + } + } catch (\Exception $e) { + return $this->respondNotFound(); } + + return; } } diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.php index a4be5c587..05271cd15 100644 --- a/app/Http/Middleware/Authenticate.php +++ b/app/Http/Middleware/Authenticate.php @@ -17,5 +17,7 @@ class Authenticate extends Middleware if (! $request->expectsJson()) { return route('login'); } + + return ''; } } diff --git a/app/Http/Middleware/AuthenticateWithTokenOnBasicAuth.php b/app/Http/Middleware/AuthenticateWithTokenOnBasicAuth.php index 840a6a70f..b27eef9ad 100644 --- a/app/Http/Middleware/AuthenticateWithTokenOnBasicAuth.php +++ b/app/Http/Middleware/AuthenticateWithTokenOnBasicAuth.php @@ -69,7 +69,7 @@ class AuthenticateWithTokenOnBasicAuth $user = $guard->setRequest($request)->user(); } - if ($user && (! $request->getUser() || $request->getUser() === $user->email)) { + if ($user && (! $request->getUser() || (property_exists($user, 'email') && $request->getUser() === $user->email))) { $this->auth->guard()->setUser($user); } else { // Basic authentication diff --git a/app/Http/Resources/Account/User/User.php b/app/Http/Resources/Account/User/User.php index ced8fd468..c80d507ea 100644 --- a/app/Http/Resources/Account/User/User.php +++ b/app/Http/Resources/Account/User/User.php @@ -3,11 +3,14 @@ namespace App\Http\Resources\Account\User; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; use App\Http\Resources\Settings\Currency\Currency as CurrencyResource; -class User extends Resource +/** + * @extends JsonResource<\App\Models\User\User> + */ +class User extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Activity/Activity.php b/app/Http/Resources/Activity/Activity.php index 7e496ed14..f65fd1be1 100644 --- a/app/Http/Resources/Activity/Activity.php +++ b/app/Http/Resources/Activity/Activity.php @@ -3,11 +3,14 @@ namespace App\Http\Resources\Activity; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Emotion\Emotion as EmotionResource; use App\Http\Resources\Activity\ActivityType as ActivityTypeResource; -class Activity extends Resource +/** + * @extends JsonResource<\App\Models\Account\Activity> + */ +class Activity extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Activity/ActivityCollection.php b/app/Http/Resources/Activity/ActivityCollection.php deleted file mode 100644 index 803160fcf..000000000 --- a/app/Http/Resources/Activity/ActivityCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Activity/ActivityType.php b/app/Http/Resources/Activity/ActivityType.php index 12acf7f5d..c866ca858 100644 --- a/app/Http/Resources/Activity/ActivityType.php +++ b/app/Http/Resources/Activity/ActivityType.php @@ -3,10 +3,13 @@ namespace App\Http\Resources\Activity; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Activity\ActivityTypeCategory as ActivityTypeCategoryResource; -class ActivityType extends Resource +/** + * @extends JsonResource<\App\Models\Account\ActivityType> + */ +class ActivityType extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Activity/ActivityTypeCategory.php b/app/Http/Resources/Activity/ActivityTypeCategory.php index 3d4f277bc..0bd5a517e 100644 --- a/app/Http/Resources/Activity/ActivityTypeCategory.php +++ b/app/Http/Resources/Activity/ActivityTypeCategory.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\Activity; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class ActivityTypeCategory extends Resource +/** + * @extends JsonResource<\App\Models\Account\ActivityTypeCategory> + */ +class ActivityTypeCategory extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Activity/ActivityTypeCategoryCollection.php b/app/Http/Resources/Activity/ActivityTypeCategoryCollection.php deleted file mode 100644 index 9ab473248..000000000 --- a/app/Http/Resources/Activity/ActivityTypeCategoryCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Activity/ActivityTypeCollection.php b/app/Http/Resources/Activity/ActivityTypeCollection.php deleted file mode 100644 index bec547303..000000000 --- a/app/Http/Resources/Activity/ActivityTypeCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Address/Address.php b/app/Http/Resources/Address/Address.php index c0cdf20da..70e3c3283 100644 --- a/app/Http/Resources/Address/Address.php +++ b/app/Http/Resources/Address/Address.php @@ -3,11 +3,14 @@ namespace App\Http\Resources\Address; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Country\Country as CountryResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class Address extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Address> + */ +class Address extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Address/AddressCollection.php b/app/Http/Resources/Address/AddressCollection.php deleted file mode 100644 index 6cc089726..000000000 --- a/app/Http/Resources/Address/AddressCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Auditlog/AuditLog.php b/app/Http/Resources/Auditlog/AuditLog.php index 5cdbfe725..f6db7dffd 100644 --- a/app/Http/Resources/Auditlog/AuditLog.php +++ b/app/Http/Resources/Auditlog/AuditLog.php @@ -4,9 +4,12 @@ namespace App\Http\Resources\AuditLog; use App\Helpers\DateHelper; use function Safe\json_decode; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class AuditLog extends Resource +/** + * @extends JsonResource<\App\Models\Instance\AuditLog> + */ +class AuditLog extends JsonResource { /** * Transform the resource into an array. @@ -20,8 +23,8 @@ class AuditLog extends Resource 'id' => $this->id, 'object' => 'auditlog', 'author' => ($this->author) ? [ - 'id' => $this->id, - 'name' => $this->name, + 'id' => $this->author->id, + 'name' => $this->author->name, ] : [ 'name' => $this->author_name, ], diff --git a/app/Http/Resources/Auditlog/AuditLogCollection.php b/app/Http/Resources/Auditlog/AuditLogCollection.php deleted file mode 100644 index 49216b905..000000000 --- a/app/Http/Resources/Auditlog/AuditLogCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Call/Call.php b/app/Http/Resources/Call/Call.php index 6f7fbd03b..3da2f483a 100644 --- a/app/Http/Resources/Call/Call.php +++ b/app/Http/Resources/Call/Call.php @@ -3,11 +3,14 @@ namespace App\Http\Resources\Call; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Emotion\Emotion as EmotionResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class Call extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Call> + */ +class Call extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Call/CallCollection.php b/app/Http/Resources/Call/CallCollection.php deleted file mode 100644 index 16e5b304c..000000000 --- a/app/Http/Resources/Call/CallCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Company/Company.php b/app/Http/Resources/Company/Company.php index 6eb501b3e..1d2bcd650 100644 --- a/app/Http/Resources/Company/Company.php +++ b/app/Http/Resources/Company/Company.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\Company; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class Company extends Resource +/** + * @extends JsonResource<\App\Models\Account\Company> + */ +class Company extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Company/CompanyCollection.php b/app/Http/Resources/Company/CompanyCollection.php deleted file mode 100644 index 8badeb260..000000000 --- a/app/Http/Resources/Company/CompanyCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Contact/Contact.php b/app/Http/Resources/Contact/Contact.php index 8ffd462cd..cd87f4558 100644 --- a/app/Http/Resources/Contact/Contact.php +++ b/app/Http/Resources/Contact/Contact.php @@ -2,17 +2,15 @@ namespace App\Http\Resources\Contact; -use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; -use App\Http\Resources\Tag\Tag as TagResource; -use App\Http\Resources\Note\Note as NoteResource; -use App\Http\Resources\Address\Address as AddressResource; -use App\Http\Resources\Contact\ContactShort as ContactShortResource; -use App\Http\Resources\ContactField\ContactField as ContactFieldResource; -use App\Http\Resources\Relationship\RelationshipShort as RelationshipShortResource; +use Illuminate\Http\Resources\Json\JsonResource; -class Contact extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Contact> + */ +class Contact extends JsonResource { + use ContactBase; + /** * Transform the resource into an array. * @@ -23,115 +21,4 @@ class Contact extends Resource { return $this->toArrayInternal($request, $request->input('with') == 'contactfields'); } - - protected function toArrayInternal($request, $withContactField) - { - return [ - 'id' => $this->id, - 'object' => 'contact', - 'hash_id' => $this->getHashId(), - 'first_name' => $this->first_name, - 'last_name' => $this->last_name, - 'nickname' => $this->nickname, - 'complete_name' => $this->name, - 'initials' => $this->getInitials(), - 'description' => $this->description, - 'gender' => is_null($this->gender) ? null : $this->gender->name, - 'gender_type' => is_null($this->gender) ? null : $this->gender->type, - 'is_starred' => (bool) $this->is_starred, - 'is_partial' => (bool) $this->is_partial, - 'is_active' => (bool) $this->is_active, - 'is_dead' => (bool) $this->is_dead, - 'is_me' => $this->isMe(), - 'last_called' => $this->when(! $this->is_partial, $this->last_talked_to), - 'last_activity_together' => $this->when(! $this->is_partial, $this->getLastActivityDate()), - 'stay_in_touch_frequency' => $this->when(! $this->is_partial, $this->stay_in_touch_frequency), - 'stay_in_touch_trigger_date' => $this->when(! $this->is_partial, DateHelper::getTimestamp($this->stay_in_touch_trigger_date)), - 'information' => [ - 'relationships' => $this->when(! $this->is_partial, [ - 'love' => [ - 'total' => (is_null($this->getRelationshipsByRelationshipTypeGroup('love')) ? 0 : $this->getRelationshipsByRelationshipTypeGroup('love')->count()), - 'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('love')) ? null : RelationshipShortResource::collection($this->getRelationshipsByRelationshipTypeGroup('love'))), - ], - 'family' => [ - 'total' => (is_null($this->getRelationshipsByRelationshipTypeGroup('family')) ? 0 : $this->getRelationshipsByRelationshipTypeGroup('family')->count()), - 'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('family')) ? null : RelationshipShortResource::collection($this->getRelationshipsByRelationshipTypeGroup('family'))), - ], - 'friend' => [ - 'total' => (is_null($this->getRelationshipsByRelationshipTypeGroup('friend')) ? 0 : $this->getRelationshipsByRelationshipTypeGroup('friend')->count()), - 'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('friend')) ? null : RelationshipShortResource::collection($this->getRelationshipsByRelationshipTypeGroup('friend'))), - ], - 'work' => [ - 'total' => (is_null($this->getRelationshipsByRelationshipTypeGroup('work')) ? 0 : $this->getRelationshipsByRelationshipTypeGroup('work')->count()), - 'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('work')) ? null : RelationshipShortResource::collection($this->getRelationshipsByRelationshipTypeGroup('work'))), - ], - ]), - 'dates' => [ - 'birthdate' => [ - 'is_age_based' => (is_null($this->birthdate) ? null : (bool) $this->birthdate->is_age_based), - 'is_year_unknown' => (is_null($this->birthdate) ? null : (bool) $this->birthdate->is_year_unknown), - 'date' => DateHelper::getTimestamp($this->birthdate), - ], - 'deceased_date' => [ - 'is_age_based' => (is_null($this->deceasedDate) ? null : (bool) $this->deceasedDate->is_age_based), - 'is_year_unknown' => (is_null($this->deceasedDate) ? null : (bool) $this->deceasedDate->is_year_unknown), - 'date' => DateHelper::getTimestamp($this->deceasedDate), - ], - ], - 'career' => $this->when(! $this->is_partial, [ - 'job' => $this->job, - 'company' => $this->company, - ]), - 'avatar' => $this->when(! $this->is_partial, [ - 'url' => $this->getAvatarUrl(), - 'source' => $this->avatar_source, - 'default_avatar_color' => $this->default_avatar_color, - ]), - 'food_preferences' => $this->when(! $this->is_partial, $this->food_preferences), - 'how_you_met' => $this->when(! $this->is_partial, [ - 'general_information' => $this->first_met_additional_info, - 'first_met_date' => [ - 'is_age_based' => (is_null($this->firstMetDate) ? null : (bool) $this->firstMetDate->is_age_based), - 'is_year_unknown' => (is_null($this->firstMetDate) ? null : (bool) $this->firstMetDate->is_year_unknown), - 'date' => DateHelper::getTimestamp($this->firstMetDate), - ], - 'first_met_through_contact' => new ContactShortResource($this->getIntroducer()), - ]), - ], - 'addresses' => $this->when(! $this->is_partial, AddressResource::collection($this->addresses)), - 'tags' => $this->when(! $this->is_partial, TagResource::collection($this->tags)), - 'statistics' => $this->when(! $this->is_partial, [ - 'number_of_calls' => $this->calls->count(), - 'number_of_notes' => $this->notes->count(), - 'number_of_activities' => $this->activities->count(), - 'number_of_reminders' => $this->reminders->count(), - 'number_of_tasks' => $this->tasks->count(), - 'number_of_gifts' => $this->gifts->count(), - 'number_of_debts' => $this->debts->count(), - ]), - 'contactFields' => $this->when($withContactField && ! $this->is_partial, ContactFieldResource::collection($this->contactFields)), - 'notes' => $this->when($withContactField && ! $this->is_partial, NoteResource::collection($this->notes()->latest()->limit(3)->get())), - 'url' => $this->when(! $this->is_partial, route('api.contact', $this->id)), - 'account' => [ - 'id' => $this->account_id, - ], - 'created_at' => DateHelper::getTimestamp($this->created_at), - 'updated_at' => DateHelper::getTimestamp($this->updated_at), - ]; - } - - protected function getHashId() - { - $hashid = ''; - if ($this->is_partial) { - $realContact = $this->getRelatedRealContact(); - if ($realContact) { - $hashid = $realContact->hashID(); - } - } else { - $hashid = $this->hashID(); - } - - return $hashid; - } } diff --git a/app/Http/Resources/Contact/ContactBase.php b/app/Http/Resources/Contact/ContactBase.php new file mode 100644 index 000000000..51c026a5d --- /dev/null +++ b/app/Http/Resources/Contact/ContactBase.php @@ -0,0 +1,125 @@ + $this->id, + 'object' => 'contact', + 'hash_id' => $this->getHashId(), + 'first_name' => $this->first_name, + 'last_name' => $this->last_name, + 'nickname' => $this->nickname, + 'complete_name' => $this->name, + 'initials' => $this->getInitials(), + 'description' => $this->description, + 'gender' => is_null($this->gender) ? null : $this->gender->name, + 'gender_type' => is_null($this->gender) ? null : $this->gender->type, + 'is_starred' => (bool) $this->is_starred, + 'is_partial' => (bool) $this->is_partial, + 'is_active' => (bool) $this->is_active, + 'is_dead' => (bool) $this->is_dead, + 'is_me' => $this->isMe(), + 'last_called' => $this->when(! $this->is_partial, $this->last_talked_to), + 'last_activity_together' => $this->when(! $this->is_partial, $this->getLastActivityDate()), + 'stay_in_touch_frequency' => $this->when(! $this->is_partial, $this->stay_in_touch_frequency), + 'stay_in_touch_trigger_date' => $this->when(! $this->is_partial, DateHelper::getTimestamp($this->stay_in_touch_trigger_date)), + 'information' => [ + 'relationships' => $this->when(! $this->is_partial, [ + 'love' => [ + 'total' => (is_null($this->getRelationshipsByRelationshipTypeGroup('love')) ? 0 : $this->getRelationshipsByRelationshipTypeGroup('love')->count()), + 'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('love')) ? null : RelationshipShortResource::collection($this->getRelationshipsByRelationshipTypeGroup('love'))), + ], + 'family' => [ + 'total' => (is_null($this->getRelationshipsByRelationshipTypeGroup('family')) ? 0 : $this->getRelationshipsByRelationshipTypeGroup('family')->count()), + 'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('family')) ? null : RelationshipShortResource::collection($this->getRelationshipsByRelationshipTypeGroup('family'))), + ], + 'friend' => [ + 'total' => (is_null($this->getRelationshipsByRelationshipTypeGroup('friend')) ? 0 : $this->getRelationshipsByRelationshipTypeGroup('friend')->count()), + 'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('friend')) ? null : RelationshipShortResource::collection($this->getRelationshipsByRelationshipTypeGroup('friend'))), + ], + 'work' => [ + 'total' => (is_null($this->getRelationshipsByRelationshipTypeGroup('work')) ? 0 : $this->getRelationshipsByRelationshipTypeGroup('work')->count()), + 'contacts' => (is_null($this->getRelationshipsByRelationshipTypeGroup('work')) ? null : RelationshipShortResource::collection($this->getRelationshipsByRelationshipTypeGroup('work'))), + ], + ]), + 'dates' => [ + 'birthdate' => [ + 'is_age_based' => (is_null($this->birthdate) ? null : (bool) $this->birthdate->is_age_based), + 'is_year_unknown' => (is_null($this->birthdate) ? null : (bool) $this->birthdate->is_year_unknown), + 'date' => DateHelper::getTimestamp($this->birthdate), + ], + 'deceased_date' => [ + 'is_age_based' => (is_null($this->deceasedDate) ? null : (bool) $this->deceasedDate->is_age_based), + 'is_year_unknown' => (is_null($this->deceasedDate) ? null : (bool) $this->deceasedDate->is_year_unknown), + 'date' => DateHelper::getTimestamp($this->deceasedDate), + ], + ], + 'career' => $this->when(! $this->is_partial, [ + 'job' => $this->job, + 'company' => $this->company, + ]), + 'avatar' => $this->when(! $this->is_partial, [ + 'url' => $this->getAvatarUrl(), + 'source' => $this->avatar_source, + 'default_avatar_color' => $this->default_avatar_color, + ]), + 'food_preferences' => $this->when(! $this->is_partial, $this->food_preferences), + 'how_you_met' => $this->when(! $this->is_partial, [ + 'general_information' => $this->first_met_additional_info, + 'first_met_date' => [ + 'is_age_based' => (is_null($this->firstMetDate) ? null : (bool) $this->firstMetDate->is_age_based), + 'is_year_unknown' => (is_null($this->firstMetDate) ? null : (bool) $this->firstMetDate->is_year_unknown), + 'date' => DateHelper::getTimestamp($this->firstMetDate), + ], + 'first_met_through_contact' => new ContactShortResource($this->getIntroducer()), + ]), + ], + 'addresses' => $this->when(! $this->is_partial, AddressResource::collection($this->addresses)), + 'tags' => $this->when(! $this->is_partial, TagResource::collection($this->tags)), + 'statistics' => $this->when(! $this->is_partial, [ + 'number_of_calls' => $this->calls->count(), + 'number_of_notes' => $this->notes->count(), + 'number_of_activities' => $this->activities->count(), + 'number_of_reminders' => $this->reminders->count(), + 'number_of_tasks' => $this->tasks->count(), + 'number_of_gifts' => $this->gifts->count(), + 'number_of_debts' => $this->debts->count(), + ]), + 'contactFields' => $this->when($withContactField && ! $this->is_partial, ContactFieldResource::collection($this->contactFields)), + 'notes' => $this->when($withContactField && ! $this->is_partial, NoteResource::collection($this->notes()->latest()->limit(3)->get())), + 'url' => $this->when(! $this->is_partial, route('api.contact', $this->id)), + 'account' => [ + 'id' => $this->account_id, + ], + 'created_at' => DateHelper::getTimestamp($this->created_at), + 'updated_at' => DateHelper::getTimestamp($this->updated_at), + ]; + } + + protected function getHashId() + { + $hashid = ''; + if ($this->is_partial) { + $realContact = $this->getRelatedRealContact(); + if ($realContact) { + $hashid = $realContact->hashID(); + } + } else { + $hashid = $this->hashID(); + } + + return $hashid; + } +} diff --git a/app/Http/Resources/Contact/ContactCollection.php b/app/Http/Resources/Contact/ContactCollection.php deleted file mode 100644 index 7249feeae..000000000 --- a/app/Http/Resources/Contact/ContactCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Contact/ContactSearch.php b/app/Http/Resources/Contact/ContactSearch.php index c0ee48a7a..4cd7c56d3 100644 --- a/app/Http/Resources/Contact/ContactSearch.php +++ b/app/Http/Resources/Contact/ContactSearch.php @@ -2,8 +2,15 @@ namespace App\Http\Resources\Contact; -class ContactSearch extends Contact +use Illuminate\Http\Resources\Json\JsonResource; + +/** + * @extends JsonResource<\App\Models\Contact\Contact> + */ +class ContactSearch extends JsonResource { + use ContactBase; + /** * Transform the resource into an array. * diff --git a/app/Http/Resources/Contact/ContactShort.php b/app/Http/Resources/Contact/ContactShort.php index c031c6627..5204fe28a 100644 --- a/app/Http/Resources/Contact/ContactShort.php +++ b/app/Http/Resources/Contact/ContactShort.php @@ -3,9 +3,15 @@ namespace App\Http\Resources\Contact; use App\Helpers\DateHelper; +use Illuminate\Http\Resources\Json\JsonResource; -class ContactShort extends Contact +/** + * @extends JsonResource<\App\Models\Contact\Contact> + */ +class ContactShort extends JsonResource { + use ContactBase; + /** * Transform the resource into an array. * diff --git a/app/Http/Resources/Contact/ContactWithContactFields.php b/app/Http/Resources/Contact/ContactWithContactFields.php index f3a0f1624..62d63dcec 100644 --- a/app/Http/Resources/Contact/ContactWithContactFields.php +++ b/app/Http/Resources/Contact/ContactWithContactFields.php @@ -2,8 +2,15 @@ namespace App\Http\Resources\Contact; -class ContactWithContactFields extends Contact +use Illuminate\Http\Resources\Json\JsonResource; + +/** + * @extends JsonResource<\App\Models\Contact\Contact> + */ +class ContactWithContactFields extends JsonResource { + use ContactBase; + /** * Transform the resource into an array. * diff --git a/app/Http/Resources/Contact/ContactWithContactFieldsCollection.php b/app/Http/Resources/Contact/ContactWithContactFieldsCollection.php deleted file mode 100644 index 0b117735a..000000000 --- a/app/Http/Resources/Contact/ContactWithContactFieldsCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/ContactField/ContactField.php b/app/Http/Resources/ContactField/ContactField.php index d0471ea73..26e35973d 100644 --- a/app/Http/Resources/ContactField/ContactField.php +++ b/app/Http/Resources/ContactField/ContactField.php @@ -3,11 +3,14 @@ namespace App\Http\Resources\ContactField; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; use App\Http\Resources\Settings\ContactFieldType\ContactFieldType as ContactFieldTypeResource; -class ContactField extends Resource +/** + * @extends JsonResource<\App\Models\Contact\ContactField> + */ +class ContactField extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/ContactField/ContactFieldCollection.php b/app/Http/Resources/ContactField/ContactFieldCollection.php deleted file mode 100644 index 4a51c33fb..000000000 --- a/app/Http/Resources/ContactField/ContactFieldCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/ContactField/ContactFieldLabel.php b/app/Http/Resources/ContactField/ContactFieldLabel.php index 5d2ba04a5..4b04598d6 100644 --- a/app/Http/Resources/ContactField/ContactFieldLabel.php +++ b/app/Http/Resources/ContactField/ContactFieldLabel.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\ContactField; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class ContactFieldLabel extends Resource +/** + * @extends JsonResource<\App\Models\Contact\ContactFieldLabel> + */ +class ContactFieldLabel extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/ContactField/ContactFieldLabelCollection.php b/app/Http/Resources/ContactField/ContactFieldLabelCollection.php deleted file mode 100644 index dce7bfab9..000000000 --- a/app/Http/Resources/ContactField/ContactFieldLabelCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Conversation/Conversation.php b/app/Http/Resources/Conversation/Conversation.php index 3ffc12a61..d4842465a 100644 --- a/app/Http/Resources/Conversation/Conversation.php +++ b/app/Http/Resources/Conversation/Conversation.php @@ -3,12 +3,15 @@ namespace App\Http\Resources\Conversation; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Conversation\Message as MessageResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; use App\Http\Resources\Settings\ContactFieldType\ContactFieldType as ContactFieldTypeResource; -class Conversation extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Conversation> + */ +class Conversation extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Conversation/ConversationCollection.php b/app/Http/Resources/Conversation/ConversationCollection.php deleted file mode 100644 index 9a98a7030..000000000 --- a/app/Http/Resources/Conversation/ConversationCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Conversation/Message.php b/app/Http/Resources/Conversation/Message.php index 377ed0ac0..f9b12f947 100644 --- a/app/Http/Resources/Conversation/Message.php +++ b/app/Http/Resources/Conversation/Message.php @@ -3,10 +3,13 @@ namespace App\Http\Resources\Conversation; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class Message extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Message> + */ +class Message extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Conversation/MessageCollection.php b/app/Http/Resources/Conversation/MessageCollection.php deleted file mode 100644 index 64838b77f..000000000 --- a/app/Http/Resources/Conversation/MessageCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Country/Country.php b/app/Http/Resources/Country/Country.php index 13efab41e..fd295b6bf 100644 --- a/app/Http/Resources/Country/Country.php +++ b/app/Http/Resources/Country/Country.php @@ -3,9 +3,9 @@ namespace App\Http\Resources\Country; use App\Helpers\CountriesHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class Country extends Resource +class Country extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Country/CountryCollection.php b/app/Http/Resources/Country/CountryCollection.php deleted file mode 100644 index 5158f9b38..000000000 --- a/app/Http/Resources/Country/CountryCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Debt/Debt.php b/app/Http/Resources/Debt/Debt.php index f0b32ecd2..4f5e47d78 100644 --- a/app/Http/Resources/Debt/Debt.php +++ b/app/Http/Resources/Debt/Debt.php @@ -4,10 +4,13 @@ namespace App\Http\Resources\Debt; use App\Helpers\DateHelper; use App\Helpers\MoneyHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class Debt extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Debt> + */ +class Debt extends JsonResource { /** * Transform the resource into an array. @@ -23,7 +26,7 @@ class Debt extends Resource 'in_debt' => $this->in_debt, 'status' => $this->status, 'amount' => $this->amount, - 'amount_with_currency' => MoneyHelper::format($this->amount), + 'amount_with_currency' => MoneyHelper::format((int) $this->amount), 'reason' => $this->reason, 'account' => [ 'id' => $this->account_id, diff --git a/app/Http/Resources/Debt/DebtCollection.php b/app/Http/Resources/Debt/DebtCollection.php deleted file mode 100644 index fe4b1c19f..000000000 --- a/app/Http/Resources/Debt/DebtCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Document/Document.php b/app/Http/Resources/Document/Document.php index aa73eac52..426bc39d3 100644 --- a/app/Http/Resources/Document/Document.php +++ b/app/Http/Resources/Document/Document.php @@ -3,10 +3,13 @@ namespace App\Http\Resources\Document; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class Document extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Document> + */ +class Document extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Document/DocumentCollection.php b/app/Http/Resources/Document/DocumentCollection.php deleted file mode 100644 index 7ed59a050..000000000 --- a/app/Http/Resources/Document/DocumentCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Emotion/Emotion.php b/app/Http/Resources/Emotion/Emotion.php index c63ad5b21..8d7b0c58e 100644 --- a/app/Http/Resources/Emotion/Emotion.php +++ b/app/Http/Resources/Emotion/Emotion.php @@ -2,9 +2,12 @@ namespace App\Http\Resources\Emotion; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class Emotion extends Resource +/** + * @extends JsonResource<\App\Models\Instance\Emotion\Emotion> + */ +class Emotion extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Emotion/EmotionCollection.php b/app/Http/Resources/Emotion/EmotionCollection.php deleted file mode 100644 index 8c57ff966..000000000 --- a/app/Http/Resources/Emotion/EmotionCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Gender/Gender.php b/app/Http/Resources/Gender/Gender.php index d378c62c9..92d681fef 100644 --- a/app/Http/Resources/Gender/Gender.php +++ b/app/Http/Resources/Gender/Gender.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\Gender; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class Gender extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Gender> + */ +class Gender extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Gender/GenderCollection.php b/app/Http/Resources/Gender/GenderCollection.php deleted file mode 100644 index 10806e9b6..000000000 --- a/app/Http/Resources/Gender/GenderCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Gift/Gift.php b/app/Http/Resources/Gift/Gift.php index 17acd365e..4831e2ef5 100644 --- a/app/Http/Resources/Gift/Gift.php +++ b/app/Http/Resources/Gift/Gift.php @@ -3,11 +3,14 @@ namespace App\Http\Resources\Gift; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Photo\Photo as PhotoResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class Gift extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Gift> + */ +class Gift extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Gift/GiftCollection.php b/app/Http/Resources/Gift/GiftCollection.php deleted file mode 100644 index 83fa9e351..000000000 --- a/app/Http/Resources/Gift/GiftCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Journal/Entry.php b/app/Http/Resources/Journal/Entry.php index 2def93136..452d06897 100644 --- a/app/Http/Resources/Journal/Entry.php +++ b/app/Http/Resources/Journal/Entry.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\Journal; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class Entry extends Resource +/** + * @extends JsonResource<\App\Models\Journal\Entry> + */ +class Entry extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Journal/JournalCollection.php b/app/Http/Resources/Journal/JournalCollection.php deleted file mode 100644 index 8ea126d2c..000000000 --- a/app/Http/Resources/Journal/JournalCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/LifeEvent/LifeEvent.php b/app/Http/Resources/LifeEvent/LifeEvent.php index fe992411a..e7ba20f17 100644 --- a/app/Http/Resources/LifeEvent/LifeEvent.php +++ b/app/Http/Resources/LifeEvent/LifeEvent.php @@ -3,11 +3,14 @@ namespace App\Http\Resources\LifeEvent; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; use App\Http\Resources\LifeEvent\LifeEventType as LifeEventTypeResource; -class LifeEvent extends Resource +/** + * @extends JsonResource<\App\Models\Contact\LifeEvent> + */ +class LifeEvent extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/LifeEvent/LifeEventCategory.php b/app/Http/Resources/LifeEvent/LifeEventCategory.php index d36c194a8..17ae5663f 100644 --- a/app/Http/Resources/LifeEvent/LifeEventCategory.php +++ b/app/Http/Resources/LifeEvent/LifeEventCategory.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\LifeEvent; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class LifeEventCategory extends Resource +/** + * @extends JsonResource<\App\Models\Contact\LifeEventCategory> + */ +class LifeEventCategory extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/LifeEvent/LifeEventType.php b/app/Http/Resources/LifeEvent/LifeEventType.php index 671e8a0b2..26ffb21c1 100644 --- a/app/Http/Resources/LifeEvent/LifeEventType.php +++ b/app/Http/Resources/LifeEvent/LifeEventType.php @@ -3,10 +3,13 @@ namespace App\Http\Resources\LifeEvent; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\LifeEvent\LifeEventCategory as LifeEventCategoryResource; -class LifeEventType extends Resource +/** + * @extends JsonResource<\App\Models\Contact\LifeEventType> + */ +class LifeEventType extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Note/Note.php b/app/Http/Resources/Note/Note.php index 3490b1758..e680444ba 100644 --- a/app/Http/Resources/Note/Note.php +++ b/app/Http/Resources/Note/Note.php @@ -3,10 +3,13 @@ namespace App\Http\Resources\Note; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class Note extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Note> + */ +class Note extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Note/NoteCollection.php b/app/Http/Resources/Note/NoteCollection.php deleted file mode 100644 index f96a6947f..000000000 --- a/app/Http/Resources/Note/NoteCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Occupation/Occupation.php b/app/Http/Resources/Occupation/Occupation.php index 372b66117..7b91c4f5f 100644 --- a/app/Http/Resources/Occupation/Occupation.php +++ b/app/Http/Resources/Occupation/Occupation.php @@ -3,11 +3,14 @@ namespace App\Http\Resources\Occupation; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Company\Company as CompanyResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class Occupation extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Occupation> + */ +class Occupation extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Occupation/OccupationCollection.php b/app/Http/Resources/Occupation/OccupationCollection.php deleted file mode 100644 index 782953f12..000000000 --- a/app/Http/Resources/Occupation/OccupationCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Pet/Pet.php b/app/Http/Resources/Pet/Pet.php index e4d58f763..f6e31079c 100644 --- a/app/Http/Resources/Pet/Pet.php +++ b/app/Http/Resources/Pet/Pet.php @@ -3,10 +3,13 @@ namespace App\Http\Resources\Pet; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class Pet extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Pet> + */ +class Pet extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Pet/PetCategory.php b/app/Http/Resources/Pet/PetCategory.php index c9c1c8dd7..a0b676b7e 100644 --- a/app/Http/Resources/Pet/PetCategory.php +++ b/app/Http/Resources/Pet/PetCategory.php @@ -2,9 +2,12 @@ namespace App\Http\Resources\Pet; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class PetCategory extends Resource +/** + * @extends JsonResource<\App\Models\Contact\PetCategory> + */ +class PetCategory extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Pet/PetCollection.php b/app/Http/Resources/Pet/PetCollection.php deleted file mode 100644 index ce3af9dba..000000000 --- a/app/Http/Resources/Pet/PetCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Photo/Photo.php b/app/Http/Resources/Photo/Photo.php index 880dd332e..415167dbd 100644 --- a/app/Http/Resources/Photo/Photo.php +++ b/app/Http/Resources/Photo/Photo.php @@ -3,10 +3,13 @@ namespace App\Http\Resources\Photo; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class Photo extends Resource +/** + * @extends JsonResource<\App\Models\Account\Photo> + */ +class Photo extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Photo/PhotoCollection.php b/app/Http/Resources/Photo/PhotoCollection.php deleted file mode 100644 index d2022de40..000000000 --- a/app/Http/Resources/Photo/PhotoCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Place/Place.php b/app/Http/Resources/Place/Place.php index 99c4b2316..ec4e6a9bb 100644 --- a/app/Http/Resources/Place/Place.php +++ b/app/Http/Resources/Place/Place.php @@ -3,10 +3,13 @@ namespace App\Http\Resources\Place; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Country\Country as CountryResource; -class Place extends Resource +/** + * @extends JsonResource<\App\Models\Account\Place> + */ +class Place extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Place/PlaceCollection.php b/app/Http/Resources/Place/PlaceCollection.php deleted file mode 100644 index c30eef56f..000000000 --- a/app/Http/Resources/Place/PlaceCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Relationship/Relationship.php b/app/Http/Resources/Relationship/Relationship.php index d8538dbc5..c17d12fdb 100644 --- a/app/Http/Resources/Relationship/Relationship.php +++ b/app/Http/Resources/Relationship/Relationship.php @@ -3,11 +3,14 @@ namespace App\Http\Resources\Relationship; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; use App\Http\Resources\RelationshipType\RelationshipType as RelationshipTypeResource; -class Relationship extends Resource +/** + * @extends JsonResource<\App\Models\Relationship\Relationship> + */ +class Relationship extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Relationship/RelationshipCollection.php b/app/Http/Resources/Relationship/RelationshipCollection.php deleted file mode 100644 index ae58d2be8..000000000 --- a/app/Http/Resources/Relationship/RelationshipCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Relationship/RelationshipShort.php b/app/Http/Resources/Relationship/RelationshipShort.php index 0251fd424..42cb15e4b 100644 --- a/app/Http/Resources/Relationship/RelationshipShort.php +++ b/app/Http/Resources/Relationship/RelationshipShort.php @@ -2,10 +2,13 @@ namespace App\Http\Resources\Relationship; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class RelationshipShort extends Resource +/** + * @extends JsonResource<\App\Models\Relationship\Relationship> + */ +class RelationshipShort extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/RelationshipType/RelationshipType.php b/app/Http/Resources/RelationshipType/RelationshipType.php index 81c4723b5..29312c06f 100644 --- a/app/Http/Resources/RelationshipType/RelationshipType.php +++ b/app/Http/Resources/RelationshipType/RelationshipType.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\RelationshipType; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class RelationshipType extends Resource +/** + * @extends JsonResource<\App\Models\Relationship\RelationshipType> + */ +class RelationshipType extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/RelationshipType/RelationshipTypeCollection.php b/app/Http/Resources/RelationshipType/RelationshipTypeCollection.php deleted file mode 100644 index 9d9ca7ec2..000000000 --- a/app/Http/Resources/RelationshipType/RelationshipTypeCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/RelationshipTypeGroup/RelationshipTypeGroup.php b/app/Http/Resources/RelationshipTypeGroup/RelationshipTypeGroup.php index 8cf0e1ad4..325ae1b20 100644 --- a/app/Http/Resources/RelationshipTypeGroup/RelationshipTypeGroup.php +++ b/app/Http/Resources/RelationshipTypeGroup/RelationshipTypeGroup.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\RelationshipTypeGroup; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class RelationshipTypeGroup extends Resource +/** + * @extends JsonResource<\App\Models\Relationship\RelationshipTypeGroup> + */ +class RelationshipTypeGroup extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/RelationshipTypeGroup/RelationshipTypeGroupCollection.php b/app/Http/Resources/RelationshipTypeGroup/RelationshipTypeGroupCollection.php deleted file mode 100644 index 40d447a0b..000000000 --- a/app/Http/Resources/RelationshipTypeGroup/RelationshipTypeGroupCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Reminder/Reminder.php b/app/Http/Resources/Reminder/Reminder.php index 3dbc2389e..1fc9840f4 100644 --- a/app/Http/Resources/Reminder/Reminder.php +++ b/app/Http/Resources/Reminder/Reminder.php @@ -3,10 +3,13 @@ namespace App\Http\Resources\Reminder; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class Reminder extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Reminder> + */ +class Reminder extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Reminder/ReminderCollection.php b/app/Http/Resources/Reminder/ReminderCollection.php deleted file mode 100644 index fc1dbede5..000000000 --- a/app/Http/Resources/Reminder/ReminderCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Settings/Compliance/Compliance.php b/app/Http/Resources/Settings/Compliance/Compliance.php index 0793b1753..7bdec2d1c 100644 --- a/app/Http/Resources/Settings/Compliance/Compliance.php +++ b/app/Http/Resources/Settings/Compliance/Compliance.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\Settings\Compliance; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class Compliance extends Resource +/** + * @extends JsonResource<\App\Models\Settings\Term> + */ +class Compliance extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Settings/Compliance/ComplianceCollection.php b/app/Http/Resources/Settings/Compliance/ComplianceCollection.php deleted file mode 100644 index 776a04cf2..000000000 --- a/app/Http/Resources/Settings/Compliance/ComplianceCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Settings/ContactFieldType/ContactFieldType.php b/app/Http/Resources/Settings/ContactFieldType/ContactFieldType.php index 71c45c9a2..5270b8aa0 100644 --- a/app/Http/Resources/Settings/ContactFieldType/ContactFieldType.php +++ b/app/Http/Resources/Settings/ContactFieldType/ContactFieldType.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\Settings\ContactFieldType; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class ContactFieldType extends Resource +/** + * @extends JsonResource<\App\Models\Contact\ContactFieldType> + */ +class ContactFieldType extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Settings/ContactFieldType/ContactFieldTypeCollection.php b/app/Http/Resources/Settings/ContactFieldType/ContactFieldTypeCollection.php deleted file mode 100644 index 3f3bd3d4b..000000000 --- a/app/Http/Resources/Settings/ContactFieldType/ContactFieldTypeCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Settings/Currency/Currency.php b/app/Http/Resources/Settings/Currency/Currency.php index ed60edfa7..3c2ccf31f 100644 --- a/app/Http/Resources/Settings/Currency/Currency.php +++ b/app/Http/Resources/Settings/Currency/Currency.php @@ -2,9 +2,12 @@ namespace App\Http\Resources\Settings\Currency; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class Currency extends Resource +/** + * @extends JsonResource<\App\Models\Settings\Currency> + */ +class Currency extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Settings/Currency/CurrencyCollection.php b/app/Http/Resources/Settings/Currency/CurrencyCollection.php deleted file mode 100644 index 3b35348fb..000000000 --- a/app/Http/Resources/Settings/Currency/CurrencyCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Settings/U2fKey/U2fKey.php b/app/Http/Resources/Settings/U2fKey/U2fKey.php index aafe2bcb6..d3083d732 100644 --- a/app/Http/Resources/Settings/U2fKey/U2fKey.php +++ b/app/Http/Resources/Settings/U2fKey/U2fKey.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\Settings\U2fKey; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class U2fKey extends Resource +/** + * @extends JsonResource<\Lahaxearnaud\U2f\Models\U2fKey> + */ +class U2fKey extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Settings/U2fKey/U2fKeyCollection.php b/app/Http/Resources/Settings/U2fKey/U2fKeyCollection.php deleted file mode 100644 index a8d353665..000000000 --- a/app/Http/Resources/Settings/U2fKey/U2fKeyCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Settings/WebauthnKey/WebauthnKey.php b/app/Http/Resources/Settings/WebauthnKey/WebauthnKey.php index f4413dde9..d4adb6a83 100644 --- a/app/Http/Resources/Settings/WebauthnKey/WebauthnKey.php +++ b/app/Http/Resources/Settings/WebauthnKey/WebauthnKey.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\Settings\WebauthnKey; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class WebauthnKey extends Resource +/** + * @extends JsonResource<\LaravelWebauthn\Models\WebauthnKey> + */ +class WebauthnKey extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Settings/WebauthnKey/WebauthnKeyCollection.php b/app/Http/Resources/Settings/WebauthnKey/WebauthnKeyCollection.php deleted file mode 100644 index 888105898..000000000 --- a/app/Http/Resources/Settings/WebauthnKey/WebauthnKeyCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Tag/Tag.php b/app/Http/Resources/Tag/Tag.php index 48fc08be6..7abc1a42b 100644 --- a/app/Http/Resources/Tag/Tag.php +++ b/app/Http/Resources/Tag/Tag.php @@ -3,9 +3,12 @@ namespace App\Http\Resources\Tag; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; -class Tag extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Tag> + */ +class Tag extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Tag/TagCollection.php b/app/Http/Resources/Tag/TagCollection.php deleted file mode 100644 index 5a300c220..000000000 --- a/app/Http/Resources/Tag/TagCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Http/Resources/Task/Task.php b/app/Http/Resources/Task/Task.php index 425131032..ff240803b 100644 --- a/app/Http/Resources/Task/Task.php +++ b/app/Http/Resources/Task/Task.php @@ -3,10 +3,13 @@ namespace App\Http\Resources\Task; use App\Helpers\DateHelper; -use Illuminate\Http\Resources\Json\Resource; +use Illuminate\Http\Resources\Json\JsonResource; use App\Http\Resources\Contact\ContactShort as ContactShortResource; -class Task extends Resource +/** + * @extends JsonResource<\App\Models\Contact\Task> + */ +class Task extends JsonResource { /** * Transform the resource into an array. diff --git a/app/Http/Resources/Task/TaskCollection.php b/app/Http/Resources/Task/TaskCollection.php deleted file mode 100644 index 4f392ef2c..000000000 --- a/app/Http/Resources/Task/TaskCollection.php +++ /dev/null @@ -1,24 +0,0 @@ - $this->collection, - 'links' => [ - 'self' => 'link-value', - ], - ]; - } -} diff --git a/app/Jobs/Avatars/MoveContactAvatarToPhotosDirectory.php b/app/Jobs/Avatars/MoveContactAvatarToPhotosDirectory.php index bb481e3cc..e963ea9c9 100644 --- a/app/Jobs/Avatars/MoveContactAvatarToPhotosDirectory.php +++ b/app/Jobs/Avatars/MoveContactAvatarToPhotosDirectory.php @@ -116,10 +116,10 @@ class MoveContactAvatarToPhotosDirectory implements ShouldQueue * @param string|null $avatarFileName * @return Photo|null */ - private function createPhotoObject($avatarFileName) + private function createPhotoObject($avatarFileName): ?Photo { if (is_null($avatarFileName)) { - return; + return null; } $newAvatarFilename = str_replace('avatars/', '', $avatarFileName); diff --git a/app/Jobs/Reminder/NotifyUserAboutReminder.php b/app/Jobs/Reminder/NotifyUserAboutReminder.php index 6fe463a0a..5ce66b4a5 100644 --- a/app/Jobs/Reminder/NotifyUserAboutReminder.php +++ b/app/Jobs/Reminder/NotifyUserAboutReminder.php @@ -74,7 +74,7 @@ class NotifyUserAboutReminder implements ShouldQueue * * @return MailNotification|null */ - private function getMessage() + private function getMessage(): ?MailNotification { switch ($this->reminderOutbox->nature) { case 'reminder': @@ -82,7 +82,7 @@ class NotifyUserAboutReminder implements ShouldQueue case 'notification': return new UserNotified($this->reminderOutbox->reminder, $this->reminderOutbox->notification_number_days_before); default: - break; + return null; } } } diff --git a/app/Models/Account/Account.php b/app/Models/Account/Account.php index be83bab97..a8ce07f3c 100644 --- a/app/Models/Account/Account.php +++ b/app/Models/Account/Account.php @@ -44,6 +44,13 @@ use Illuminate\Database\Eloquent\ModelNotFoundException; use App\Services\Auth\Population\PopulateLifeEventsTable; use App\Services\Auth\Population\PopulateContactFieldTypesTable; +/** + * @property int $reminders_count + * @property int $notes_count + * @property int $activities_count + * @property int $gifts_count + * @property int $tasks_count + */ class Account extends Model { use Subscription; diff --git a/app/Models/Account/Activity.php b/app/Models/Account/Activity.php index bfcb148f6..07d719793 100644 --- a/app/Models/Account/Activity.php +++ b/app/Models/Account/Activity.php @@ -131,7 +131,7 @@ class Activity extends Model implements IsJournalableInterface */ public function getTitle() { - return $this->type ? $this->type->key : null; + return $this->type ? $this->type->translation_key : null; } /** diff --git a/app/Models/Account/Place.php b/app/Models/Account/Place.php index 3f60324e9..899774da0 100644 --- a/app/Models/Account/Place.php +++ b/app/Models/Account/Place.php @@ -55,7 +55,7 @@ class Place extends Model * * @return string|null */ - public function getAddressAsString() + public function getAddressAsString(): ?string { $address = ''; @@ -80,7 +80,7 @@ class Place extends Model } if (empty($address)) { - return; + return null; } // trim extra whitespaces inside the address @@ -88,6 +88,8 @@ class Place extends Model if (is_string($address)) { return $address; } + + return null; } /** @@ -95,11 +97,13 @@ class Place extends Model * * @return string|null */ - public function getCountryName() + public function getCountryName(): ?string { if ($this->country) { return CountriesHelper::get($this->country); } + + return null; } /** diff --git a/app/Models/Contact/Gift.php b/app/Models/Contact/Gift.php index c0ba490e1..f47227561 100644 --- a/app/Models/Contact/Gift.php +++ b/app/Models/Contact/Gift.php @@ -137,9 +137,9 @@ class Gift extends Model /** * Get the name of the recipient for this gift. * - * @return string + * @return string|null */ - public function getRecipientNameAttribute() + public function getRecipientNameAttribute(): ?string { if ($this->hasParticularRecipient()) { $recipient = $this->recipient; @@ -147,6 +147,8 @@ class Gift extends Model return $this->recipient->first_name; } } + + return null; } /** diff --git a/app/Models/Contact/Reminder.php b/app/Models/Contact/Reminder.php index fedc14357..78efdb36e 100644 --- a/app/Models/Contact/Reminder.php +++ b/app/Models/Contact/Reminder.php @@ -14,6 +14,9 @@ use App\Models\ModelBindingHasherWithContact as Model; * A reminder has two states: active and inactive. * An inactive reminder is basically a one_time reminder that has already be * sent once and has been marked inactive so we don't schedule it again. + * + * @property string $next_expected_date_human_readable + * @property string $next_expected_date */ class Reminder extends Model { diff --git a/app/Models/Relationship/Relationship.php b/app/Models/Relationship/Relationship.php index d101afd72..87b1d3e79 100644 --- a/app/Models/Relationship/Relationship.php +++ b/app/Models/Relationship/Relationship.php @@ -79,7 +79,7 @@ class Relationship extends Model * * @return self|null */ - public function reverseRelationship() + public function reverseRelationship(): ?self { $reverseRelationshipType = $this->relationshipType->reverseRelationshipType(); if ($reverseRelationshipType) { @@ -90,5 +90,7 @@ class Relationship extends Model 'relationship_type_id' => $reverseRelationshipType->id, ])->first(); } + + return null; } } diff --git a/app/Models/User/User.php b/app/Models/User/User.php index fef110e01..31d89fdda 100644 --- a/app/Models/User/User.php +++ b/app/Models/User/User.php @@ -186,11 +186,9 @@ class User extends Authenticatable implements MustVerifyEmail, HasLocalePreferen * @param string|null $value * @return string|null */ - public function getGoogle2faSecretAttribute($value) + public function getGoogle2faSecretAttribute($value): ?string { - if (! is_null($value)) { - return decrypt($value); - } + return is_null($value) ? null : decrypt($value); } /** diff --git a/app/Services/Account/Activity/ActivityStatisticService.php b/app/Services/Account/Activity/ActivityStatisticService.php index 6f4938f6f..10088c438 100644 --- a/app/Services/Account/Activity/ActivityStatisticService.php +++ b/app/Services/Account/Activity/ActivityStatisticService.php @@ -6,7 +6,6 @@ use Carbon\Carbon; use App\Models\Contact\Contact; use Illuminate\Support\Collection; use App\Models\Account\ActivityType; -use Illuminate\Database\Eloquent\Relations\HasMany; class ActivityStatisticService { @@ -32,11 +31,11 @@ class ActivityStatisticService * the contact. * * @param Contact $contact - * @return HasMany + * @return \Illuminate\Database\Eloquent\Collection<\App\Models\Account\ActivityStatistic> */ public function activitiesPerYearWithContact(Contact $contact) { - return $contact->activityStatistics; + return $contact->activityStatistics()->get(); } /** diff --git a/app/Services/Account/Photo/UploadPhoto.php b/app/Services/Account/Photo/UploadPhoto.php index 068df2997..e509844c3 100644 --- a/app/Services/Account/Photo/UploadPhoto.php +++ b/app/Services/Account/Photo/UploadPhoto.php @@ -45,9 +45,9 @@ class UploadPhoto extends BaseService * Upload a photo. * * @param array $data - * @return Photo + * @return Photo|null */ - public function execute(array $data) + public function execute(array $data): ?Photo { $this->validate($data); @@ -62,7 +62,7 @@ class UploadPhoto extends BaseService } if (! $array) { - return; + return null; } return tap(Photo::create($array), function ($photo) use ($contact) { @@ -171,13 +171,9 @@ class UploadPhoto extends BaseService */ private function isBinary(string $data): bool { - if (is_string($data)) { - $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data); + $mime = finfo_buffer(finfo_open(FILEINFO_MIME_TYPE), $data); - return substr($mime, 0, 4) != 'text' && $mime != 'application/x-empty'; - } - - return false; + return substr($mime, 0, 4) != 'text' && $mime != 'application/x-empty'; } /** diff --git a/app/Services/Account/Settings/ResetAccount.php b/app/Services/Account/Settings/ResetAccount.php index 01aeb0492..f5762aabd 100644 --- a/app/Services/Account/Settings/ResetAccount.php +++ b/app/Services/Account/Settings/ResetAccount.php @@ -58,7 +58,7 @@ class ResetAccount extends BaseService { $companies = $account->companies; foreach ($companies as $company) { - $company->delete; + $company->delete(); } } @@ -72,7 +72,7 @@ class ResetAccount extends BaseService { $days = $account->days; foreach ($days as $day) { - $day->delete; + $day->delete(); } } @@ -86,7 +86,7 @@ class ResetAccount extends BaseService { $places = $account->places; foreach ($places as $place) { - $place->delete; + $place->delete(); } } @@ -127,7 +127,7 @@ class ResetAccount extends BaseService { $entries = $account->entries; foreach ($entries as $entry) { - $entry->delete; + $entry->delete(); } $activities = $account->activities; diff --git a/app/Services/Contact/Avatar/GetGravatar.php b/app/Services/Contact/Avatar/GetGravatar.php index ec52abde4..5a6944d27 100644 --- a/app/Services/Contact/Avatar/GetGravatar.php +++ b/app/Services/Contact/Avatar/GetGravatar.php @@ -56,7 +56,7 @@ class GetGravatar extends BaseService ->get(); foreach ($contactFields as $contactField) { try { - $email = $contactField ? $contactField->data : null; + $email = $contactField->data; Validator::make(['email' => $email], ['email' => 'email']) ->validate(); diff --git a/app/Services/Contact/Avatar/GetGravatarURL.php b/app/Services/Contact/Avatar/GetGravatarURL.php index 85e97bbe7..bf05950a0 100644 --- a/app/Services/Contact/Avatar/GetGravatarURL.php +++ b/app/Services/Contact/Avatar/GetGravatarURL.php @@ -27,7 +27,7 @@ class GetGravatarURL extends BaseService * @param array $data * @return string|null */ - public function execute(array $data) + public function execute(array $data): ?string { $this->validate($data); @@ -39,6 +39,8 @@ class GetGravatarURL extends BaseService 'secure' => App::environment('production'), ]); } + + return null; } /** diff --git a/app/Services/Contact/Contact/UpdateBirthdayInformation.php b/app/Services/Contact/Contact/UpdateBirthdayInformation.php index 13a1def15..1f42a7ada 100644 --- a/app/Services/Contact/Contact/UpdateBirthdayInformation.php +++ b/app/Services/Contact/Contact/UpdateBirthdayInformation.php @@ -106,12 +106,10 @@ class UpdateBirthdayInformation extends BaseService */ private function clearRelatedSpecialDate(Contact $contact) { - if (is_null($contact->birthday_special_date_id)) { - return; - } - $specialDate = SpecialDate::find($contact->birthday_special_date_id); - $specialDate->delete(); + if (! is_null($specialDate)) { + $specialDate->delete(); + } } /** diff --git a/app/Services/Contact/Contact/UpdateDeceasedInformation.php b/app/Services/Contact/Contact/UpdateDeceasedInformation.php index 2cbbc523d..e2f0ffc2d 100644 --- a/app/Services/Contact/Contact/UpdateDeceasedInformation.php +++ b/app/Services/Contact/Contact/UpdateDeceasedInformation.php @@ -78,12 +78,10 @@ class UpdateDeceasedInformation extends BaseService */ private function clearRelatedSpecialDate(Contact $contact) { - if (is_null($contact->deceased_special_date_id)) { - return; - } - $specialDate = SpecialDate::find($contact->deceased_special_date_id); - $specialDate->delete(); + if (! is_null($specialDate)) { + $specialDate->delete(); + } } /** diff --git a/app/Services/Instance/Geolocalization/GetGPSCoordinate.php b/app/Services/Instance/Geolocalization/GetGPSCoordinate.php index c6abec3de..96b35e837 100644 --- a/app/Services/Instance/Geolocalization/GetGPSCoordinate.php +++ b/app/Services/Instance/Geolocalization/GetGPSCoordinate.php @@ -57,14 +57,10 @@ class GetGPSCoordinate extends BaseService * @param Place $place * @return string|null */ - private function buildQuery(Place $place) + private function buildQuery(Place $place): ?string { - if (! config('monica.enable_geolocation')) { - return; - } - - if (is_null(config('monica.location_iq_api_key'))) { - return; + if (! config('monica.enable_geolocation') || is_null(config('monica.location_iq_api_key'))) { + return null; } $query = http_build_query([ @@ -82,12 +78,12 @@ class GetGPSCoordinate extends BaseService * @param Place $place * @return Place|null */ - private function query(Place $place) + private function query(Place $place): ?Place { $query = $this->buildQuery($place); if (is_null($query)) { - return; + return null; } try { @@ -95,7 +91,7 @@ class GetGPSCoordinate extends BaseService } catch (ClientException $e) { Log::error('Error making the call: '.$e); - return; + return null; } $response = json_decode($response->getBody()); diff --git a/app/Services/Instance/Weather/GetWeatherInformation.php b/app/Services/Instance/Weather/GetWeatherInformation.php index 0a98e2a96..30517f899 100644 --- a/app/Services/Instance/Weather/GetWeatherInformation.php +++ b/app/Services/Instance/Weather/GetWeatherInformation.php @@ -88,7 +88,7 @@ class GetWeatherInformation extends BaseService * @return Weather|null * @throws \Exception */ - private function query(Place $place) + private function query(Place $place): ?Weather { $query = $this->buildQuery($place); @@ -106,6 +106,8 @@ class GetWeatherInformation extends BaseService } catch (ClientException $e) { Log::error('Error making the call: '.$e); } + + return null; } /** diff --git a/app/Services/VCalendar/ImportTask.php b/app/Services/VCalendar/ImportTask.php index df3adfeda..b25530941 100644 --- a/app/Services/VCalendar/ImportTask.php +++ b/app/Services/VCalendar/ImportTask.php @@ -115,7 +115,7 @@ class ImportTask extends BaseService * @param array $data * @return VCalendar|null */ - private function getEntry($data) + private function getEntry($data): ?VCalendar { try { $entry = Reader::read($data['entry'], Reader::OPTION_FORGIVING + Reader::OPTION_IGNORE_INVALID_LINES); @@ -125,6 +125,8 @@ class ImportTask extends BaseService } catch (ParseException $e) { // catch parse errors } + + return null; } /** diff --git a/app/Services/VCard/ImportVCard.php b/app/Services/VCard/ImportVCard.php index 7476cd454..67552801f 100644 --- a/app/Services/VCard/ImportVCard.php +++ b/app/Services/VCard/ImportVCard.php @@ -223,7 +223,7 @@ class ImportVCard extends BaseService * @param array $data * @return VCard|null */ - private function getEntry($data) + private function getEntry($data): ?VCard { $entry = $data['entry']; @@ -231,13 +231,15 @@ class ImportVCard extends BaseService try { $entry = Reader::read($entry, Reader::OPTION_FORGIVING + Reader::OPTION_IGNORE_INVALID_LINES); } catch (ParseException $e) { - return; + return null; } } if ($entry instanceof VCard) { return $entry; } + + return null; } /** @@ -391,10 +393,10 @@ class ImportVCard extends BaseService * @param VCard $entry * @return Contact|null */ - private function existingContactWithEmail(VCard $entry) + private function existingContactWithEmail(VCard $entry): ?Contact { if (empty($entry->EMAIL)) { - return; + return null; } if ($this->isValidEmail((string) $entry->EMAIL)) { @@ -407,6 +409,8 @@ class ImportVCard extends BaseService return $contactField->contact; } } + + return null; } /** diff --git a/app/Traits/Subscription.php b/app/Traits/Subscription.php index 3a0ad08f6..2c04dac5f 100644 --- a/app/Traits/Subscription.php +++ b/app/Traits/Subscription.php @@ -85,13 +85,11 @@ trait Subscription * * @return string|null */ - public function getSubscribedPlanName() + public function getSubscribedPlanName(): ?string { $plan = $this->getSubscribedPlan(); - if (! is_null($plan)) { - return $plan->name; - } + return is_null($plan) ? null : $plan->name; } /** diff --git a/composer.json b/composer.json index 5743f09df..cefa4271c 100644 --- a/composer.json +++ b/composer.json @@ -7,11 +7,11 @@ "require": { "php": "^7.2", "ext-bcmath": "*", - "ext-intl": "*", "ext-gd": "*", "ext-gmp": "*", + "ext-intl": "*", "ext-redis": "*", - "asbiin/laravel-webauthn": "~0.7", + "asbiin/laravel-webauthn": "^0.8", "bacon/bacon-qr-code": "^1.0", "creativeorange/gravatar": "~1.0", "doctrine/dbal": "2.9.3", @@ -47,7 +47,7 @@ "sentry/sentry-laravel": "^1.0", "stevebauman/location": "^5.0", "symfony/translation": "^4.0", - "thecodingmachine/safe": "^0.1.15", + "thecodingmachine/safe": "^1.0", "vectorface/whip": "^0.3.2", "vinkla/hashids": "^7.0", "vluzrmos/language-detector": "^2.0", @@ -62,7 +62,7 @@ "laravel/dusk": "^5.0", "matthiasnoback/live-code-coverage": "^1.0", "mockery/mockery": "^1.0", - "nunomaduro/larastan": "0.4.3", + "nunomaduro/larastan": "^0.5", "ocramius/package-versions": "1.4.*", "phpunit/phpcov": "^6.0", "phpunit/phpunit": "^8.0", @@ -70,8 +70,8 @@ "roave/security-advisories": "dev-master", "symfony/css-selector": "~4.0", "symfony/dom-crawler": "~5.0", - "thecodingmachine/phpstan-safe-rule": "^0.1", - "vimeo/psalm": "3.9.4" + "thecodingmachine/phpstan-safe-rule": "^1.0", + "vimeo/psalm": "^3.10" }, "suggest": { "ext-apcu": "*" diff --git a/composer.lock b/composer.lock index 503da2852..f9a7aff34 100644 --- a/composer.lock +++ b/composer.lock @@ -4,44 +4,44 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "35a48159fff5fb7909ce1c8cd9fde78d", + "content-hash": "b9cad7520c7e3c2d1e4d86cb5307aa97", "packages": [ { "name": "asbiin/laravel-webauthn", - "version": "0.7.0", + "version": "0.8.0", "source": { "type": "git", "url": "https://github.com/asbiin/laravel-webauthn.git", - "reference": "f4ce201d4571e01fa949fcd17cc78409b8bca817" + "reference": "1aca3fc776ddde16eb7bf2eff32c4dfa901237ce" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/asbiin/laravel-webauthn/zipball/f4ce201d4571e01fa949fcd17cc78409b8bca817", - "reference": "f4ce201d4571e01fa949fcd17cc78409b8bca817", + "url": "https://api.github.com/repos/asbiin/laravel-webauthn/zipball/1aca3fc776ddde16eb7bf2eff32c4dfa901237ce", + "reference": "1aca3fc776ddde16eb7bf2eff32c4dfa901237ce", "shasum": "" }, "require": { "guzzlehttp/psr7": "^1.5", - "laravel/framework": "^5.8 || ^6.0", + "laravel/framework": ">5.8", "php-http/discovery": "^1.6", "php-http/httplug": "^1.0 || ^2.0", "php-http/message": "^1.7", "psr/http-client": "^1.0", - "thecodingmachine/safe": "^0.1", - "web-auth/cose-lib": "^2.0", - "web-auth/webauthn-lib": "^2.0", + "thecodingmachine/safe": "^1.0", + "web-auth/cose-lib": "^3.0", + "web-auth/webauthn-lib": "^3.0", "web-token/jwt-signature": "^1.3 || ^2.0" }, "require-dev": { "ext-sqlite3": "*", - "nunomaduro/larastan": "^0.3.15 || ^0.4.0", - "orchestra/testbench": "^4.0", - "phpstan/phpstan-deprecation-rules": "^0.11", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-strict-rules": "^0.11", - "phpunit/phpunit": "^8.0", - "thecodingmachine/phpstan-safe-rule": "^0.1", - "vimeo/psalm": "^3.2" + "nunomaduro/larastan": "^0.5", + "orchestra/testbench": "^5.0", + "phpstan/phpstan-deprecation-rules": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^8.0 || ^9.0", + "thecodingmachine/phpstan-safe-rule": "^1.0", + "vimeo/psalm": "^3.9" }, "suggest": { "php-http/client-implementation": "Recommended for the AndroidSafetyNet Attestation Statement support", @@ -80,7 +80,7 @@ "security", "webauthn" ], - "time": "2019-12-05T16:03:49+00:00" + "time": "2020-03-07T15:51:45+00:00" }, { "name": "aws/aws-sdk-php", @@ -2486,16 +2486,16 @@ }, { "name": "laminas/laminas-zendframework-bridge", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/laminas/laminas-zendframework-bridge.git", - "reference": "0fb9675b84a1666ab45182b6c5b29956921e818d" + "reference": "faf68f6109ceeff24241226033ab59640c7eb63b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/0fb9675b84a1666ab45182b6c5b29956921e818d", - "reference": "0fb9675b84a1666ab45182b6c5b29956921e818d", + "url": "https://api.github.com/repos/laminas/laminas-zendframework-bridge/zipball/faf68f6109ceeff24241226033ab59640c7eb63b", + "reference": "faf68f6109ceeff24241226033ab59640c7eb63b", "shasum": "" }, "require": { @@ -2534,7 +2534,7 @@ "laminas", "zf" ], - "time": "2020-01-07T22:58:31+00:00" + "time": "2020-03-26T16:07:12+00:00" }, { "name": "laravel/cashier", @@ -3520,6 +3520,224 @@ ], "time": "2019-07-13T18:58:26+00:00" }, + { + "name": "league/uri", + "version": "6.2.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri.git", + "reference": "6998530902550c6e3fefb5ef98d56fe92ecdb603" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/6998530902550c6e3fefb5ef98d56fe92ecdb603", + "reference": "6998530902550c6e3fefb5ef98d56fe92ecdb603", + "shasum": "" + }, + "require": { + "ext-json": "*", + "league/uri-interfaces": "^2.1", + "php": "^7.2", + "psr/http-message": "^1.0" + }, + "conflict": { + "league/uri-schemes": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.16", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^8.0" + }, + "suggest": { + "ext-fileinfo": "Needed to create Data URI from a filepath", + "ext-intl": "Needed to improve host validation", + "league/uri-components": "Needed to easily manipulate URI objects" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "6.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "URI manipulation library", + "homepage": "http://uri.thephpleague.com", + "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "middleware", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc3986", + "rfc3987", + "rfc6570", + "uri", + "uri-template", + "url", + "ws" + ], + "time": "2020-03-17T14:40:17+00:00" + }, + { + "name": "league/uri-components", + "version": "2.2.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri-components.git", + "reference": "14bab20b05bc20d16dec17401a9027c679412589" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri-components/zipball/14bab20b05bc20d16dec17401a9027c679412589", + "reference": "14bab20b05bc20d16dec17401a9027c679412589", + "shasum": "" + }, + "require": { + "ext-json": "*", + "league/uri-interfaces": "^2.1", + "php": "^7.2", + "psr/http-message": "^1.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.3", + "guzzlehttp/psr7": "^1.4", + "laminas/laminas-diactoros": "^2.0", + "league/uri": "^6.0", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0 | ^8.0" + }, + "suggest": { + "ext-fileinfo": "Needed to create Data URI from a filepath", + "ext-gmp": "to improve handle IPV4 parsing", + "ext-intl": "to handle IDN host", + "jeremykendall/php-domain-parser": "Public Suffix and Top Level Domain parsing implemented in PHP", + "league/uri": "to allow manipulating URI objects", + "php-64bit": "to improve handle IPV4 parsing", + "psr/http-message-implementation": "to allow manipulating PSR-7 Uri objects" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "URI components manipulation library", + "homepage": "http://uri.thephpleague.com", + "keywords": [ + "authority", + "components", + "fragment", + "host", + "path", + "port", + "query", + "rfc3986", + "scheme", + "uri", + "url", + "userinfo" + ], + "time": "2020-02-09T19:44:04+00:00" + }, + { + "name": "league/uri-interfaces", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri-interfaces.git", + "reference": "0068a469958895ceaf3afcb489c0258adfa1e406" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/0068a469958895ceaf3afcb489c0258adfa1e406", + "reference": "0068a469958895ceaf3afcb489c0258adfa1e406", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": "^7.1" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^2.0", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-phpunit": "^0.12", + "phpstan/phpstan-strict-rules": "^0.12", + "phpunit/phpunit": "^7.0|^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "Common interface for URI representation", + "homepage": "http://github.com/thephpleague/uri-interfaces", + "keywords": [ + "rfc3986", + "rfc3987", + "uri", + "url" + ], + "time": "2020-02-08T12:10:37+00:00" + }, { "name": "mariuzzo/laravel-js-localization", "version": "v1.6.0", @@ -4098,16 +4316,16 @@ }, { "name": "nesbot/carbon", - "version": "2.32.0", + "version": "2.32.1", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "7410a349613bf32d02d8aaed1c669698ddd2b718" + "reference": "ecb525c766deb3bbbb6a0082ea0e41d3d9ae477c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/7410a349613bf32d02d8aaed1c669698ddd2b718", - "reference": "7410a349613bf32d02d8aaed1c669698ddd2b718", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ecb525c766deb3bbbb6a0082ea0e41d3d9ae477c", + "reference": "ecb525c766deb3bbbb6a0082ea0e41d3d9ae477c", "shasum": "" }, "require": { @@ -4165,7 +4383,7 @@ "datetime", "time" ], - "time": "2020-03-24T16:01:47+00:00" + "time": "2020-03-26T13:04:10+00:00" }, { "name": "nette/caching", @@ -9588,25 +9806,25 @@ }, { "name": "thecodingmachine/safe", - "version": "v0.1.16", + "version": "v1.1", "source": { "type": "git", "url": "https://github.com/thecodingmachine/safe.git", - "reference": "4e8f840f0a0a2ea167813c3994a7fc527c3c2182" + "reference": "f440677bad66c0ef42fa3f875bf05718028af5d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/4e8f840f0a0a2ea167813c3994a7fc527c3c2182", - "reference": "4e8f840f0a0a2ea167813c3994a7fc527c3c2182", + "url": "https://api.github.com/repos/thecodingmachine/safe/zipball/f440677bad66c0ef42fa3f875bf05718028af5d3", + "reference": "f440677bad66c0ef42fa3f875bf05718028af5d3", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "require-dev": { - "phpstan/phpstan": "^0.10.3", + "phpstan/phpstan": "^0.12", "squizlabs/php_codesniffer": "^3.2", - "thecodingmachine/phpstan-strict-rules": "^0.10.3" + "thecodingmachine/phpstan-strict-rules": "^0.12" }, "type": "library", "extra": { @@ -9716,7 +9934,7 @@ "MIT" ], "description": "PHP core functions that throw exceptions instead of returning FALSE on error", - "time": "2019-06-25T08:45:33+00:00" + "time": "2020-03-24T13:59:42+00:00" }, { "name": "tijsverkoyen/css-to-inline-styles", @@ -10013,16 +10231,16 @@ }, { "name": "web-auth/cose-lib", - "version": "v2.1.7", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/web-auth/cose-lib.git", - "reference": "8d1c37bac6e5db8d502b7735448d416f05fb4c70" + "reference": "bc28b39608b0674546d89318e55fb37eaec1a9e9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/cose-lib/zipball/8d1c37bac6e5db8d502b7735448d416f05fb4c70", - "reference": "8d1c37bac6e5db8d502b7735448d416f05fb4c70", + "url": "https://api.github.com/repos/web-auth/cose-lib/zipball/bc28b39608b0674546d89318e55fb37eaec1a9e9", + "reference": "bc28b39608b0674546d89318e55fb37eaec1a9e9", "shasum": "" }, "require": { @@ -10040,7 +10258,8 @@ "v1.1": "1.1.x-dev", "v1.2": "1.2.x-dev", "v2.0": "2.0.x-dev", - "v2.1": "2.1.x-dev" + "v2.1": "2.1.x-dev", + "v3.0": "3.0.x-dev" } }, "autoload": { @@ -10068,32 +10287,40 @@ "COSE", "RFC8152" ], - "time": "2019-09-04T20:53:12+00:00" + "time": "2020-02-03T21:25:10+00:00" }, { "name": "web-auth/metadata-service", - "version": "v2.1.7", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/web-auth/webauthn-metadata-service.git", - "reference": "5fc754d00dfa05913260dc3781227dfa8ed7dbdd" + "reference": "0e9d9b85590a0c5155b99d9a4b5bdaa01b1748e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/webauthn-metadata-service/zipball/5fc754d00dfa05913260dc3781227dfa8ed7dbdd", - "reference": "5fc754d00dfa05913260dc3781227dfa8ed7dbdd", + "url": "https://api.github.com/repos/web-auth/webauthn-metadata-service/zipball/0e9d9b85590a0c5155b99d9a4b5bdaa01b1748e3", + "reference": "0e9d9b85590a0c5155b99d9a4b5bdaa01b1748e3", "shasum": "" }, "require": { + "beberlei/assert": "^3.0", "ext-json": "*", + "league/uri": "^6.0", + "league/uri-components": "^2.1", "php": "^7.1", "psr/http-client": "^1.0", - "psr/http-factory": "^1.0" + "psr/http-factory": "^1.0", + "psr/log": "^1.1" + }, + "suggest": { + "psr/log-implementation": "Recommended to receive logs from the library" }, "type": "library", "extra": { "branch-alias": { - "v2.1": "2.1.x-dev" + "v2.1": "2.1.x-dev", + "v3.0": "3.0.x-dev" } }, "autoload": { @@ -10122,20 +10349,20 @@ "fido", "webauthn" ], - "time": "2019-09-04T20:53:12+00:00" + "time": "2020-02-03T20:09:52+00:00" }, { "name": "web-auth/webauthn-lib", - "version": "v2.1.7", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/web-auth/webauthn-lib.git", - "reference": "4cd346f2ef4d282296e503b7b1b3ef200347437b" + "reference": "a8a11bc30480e98768987fe0fc266aef08ec99da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/web-auth/webauthn-lib/zipball/4cd346f2ef4d282296e503b7b1b3ef200347437b", - "reference": "4cd346f2ef4d282296e503b7b1b3ef200347437b", + "url": "https://api.github.com/repos/web-auth/webauthn-lib/zipball/a8a11bc30480e98768987fe0fc266aef08ec99da", + "reference": "a8a11bc30480e98768987fe0fc266aef08ec99da", "shasum": "" }, "require": { @@ -10143,11 +10370,11 @@ "ext-json": "*", "ext-mbstring": "*", "ext-openssl": "*", - "nyholm/psr7": "^1.1", "php": "^7.2", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", "psr/http-message": "^1.0", + "psr/log": "^1.1", "ramsey/uuid": "^3.8", "spomky-labs/base64url": "^2.0", "spomky-labs/cbor-php": "^1.0.2", @@ -10155,6 +10382,8 @@ "web-auth/metadata-service": "self.version" }, "suggest": { + "psr/log-implementation": "Recommended to receive logs from the library", + "web-token/jwt-key-mgmt": "Mandatory for the AndroidSafetyNet Attestation Statement support", "web-token/jwt-signature-algorithm-ecdsa": "Recommended for the AndroidSafetyNet Attestation Statement support", "web-token/jwt-signature-algorithm-eddsa": "Recommended for the AndroidSafetyNet Attestation Statement support", "web-token/jwt-signature-algorithm-rsa": "Mandatory for the AndroidSafetyNet Attestation Statement support" @@ -10166,7 +10395,8 @@ "v1.1": "1.1.x-dev", "v1.2": "1.2.x-dev", "v2.0": "2.0.x-dev", - "v2.1": "2.1.x-dev" + "v2.1": "2.1.x-dev", + "v3.0": "3.0.x-dev" } }, "autoload": { @@ -10195,7 +10425,7 @@ "fido", "webauthn" ], - "time": "2019-09-09T12:04:09+00:00" + "time": "2020-02-03T21:25:10+00:00" }, { "name": "web-token/jwt-core", @@ -12265,47 +12495,42 @@ }, { "name": "nunomaduro/larastan", - "version": "v0.4.3", + "version": "v0.5.5", "source": { "type": "git", "url": "https://github.com/nunomaduro/larastan.git", - "reference": "ced5c2a216e1b7db7c27c4f1dee4c006f0b378e3" + "reference": "0a24d9c809185b04d00d8b8c1b58a6581cae6c40" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/larastan/zipball/ced5c2a216e1b7db7c27c4f1dee4c006f0b378e3", - "reference": "ced5c2a216e1b7db7c27c4f1dee4c006f0b378e3", + "url": "https://api.github.com/repos/nunomaduro/larastan/zipball/0a24d9c809185b04d00d8b8c1b58a6581cae6c40", + "reference": "0a24d9c809185b04d00d8b8c1b58a6581cae6c40", "shasum": "" }, "require": { "composer/composer": "^1.0", "ext-json": "*", - "illuminate/console": "5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/container": "5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/contracts": "5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/database": "5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/http": "5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/pipeline": "5.6.*|5.7.*|5.8.*|^6.0", - "illuminate/support": "5.6.*|5.7.*|5.8.*|^6.0", - "mockery/mockery": "^1.0|0.9.*", - "php": "^7.1.3", - "phpstan/phpstan": "^0.11.15", - "symfony/process": "^4.2" + "illuminate/console": "^6.0 || ^7.0", + "illuminate/container": "^6.0 || ^7.0", + "illuminate/contracts": "^6.0 || ^7.0", + "illuminate/database": "^6.0 || ^7.0", + "illuminate/http": "^6.0 || ^7.0", + "illuminate/pipeline": "^6.0 || ^7.0", + "illuminate/support": "^6.0 || ^7.0", + "mockery/mockery": "^0.9 || ^1.0", + "php": "^7.2", + "phpstan/phpstan": "^0.12", + "symfony/process": "^4.3 || ^5.0" }, "require-dev": { - "orchestra/testbench": "^3.8", + "orchestra/testbench": "^4.0 || ^5.0", "phpunit/phpunit": "^7.3 || ^8.2" }, "suggest": { - "orchestra/testbench": "^3.6" + "orchestra/testbench": "^4.0 || ^5.0" }, "type": "phpstan-extension", "extra": { - "laravel": { - "providers": [ - "NunoMaduro\\Larastan\\LarastanServiceProvider" - ] - }, "phpstan": { "includes": [ "extension.neon" @@ -12338,7 +12563,7 @@ "php", "static analysis" ], - "time": "2019-10-22T08:33:26+00:00" + "time": "2020-03-26T18:13:35+00:00" }, { "name": "openlss/lib-array2xml", @@ -12934,78 +13159,42 @@ }, { "name": "phpstan/phpstan", - "version": "0.11.19", + "version": "0.12.18", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "63cc502f6957b7f74efbac444b4cf219dcadffd7" + "reference": "1ce27fe29c8660a27926127d350d53d80c4d4286" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/63cc502f6957b7f74efbac444b4cf219dcadffd7", - "reference": "63cc502f6957b7f74efbac444b4cf219dcadffd7", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/1ce27fe29c8660a27926127d350d53d80c4d4286", + "reference": "1ce27fe29c8660a27926127d350d53d80c4d4286", "shasum": "" }, "require": { - "composer/xdebug-handler": "^1.3.0", - "jean85/pretty-package-versions": "^1.0.3", - "nette/bootstrap": "^2.4 || ^3.0", - "nette/di": "^2.4.7 || ^3.0", - "nette/neon": "^2.4.3 || ^3.0", - "nette/robot-loader": "^3.0.1", - "nette/schema": "^1.0", - "nette/utils": "^2.4.5 || ^3.0", - "nikic/php-parser": "^4.2.3", - "php": "~7.1", - "phpstan/phpdoc-parser": "^0.3.5", - "symfony/console": "~3.2 || ~4.0", - "symfony/finder": "~3.2 || ~4.0" - }, - "conflict": { - "symfony/console": "3.4.16 || 4.1.5" - }, - "require-dev": { - "brianium/paratest": "^2.0 || ^3.0", - "consistence/coding-standard": "^3.5", - "dealerdirect/phpcodesniffer-composer-installer": "^0.4.4", - "ext-intl": "*", - "ext-mysqli": "*", - "ext-simplexml": "*", - "ext-soap": "*", - "ext-zip": "*", - "jakub-onderka/php-parallel-lint": "^1.0", - "localheinz/composer-normalize": "^1.1.0", - "phing/phing": "^2.16.0", - "phpstan/phpstan-deprecation-rules": "^0.11", - "phpstan/phpstan-php-parser": "^0.11", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-strict-rules": "^0.11", - "phpunit/phpunit": "^7.5.14 || ^8.0", - "slevomat/coding-standard": "^4.7.2", - "squizlabs/php_codesniffer": "^3.3.2" + "php": "^7.1" }, "bin": [ - "bin/phpstan" + "phpstan", + "phpstan.phar" ], "type": "library", "extra": { "branch-alias": { - "dev-master": "0.11-dev" + "dev-master": "0.12-dev" } }, "autoload": { - "psr-4": { - "PHPStan\\": [ - "src/" - ] - } + "files": [ + "bootstrap.php" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "description": "PHPStan - PHP Static Analysis Tool", - "time": "2019-10-22T20:20:22+00:00" + "time": "2020-03-22T16:51:47+00:00" }, { "name": "phpunit/php-code-coverage", @@ -14564,22 +14753,22 @@ }, { "name": "thecodingmachine/phpstan-safe-rule", - "version": "v0.1.4", + "version": "v1.0.0", "source": { "type": "git", "url": "https://github.com/thecodingmachine/phpstan-safe-rule.git", - "reference": "70bfb6760b8165079d5e4a3feee9c057251cf56e" + "reference": "ba333eb573167371309c8ae8fdab932991925e96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thecodingmachine/phpstan-safe-rule/zipball/70bfb6760b8165079d5e4a3feee9c057251cf56e", - "reference": "70bfb6760b8165079d5e4a3feee9c057251cf56e", + "url": "https://api.github.com/repos/thecodingmachine/phpstan-safe-rule/zipball/ba333eb573167371309c8ae8fdab932991925e96", + "reference": "ba333eb573167371309c8ae8fdab932991925e96", "shasum": "" }, "require": { "php": "^7.1", - "phpstan/phpstan": "^0.10 | ^0.11", - "thecodingmachine/safe": "^0.1.11" + "phpstan/phpstan": "^0.10 | ^0.11 | ^0.12", + "thecodingmachine/safe": "^1.0" }, "require-dev": { "php-coveralls/php-coveralls": "^2.1", @@ -14589,7 +14778,7 @@ "type": "phpstan-extension", "extra": { "branch-alias": { - "dev-master": "0.1-dev" + "dev-master": "1.0-dev" }, "phpstan": { "includes": [ @@ -14613,7 +14802,7 @@ } ], "description": "A PHPStan rule to detect safety issues. Must be used in conjunction with thecodingmachine/safe", - "time": "2019-07-15T07:34:24+00:00" + "time": "2020-01-02T14:59:39+00:00" }, { "name": "theseer/fdomdocument", @@ -14697,16 +14886,16 @@ }, { "name": "vimeo/psalm", - "version": "3.9.4", + "version": "3.10.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "352bd3f5c5789db04e4010856c2f4e01ed354f4e" + "reference": "eeed5ecccc10131397f0eb7ee6da810c0be3a7fc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/352bd3f5c5789db04e4010856c2f4e01ed354f4e", - "reference": "352bd3f5c5789db04e4010856c2f4e01ed354f4e", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/eeed5ecccc10131397f0eb7ee6da810c0be3a7fc", + "reference": "eeed5ecccc10131397f0eb7ee6da810c0be3a7fc", "shasum": "" }, "require": { @@ -14789,7 +14978,7 @@ "inspection", "php" ], - "time": "2020-03-06T20:23:11+00:00" + "time": "2020-03-23T11:40:30+00:00" }, { "name": "webmozart/assert", @@ -14943,9 +15132,9 @@ "platform": { "php": "^7.2", "ext-bcmath": "*", - "ext-intl": "*", "ext-gd": "*", "ext-gmp": "*", + "ext-intl": "*", "ext-redis": "*" }, "platform-dev": [] diff --git a/phpstan.neon b/phpstan.neon index 3de9bba68..a6f9cee8f 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,6 +3,8 @@ includes: - ./vendor/thecodingmachine/phpstan-safe-rule/phpstan-safe-rule.neon parameters: + paths: + - app inferPrivatePropertyTypeFromConstructor: true level: 5 ignoreErrors: @@ -34,9 +36,19 @@ parameters: - '#Method [a-zA-Z0-9\\_:]+\(\) should return [a-zA-Z0-9\\_\|]+ but empty return statement found\.#' - '#Method [a-zA-Z0-9\\_:]+\(\) should return Illuminate\\Http\\Response but returns [a-zA-Z0-9\\_]+\.#' - - - message: '#Access to an undefined property App\\Interfaces\\IsJournalableInterface::\$account_id\.#' - path: */app/Models/Journal/JournalEntry.php + - message: '#Access to an undefined property App\\Interfaces\\IsJournalableInterface::\$account_id\.#' + path: */app/Models/Journal/JournalEntry.php + - message: '#Function factory invoked with 1 parameter, 0 required\.#' + path: */Console/Commands/Tests/SetupFrontEndTestUser.php + - message: '#Call to function is_null\(\) with Carbon\\Carbon will always evaluate to false\.#' + path: */Models/Instance/SpecialDate.php + - message: '#Call to function is_null\(\) with string will always evaluate to false\.#' + path: */Models/User/User.php + - message: '#Cannot assign offset ''VALUE'' to string\.#' + path: */Services/VCalendar/ExportVCalendar.php + - message: '#Property App\\Models\\Contact\\Contact::\$deceased_special_date_id \(int\) does not accept null\.#' + path: */Services/Contact/Contact/UpdateDeceasedInformation.php + excludes_analyse: - */app/Helpers/ComposerScripts.php - */app/Http/Controllers/DAV/Backend/CardDAV/AddressBookHome.php diff --git a/psalm.xml b/psalm.xml index f433874c3..9781ff08e 100644 --- a/psalm.xml +++ b/psalm.xml @@ -145,5 +145,7 @@ + + diff --git a/tests/Unit/Models/ActivityTest.php b/tests/Unit/Models/ActivityTest.php index 3cb33e303..d721458c9 100644 --- a/tests/Unit/Models/ActivityTest.php +++ b/tests/Unit/Models/ActivityTest.php @@ -33,7 +33,7 @@ class ActivityTest extends TestCase ]); $this->assertEquals( - $type->key, + $type->translation_key, $activity->getTitle() ); }