Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade l10 l11 #798

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ee26cdf
chore: php 8.2
charlesstrange2 Jan 7, 2025
8d2204d
chore: php-ide-helper 3.1.0
charlesstrange2 Jan 7, 2025
c9faaea
chore: etag-conditionals
charlesstrange2 Jan 8, 2025
b5ddf06
chore: use our fork for etag conditionals
charlesstrange2 Jan 8, 2025
f4b97df
chore: remove generators - un-supported
charlesstrange2 Jan 8, 2025
ec86678
chore: update phpunit to 10.5 and fix deprecations
charlesstrange2 Jan 8, 2025
077bc3b
chore: update laravel/browser-kit-testing > 7.2.2
charlesstrange2 Jan 8, 2025
e09e409
chore: update laravel/dusk > 8.2.12
charlesstrange2 Jan 8, 2025
bf14080
chore: update laravel and core components, modernise tests
charlesstrange2 Jan 8, 2025
23ac44e
chore: update migrations so sqlite can cope with dropColumns
charlesstrange2 Jan 9, 2025
4add5b4
chore: turn off password rehashing
charlesstrange2 Jan 9, 2025
7a1d17c
chore: fix migrations for tests part 1
charlesstrange2 Jan 9, 2025
0a63ed5
chore: rework tests to use refreshDatabase for speed where possible
charlesstrange2 Jan 9, 2025
ee68276
chore: fix migrations for tests part 2
charlesstrange2 Jan 9, 2025
75286a0
chore: fix migrations for tests part 3
charlesstrange2 Jan 10, 2025
474d975
chore: fix migrations for tests part 4
charlesstrange2 Jan 10, 2025
61ffae8
chore: fix migrations for tests part 5
charlesstrange2 Jan 10, 2025
f60ac6d
fix: Carbon 3 broke a validation rule
charlesstrange2 Jan 10, 2025
a6da893
fix: cast carbon 3 diifIn* functions to int to retain prior sums.
charlesstrange2 Jan 10, 2025
1ad319b
chore: update laravel/passport, again.
charlesstrange2 Jan 10, 2025
8faeec3
chore: update symfony/lock ^7.2.0
charlesstrange2 Jan 10, 2025
cbcbfd8
chore: update symfony/http-client ^7.2 for mailchimp
charlesstrange2 Jan 10, 2025
800a151
bug: remove duff secret
charlesstrange2 Jan 10, 2025
a2a84e1
bug: remove duff secret, again.
charlesstrange2 Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ DB_TESTING_MYSQL_USERNAME=homestead
DB_TESTING_MYSQL_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
CACHE_STORE=file
SESSION_DRIVER=file
QUEUE_CONNECTION=database

Expand Down
10 changes: 3 additions & 7 deletions .env.ghactions
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_DEBUG="true"
APP_ENV="local"
APP_KEY=base64:tgXIsT9WKaX080QNySMgPEROzNa+mc5jWFK7PtJQ+/g=
APP_KEY=
APP_LOG_LEVEL="debug"
APP_NAME="ARCVService"
APP_SEEDS="Dev"
Expand All @@ -12,14 +12,10 @@ ARC_SCHOOL_MONTH="9"
ARC_SERVICE_DOMAIN="arcv-service.test"
ARC_STORE_DOMAIN="arcv-store.test"
BROADCAST_DRIVER="log"
CACHE_DRIVER="file"
CACHE_STORE="file"
DB_CONNECTION="sqlite"
#DB_HOST="127.0.0.1"
#DB_PORT="3396"
DB_DATABASE="/tmp/data.db"
#DB_PASSWORD="arcv"
#DB_USERNAME="arcv"
MAIL_DRIVER="log"
MAIL_MAILER="log"
MAIL_ENCRYPTION="null"
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="Mailer Name"
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Licence - The Laravel framework is open-sourced software licensed under the MIT
Third Party Packages
- https://github.com/barryvdh/laravel-cors MIT Licence https://github.com/barryvdh/laravel-cors/blob/master/LICENSE
- https://github.com/barryvdh/laravel-dompdf MIT Licence https://opensource.org/licenses/MIT
- https://github.com/doctrine/dbal MIT Licence https://github.com/doctrine/dbal/blob/master/LICENSE
- https://github.com/moontoast/math Apache Licence 2.0 https://github.com/moontoast/math/blob/master/LICENSE
- https://github.com/esbenp/laravel-api-consumer None Stated
- https://github.com/ramsey/uuid MIT Licence https://github.com/ramsey/uuid/blob/master/LICENSE
Expand Down
18 changes: 9 additions & 9 deletions app/Child.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use Illuminate\Database\Eloquent\Relations\BelongsTo;

