Skip to content

Commit

Permalink
ci: add php 8.3 tests (#6892)
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin authored Mar 15, 2024
1 parent 3aa29a4 commit 0dd1ffb
Show file tree
Hide file tree
Showing 105 changed files with 2,133 additions and 2,809 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ jobs:
name: Lint Vue files
uses: monicahq/workflows/.github/workflows/lint_vue.yml@v2
with:
node-version: 18
node-version: 20
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ on:
workflow_dispatch:

env:
php-version: '8.2'
build-node-version: 18
php-version: '8.3'
build-node-version: 20

jobs:
####################
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
pull_request:
types: [opened, synchronize, reopened]

env:
php-version: '8.2'

concurrency:
group: Static ${{ github.ref }}
cancel-in-progress: true
Expand All @@ -16,4 +13,4 @@ jobs:
name: Static analysis
uses: monicahq/workflows/.github/workflows/static.yml@v2
with:
php-version: 8.2
php-version: 8.3
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
name: Run tests
uses: monicahq/workflows/.github/workflows/laravel.yml@v2
with:
php-versions: "['8.2']"
php-versions: "['8.2', '8.3']"
connections: "['sqlite', 'mysql', 'pgsql']"
default-php-version: '8.2'
default-connection: sqlite
Expand All @@ -35,4 +35,4 @@ jobs:
name: Build assets
uses: monicahq/workflows/.github/workflows/build_assets.yml@v2
with:
node-version: 18
node-version: 20
4 changes: 2 additions & 2 deletions app/Actions/AttemptToAuthenticateSocialite.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private function createUserToken(User $user, string $driver, SocialiteUser $soci
*
* @throws \Illuminate\Validation\ValidationException
*/
protected function throwFailedAuthenticationException(Request $request, string $driver, string $message = null): void
protected function throwFailedAuthenticationException(Request $request, string $driver, ?string $message = null): void
{
$this->fireFailedEvent($request, Auth::user());

Expand All @@ -183,7 +183,7 @@ protected function throwFailedAuthenticationException(Request $request, string $
/**
* Fire the failed authentication attempt event with the given arguments.
*/
protected function fireFailedEvent(Request $request, User $user = null): void
protected function fireFailedEvent(Request $request, ?User $user = null): void
{
event(new Failed('web', $user, [
'email' => $request->email,
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/AttemptToAuthenticateWebauthn.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ protected function throwFailedAuthenticationException(Request $request)
*
* @return void
*/
protected function fireFailedEvent(Request $request, Authenticatable $user = null)
protected function fireFailedEvent(Request $request, ?Authenticatable $user = null)
{
event(new Failed(config('webauthn.guard'), $user, [
Webauthn::username() => $user !== null
Expand Down
2 changes: 1 addition & 1 deletion app/Actions/Fortify/RedirectIfTwoFactorAuthenticatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ protected function throwFailedAuthenticationException(Request $request): void
/**
* Fire the failed authentication attempt event with the given arguments.
*/
protected function fireFailedEvent(Request $request, User $user = null): void
protected function fireFailedEvent(Request $request, ?User $user = null): void
{
event(new Failed(config('fortify.guard'), $user, [
'email' => $request->email,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function setCredentials(string $username, string $password): self
/**
* Get current uri.
*/
public function path(string $path = null): string
public function path(?string $path = null): string
{
$uri = GuzzleUtils::uriFor($this->baseUri);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class PrepareJobsContactPush
* @param Collection<array-key,Collection<array-key,string>> $localChanges
* @param Collection<array-key,ContactDto>|null $changes
*/
public function execute(Collection $localChanges, Collection $changes = null): Collection
public function execute(Collection $localChanges, ?Collection $changes = null): Collection
{
$modified = $this->preparePushChangedContacts($localChanges->get('modified', collect()), $changes ?? collect());
$added = $this->preparePushAddedContacts($localChanges->get('added', collect()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class ContactIndexViewHelper
{
public static function data($contacts, Vault $vault, int $labelId = null, User $user): array
public static function data($contacts, Vault $vault, ?int $labelId, User $user): array
{
$contactCollection = collect();
foreach ($contacts as $contact) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public static function dataForTemplatePage(Contact $contact, User $user, Templat
/**
* @param EloquentCollection<int,TemplatePage> $templatePages
*/
private static function getTemplatePagesList(EloquentCollection $templatePages, Contact $contact, TemplatePage $currentTemplatePage = null): Collection
private static function getTemplatePagesList(EloquentCollection $templatePages, Contact $contact, ?TemplatePage $currentTemplatePage = null): Collection
{
return $templatePages->filter(fn (TemplatePage $page) => $page->type !== TemplatePage::TYPE_CONTACT)
->map(fn (TemplatePage $page) => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

class CurrencyIndexViewHelper
{
public static function data(Account $account, int $currencyId = null): Collection
public static function data(Account $account, ?int $currencyId = null): Collection
{
$currenciesCollection = $account->currencies()
->orderBy('code')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class VaultIndexViewHelper
/**
* Get all the data needed for the general layout page.
*/
public static function layoutData(Vault $vault = null): array
public static function layoutData(?Vault $vault = null): array
{
return [
'user' => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class VaultSearchIndexViewHelper
{
public static function data(Vault $vault, string $term = null): array
public static function data(Vault $vault, ?string $term = null): array
{
return [
'contacts' => $term ? self::contacts($vault, $term) : [],
Expand Down
2 changes: 1 addition & 1 deletion app/Helpers/CollectionHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public static function sortByCollator(Collection $collect, callable|string $call
/**
* Get a Collator object for the locale or current locale.
*/
public static function getCollator(string $locale = null): \Collator
public static function getCollator(?string $locale = null): \Collator
{
static $collators = [];

Expand Down
6 changes: 3 additions & 3 deletions app/Helpers/DateHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public static function format(Carbon $date, User $user): string
* Return a date according to the timezone of the user, in a
* short format like "Oct 29, 1981".
*/
public static function formatDate(Carbon $date, string $timezone = null): string
public static function formatDate(Carbon $date, ?string $timezone = null): string
{
if ($timezone) {
$date->setTimezone($timezone);
Expand All @@ -34,7 +34,7 @@ public static function formatDate(Carbon $date, string $timezone = null): string
* Return a date and the time according to the timezone of the user, in a
* short format like "Oct 29, 1981 19:32".
*/
public static function formatShortDateWithTime(Carbon $date, string $timezone = null): string
public static function formatShortDateWithTime(Carbon $date, ?string $timezone = null): string
{
if ($timezone) {
$date->setTimezone($timezone);
Expand Down Expand Up @@ -86,7 +86,7 @@ public static function formatShortDay(Carbon $date): string
/**
* Return the day and the month in a format like "Monday (July 29th)".
*/
public static function formatDayAndMonthInParenthesis(Carbon $date, string $timezone = null): string
public static function formatDayAndMonthInParenthesis(Carbon $date, ?string $timezone = null): string
{
if ($timezone) {
$date->setTimezone($timezone);
Expand Down
8 changes: 4 additions & 4 deletions app/Helpers/MonetaryNumberHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ protected static function getCurrencies(): ISOCurrencies
* @param string|null $currency Currency of amount.
* @return string Formatted amount for display without currency symbol (ex: '1234.50').
*/
public static function formatValue(User $user, int $amount, string $currency = null, int $format = \NumberFormatter::DECIMAL): string
public static function formatValue(User $user, int $amount, ?string $currency = null, int $format = \NumberFormatter::DECIMAL): string
{
if ($currency === null) {
$currency = 'USD';
Expand Down Expand Up @@ -66,7 +66,7 @@ public static function formatValue(User $user, int $amount, string $currency = n
* @param string|null $currency Currency of amount.
* @return string Formatted amount for display without currency symbol (ex: '1234.50').
*/
public static function format(User $user, int $amount, string $currency = null): string
public static function format(User $user, int $amount, ?string $currency = null): string
{
$value = static::formatValue($user, $amount, $currency);

Expand Down Expand Up @@ -101,7 +101,7 @@ private static function formatMoney(Money $money, int $format = \NumberFormatter
* @param string $value Amount value in input format (ex: 145.00).
* @return int Amount as storable format (ex: 14500).
*/
public static function parseInput(string $value, string $currency = null): int
public static function parseInput(string $value, ?string $currency = null): int
{
$moneyParser = new DecimalMoneyParser(static::getCurrencies());
$money = $moneyParser->parse($value, new Currency($currency ?? 'USD'));
Expand All @@ -117,7 +117,7 @@ public static function parseInput(string $value, string $currency = null): int
* @param int $amount Amount value in storable format (ex: 100 for 1,00€).
* @return string Real value of amount in input format (ex: 1.24).
*/
public static function inputValue(int $amount, string $currency = null): string
public static function inputValue(int $amount, ?string $currency = null): string
{
$moneyFormatter = new DecimalMoneyFormatter(static::getCurrencies());
$money = new Money($amount, new Currency($currency ?? 'USD'));
Expand Down
6 changes: 3 additions & 3 deletions app/Helpers/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Extract the message.
*/
function trans_key(string $key = null): ?string
function trans_key(?string $key = null): ?string
{
return $key;
}
Expand All @@ -22,7 +22,7 @@ function trans_key(string $key = null): ?string
/**
* Translate the given message. It won't be extracted by monica:localize command.
*/
function trans_ignore(string $key = null, array $replace = [], string $locale = null): string
function trans_ignore(?string $key = null, array $replace = [], ?string $locale = null): string
{
return __($key, $replace, $locale);
}
Expand All @@ -32,7 +32,7 @@ function trans_ignore(string $key = null, array $replace = [], string $locale =
/**
* Get the current language from locale.
*/
function currentLang(string $locale = null): string
function currentLang(?string $locale = null): string
{
if ($locale === null) {
$locale = App::getLocale();
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class Account extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'storage_limit_in_mb',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Address extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'vault_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/AddressBookSubscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class AddressBookSubscription extends Model implements Loggable
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'user_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Call.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Call extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'contact_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/CallReason.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CallReason extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'call_reason_type_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/CallReasonType.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class CallReasonType extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'account_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class Contact extends VCardResource
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'vault_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/ContactFeedItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class ContactFeedItem extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'author_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/ContactImportantDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ContactImportantDate extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'contact_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/ContactImportantDateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ContactImportantDateType extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'vault_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/ContactInformation.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ContactInformation extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'contact_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/ContactInformationType.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ContactInformationType extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'account_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/ContactReminder.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class ContactReminder extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'contact_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/ContactTask.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class ContactTask extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'contact_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Currency.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Currency extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'code',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Emotion.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Emotion extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'account_id',
Expand Down
2 changes: 1 addition & 1 deletion app/Models/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class File extends Model
/**
* The attributes that are mass assignable.
*
* @var array<string>
* @var array<int,string>
*/
protected $fillable = [
'vault_id',
Expand Down
Loading

0 comments on commit 0dd1ffb

Please sign in to comment.