/**
* @property string $dob
* @property Carbon $dob
* @property bool $born
* @property bool $verified
* @property bool $defer
Expand Down Expand Up @@ -49,11 +49,11 @@ class Child extends Model implements IEvaluee
*/
protected $hidden = [];

/**
* The attributes that should be appended.
*
* @var array
*/
/**
* The attributes that should be appended.
*
* @var array
*/
protected $appends = ['can_defer'];

/**
Expand All @@ -63,7 +63,7 @@ class Child extends Model implements IEvaluee
*/
public function getEvaluator(): AbstractEvaluator
{
if ($this->has('family')) {
if (!empty($this->family)) {
return $this->family->getEvaluator();
}
$this->_evaluator = ($this->_evaluator) ?? EvaluatorFactory::make();
Expand All @@ -89,7 +89,7 @@ public function getEvaluator(): AbstractEvaluator
* @param string $format
* @return string
*/
public function getAgeString(string $format = '%y yr, %m mo') : string
public function getAgeString(string $format = '%y yr, %m mo'): string
{
$currentDate = Carbon::now();
$startOfMonth = Carbon::now()->startOfMonth();
Expand Down Expand Up @@ -134,7 +134,7 @@ public function calcFutureMonthYear(int $years, int $month = null): Carbon
// If we're born BEFORE the month
$years = ($this->dob->month < $month)
// ... then we'll start one year earlier
? $years -1
? $years - 1
// ... else we're a late starter and it'll be the number given.
: $years
;
Expand Down
12 changes: 6 additions & 6 deletions app/Family.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Family extends Model implements IEvaluee
*/
public function getEvaluator(): AbstractEvaluator
{
if ($this->has('registrations')) {
if (!empty($this->registrations)) {
return $this->registrations()->first()->getEvaluator();
}

Expand Down Expand Up @@ -153,7 +153,7 @@ public function getRvidAttribute(): string
*
* @return HasMany
*/
public function carers()
public function carers(): HasMany
{
return $this->hasMany('App\Carer');
}
Expand All @@ -162,7 +162,7 @@ public function carers()
* Get the Family's Children
* @return HasMany
*/
public function children()
public function children(): HasMany
{
return $this->hasMany('App\Child');
}
Expand All @@ -172,7 +172,7 @@ public function children()
*
* @return HasMany
*/
public function notes()
public function notes(): HasMany
{
return $this->hasMany('App\Note');
}
Expand All @@ -182,7 +182,7 @@ public function notes()
*
* @return HasMany
*/
public function registrations()
public function registrations(): HasMany
{
return $this->hasMany('App\Registration');
}
Expand All @@ -191,7 +191,7 @@ public function registrations()
* Get the Family's intial registered Centre.
* @return BelongsTo
*/
public function initialCentre()
public function initialCentre(): BelongsTo
{
return $this->belongsTo('App\Centre', 'initial_centre_id');
}
Expand Down
12 changes: 6 additions & 6 deletions app/Http/Controllers/Store/CentreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,14 @@ private function getCentreFamilyRegistrationsSummary(array $centre_ids, $dateFor
if ($reg->family->leaving_on && !$reg->family->rejoin_on) {
$startDate = Carbon::parse($reg->created_at);
$leaveDate = Carbon::parse($reg->family->leaving_on);
$diff = $startDate->diffInDays($leaveDate);
$diff = (int) $startDate->diffInDays($leaveDate);
} elseif ($reg->family->rejoin_on) {
$startDate = Carbon::parse($reg->created_at);
$leaveDate = Carbon::parse($reg->family->leaving_on);
$rejoinDate = Carbon::parse($reg->family->rejoin_on);
$now = Carbon::now();
$firstCount = $startDate->diffInDays($leaveDate);
$secondCount = $rejoinDate->diffInDays($now);
$firstCount = (int) $startDate->diffInDays($leaveDate);
$secondCount = (int) $rejoinDate->diffInDays($now);
$diff = $firstCount + $secondCount;
} else {
$diff = false;
Expand Down Expand Up @@ -469,14 +469,14 @@ private function getCentreSPRegistrationsSummary(array $centre_ids, $dateFormats
if ($reg->family->leaving_on && !$reg->family->rejoin_on) {
$startDate = Carbon::parse($reg->created_at);
$leaveDate = Carbon::parse($reg->family->leaving_on);
$diff = $startDate->diffInDays($leaveDate);
$diff = (int) $startDate->diffInDays($leaveDate);
} elseif ($reg->family->rejoin_on) {
$startDate = Carbon::parse($reg->created_at);
$leaveDate = Carbon::parse($reg->family->leaving_on);
$rejoinDate = Carbon::parse($reg->family->rejoin_on);
$now = Carbon::now();
$firstCount = $startDate->diffInDays($leaveDate);
$secondCount = $rejoinDate->diffInDays($now);
$firstCount = (int) $startDate->diffInDays($leaveDate);
$secondCount = (int) $rejoinDate->diffInDays($now);
$diff = $firstCount + $secondCount;
} else {
$diff = false;
Expand Down
7 changes: 5 additions & 2 deletions app/Providers/AppServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ class AppServiceProvider extends ServiceProvider
*
* @return void
*/
public function boot()
public function boot(): void
{
// Passport 12 doesn't enable this by default
Passport::enablePasswordGrant();

// Fix for MySQL < v5.7.7 and MariaDB environs.
// Recommended at https://laravel-news.com/laravel-5-4-key-too-long-error/
Schema::defaultStringLength(191);
Expand Down Expand Up @@ -49,7 +52,7 @@ public function boot()
*
* @return void
*/
public function register()
public function register(): void
{
// manual registration of non-auto-discovered packages
}
Expand Down
12 changes: 6 additions & 6 deletions app/Registration.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Registration extends Model implements IEvaluee
* Magically gets a public evaluator.
* @return AbstractEvaluator
*/
public function getEvaluator()
public function getEvaluator(): AbstractEvaluator
{
// if the private var is null, make a new one, stash it and return it.
$this->_evaluator = ($this->_evaluator) ?? EvaluatorFactory::makeFromRegistration($this);
Expand All @@ -79,7 +79,7 @@ public function getEvaluator()
*
* @return bool
*/
public function isActive()
public function isActive(): bool
{
// Get the last disbursement, if any.
$lastCollection = $this->bundles()
Expand Down Expand Up @@ -113,7 +113,7 @@ public function isActive()
*
* @return BelongsTo
*/
public function family()
public function family(): BelongsTo
{
return $this->belongsTo('App\Family');
}
Expand All @@ -123,7 +123,7 @@ public function family()
*
* @return BelongsTo
*/
public function centre()
public function centre(): BelongsTo
{
return $this->belongsTo('App\Centre');
}
Expand All @@ -148,7 +148,7 @@ public function currentBundle()
"registration_id" => $this->id,
"entitlement" => $this->getValuation()->getEntitlement()
]);
};
}

return $bundle;
}
Expand All @@ -158,7 +158,7 @@ public function currentBundle()
*
* @return HasMany
*/
public function bundles()
public function bundles(): HasMany
{
return $this->hasMany('App\Bundle');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ public function test($candidate)
: $this->fail()
;
}
}
}
15 changes: 5 additions & 10 deletions app/Specifications/IsAlmostStartDate.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@

class IsAlmostStartDate extends AbstractSpecification
{
protected Carbon $offsetDate;

/** @var Carbon $offsetDate */
protected $offsetDate;
private int $yearsAhead;

/** @var int $yearsAhead */
private $yearsAhead;

/** @var int $offsetMonth */
private $offsetMonth;
private int $offsetMonth;

/**
* IsAlmostStartDate constructor.
Expand All @@ -38,15 +34,14 @@ public function __construct(Carbon $offsetDate, int $yearsAhead, int $offsetMont
* @param Child $candidate
* @return Boolean
*/
public function isSatisfiedBy(Child $candidate)
public function isSatisfiedBy(Child $candidate): bool
{
/** @var Carbon $targetDate */
// Generate the date of the event in question
$targetDate = $candidate->calcFutureMonthYear($this->yearsAhead, $this->offsetMonth);

// Return (bool) if it's not happened yet AND If that date will happen this OR next month
return $targetDate->isFuture() &&
// If it's *this* month or *next* month, not *last* month
$this->offsetDate->diffInMonths($targetDate) <=1;
(int) $this->offsetDate->diffInMonths($targetDate) <= 1;
}
}
10 changes: 4 additions & 6 deletions app/Specifications/IsAlmostYears.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@

class IsAlmostYears extends AbstractSpecification
{
/** @var integer $years */
protected $years;
protected int $years;

/** @var Carbon $offsetDate */
protected $offsetDate;
protected Carbon $offsetDate;

/**
* @param integer $years How many years old they'll be
Expand All @@ -29,12 +27,12 @@ public function __construct(int $years, Carbon $offsetDate)
* @param Child $candidate
* @return Boolean
*/
public function isSatisfiedBy(Child $candidate)
public function isSatisfiedBy(Child $candidate): bool
{
/** @var Carbon $targetDate */
$targetDate = $candidate->dob->endOfMonth()->addYears($this->years);
return $targetDate->isFuture() &&
$this->offsetDate->diffInMonths($targetDate) <=1;
(int) $this->offsetDate->diffInMonths($targetDate) <= 1;
}

}
Loading