Merge branch 'develop' into trunk
This commit is contained in:
commit
b166fa01e1
25 changed files with 59 additions and 72 deletions
|
|
@ -16,8 +16,6 @@ abstract class AuthController extends Controller
|
|||
{
|
||||
public function __construct()
|
||||
{
|
||||
|
||||
// @phpstan-ignore assign.propertyType
|
||||
ResetPassword::$createUrlCallback = $this->createResetUrl(...);
|
||||
VerifyEmail::$createUrlCallback = $this->createValidationUrl(...);
|
||||
}
|
||||
|
|
@ -50,8 +48,12 @@ abstract class AuthController extends Controller
|
|||
);
|
||||
}
|
||||
|
||||
public function createResetUrl(Customer $notifiable, string $token): string
|
||||
public function createResetUrl(mixed $notifiable, string $token): string
|
||||
{
|
||||
if (! is_object($notifiable) || ! ($notifiable instanceof Customer)) {
|
||||
throw new \InvalidArgumentException('Invalid notifiable provided.');
|
||||
}
|
||||
|
||||
return url(
|
||||
URL::temporarySignedRoute(
|
||||
'fo.auth.reset-password',
|
||||
|
|
|
|||
|
|
@ -70,8 +70,8 @@ class ExceptionsHelper
|
|||
*
|
||||
* @template T of mixed
|
||||
*
|
||||
* @param array<T> $params
|
||||
* @return array<T>
|
||||
* @param array<array-key, T> $params
|
||||
* @return array<string|T>
|
||||
*/
|
||||
private static function getAnonymizedSentryParams(array $params): array
|
||||
{
|
||||
|
|
@ -89,7 +89,6 @@ class ExceptionsHelper
|
|||
};
|
||||
}
|
||||
|
||||
// @phpstan-ignore return.type
|
||||
return $params;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -277,10 +277,10 @@ final class StringEncoder
|
|||
|
||||
foreach ($bytes as $byte) {
|
||||
$parts[] = match (true) {
|
||||
// @phpstan-ignore argument.type
|
||||
$byte <= 0x7F => chr($byte),
|
||||
isset($overrides[$byte]) => $overrides[$byte],
|
||||
default => self::encodeLatin1ByteAsUtf8($byte),
|
||||
// @phpstan-ignore argument.type (ASCII range check)
|
||||
$byte <= 0x7F => chr($byte),
|
||||
isset($overrides[$byte]) => $overrides[$byte],
|
||||
default => self::encodeLatin1ByteAsUtf8($byte),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ use Illuminate\Support\Facades\Storage;
|
|||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Validation\Rules\Enum;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Propaganistas\LaravelPhone\PhoneNumber;
|
||||
use Symfony\Component\Finder\SplFileInfo;
|
||||
|
|
@ -179,16 +178,15 @@ class ToolboxHelper extends ToolboxHelperCore
|
|||
*/
|
||||
public static function getOriginal(Model $model, string $attribute): mixed
|
||||
{
|
||||
if (
|
||||
\in_array('Spatie\Translatable\HasTranslations', \class_uses_recursive($model)) && // @phpstan-ignore-next-line
|
||||
$model->isTranslatableAttribute($attribute)
|
||||
) {
|
||||
// @phpstan-ignore-next-line
|
||||
|
||||
// @phpstan-ignore method.notFound (\Spatie\Translatable\HasTranslations could be absent)
|
||||
if (\in_array('Spatie\Translatable\HasTranslations', \class_uses_recursive($model)) && $model->isTranslatableAttribute($attribute)) {
|
||||
// @phpstan-ignore method.notFound (\Spatie\Translatable\HasTranslations could be absent)
|
||||
return $model->getTranslation(
|
||||
$attribute,
|
||||
// @phpstan-ignore-next-line
|
||||
// @phpstan-ignore method.notFound (\Spatie\Translatable\HasTranslations could be absent)
|
||||
$model->getLocale(),
|
||||
// @phpstan-ignore-next-line
|
||||
// @phpstan-ignore method.notFound (\Spatie\Translatable\HasTranslations could be absent)
|
||||
$model->useFallbackLocale()
|
||||
);
|
||||
}
|
||||
|
|
@ -216,7 +214,7 @@ class ToolboxHelper extends ToolboxHelperCore
|
|||
throw_unless(preg_match($localeRegex, $currentLocale), \InvalidArgumentException::class, 'Invalid locale identifier.');
|
||||
|
||||
/** @var array<string,string> $locales */
|
||||
$locales = config('app.locales', []);
|
||||
$locales = Config::array('app.locales', []);
|
||||
$locales = Collection::make($locales)
|
||||
->filter(fn (string $locale) => (bool) preg_match($localeRegex, $locale))
|
||||
->mapWithKeys(fn (string $locale) => [$locale => $locale]);
|
||||
|
|
@ -377,25 +375,6 @@ class ToolboxHelper extends ToolboxHelperCore
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get validated enum value from request or return default value if validation fails
|
||||
*
|
||||
* @param int $default The default value to return if validation fails.
|
||||
* @param string $field The request field to validate.
|
||||
* @param class-string<\UnitEnum> $enumPath The enum class path to validate against.
|
||||
*/
|
||||
public static function getValidatedEnum(int $default, string $field, string $enumPath): int
|
||||
{
|
||||
try {
|
||||
return \intval(Validator::make(
|
||||
[$field => \request()->input($field)],
|
||||
[$field => new Enum($enumPath)]
|
||||
)->validated()[$field]);
|
||||
} catch (ValidationException) {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert Hex color to RGB
|
||||
*
|
||||
|
|
|
|||
|
|
@ -147,8 +147,11 @@ class Product extends Model implements ModelWithOrder, ModelWithStar, ModelWithS
|
|||
$model->slug = Str::slug($model->name);
|
||||
$model->picture = FileStorageHelper::storeFile($model, $model->picture, true);
|
||||
$model->picture_large = FileStorageHelper::storeFile($model, $model->picture_large, true);
|
||||
// @phpstan-ignore cast.int
|
||||
$model->order ??= (int) self::query()->max('order');
|
||||
|
||||
if ($model->order === null) {
|
||||
$max = self::query()->max('order');
|
||||
$model->order = is_scalar($max) ? intval($max) + 1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
private static function assertNameIsUnique(?string $name, ?string $id = null): void
|
||||
|
|
|
|||
|
|
@ -96,9 +96,10 @@ class Slide extends Model implements ModelWithOrder, ModelWithStatus
|
|||
private static function manageFields(self $model): void
|
||||
{
|
||||
$model->picture = FileStorageHelper::storeFile($model, $model->picture, true);
|
||||
if (is_null($model->order)) {
|
||||
// @phpstan-ignore argument.type
|
||||
$model->order = intval(self::query()->max('order'));
|
||||
|
||||
if ($model->order === null) {
|
||||
$max = self::query()->max('order');
|
||||
$model->order = is_scalar($max) ? intval($max) + 1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +111,7 @@ class Slide extends Model implements ModelWithOrder, ModelWithStatus
|
|||
if ($actualStatus !== $model->status) {
|
||||
resolve(Session::class)->flash('bo.info', \trans(
|
||||
'The publication status is updated according to the scheduled dates. '
|
||||
. 'To change the publication status, please edit or remove the corresponding dates.'
|
||||
. 'To change the publication status, please edit or remove the corresponding dates.'
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,9 +76,9 @@ class Tag extends Model implements ModelWithOrder, ModelWithStatus
|
|||
self::assertLabelIsUnique($model->label, $model->id);
|
||||
$model->slug = Str::slug($model->label);
|
||||
|
||||
if (is_null($model->order)) {
|
||||
// @phpstan-ignore argument.type
|
||||
$model->order = intval(self::query()->max('order'));
|
||||
if ($model->order === null) {
|
||||
$max = self::query()->max('order');
|
||||
$model->order = is_scalar($max) ? intval($max) + 1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use Illuminate\Bus\Queueable;
|
|||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Notifications\Messages\MailMessage;
|
||||
use Illuminate\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
|
||||
class MissingOrderReminderNotification extends Notification implements ShouldQueue
|
||||
{
|
||||
|
|
@ -30,7 +31,7 @@ class MissingOrderReminderNotification extends Notification implements ShouldQue
|
|||
public function __construct(
|
||||
private readonly CarbonInterface $pickupDay
|
||||
) {
|
||||
$appUrl = config()->string('app.url');
|
||||
$appUrl = Config::string('app.url');
|
||||
$appHost = parse_url($appUrl, \PHP_URL_HOST);
|
||||
|
||||
if (empty($appHost)) {
|
||||
|
|
@ -39,8 +40,7 @@ class MissingOrderReminderNotification extends Notification implements ShouldQue
|
|||
|
||||
$this->appUrl = $appUrl;
|
||||
$this->appHost = $appHost;
|
||||
$this->appName = config()
|
||||
->string('app.name', 'La Boutique de Cocotte');
|
||||
$this->appName = Config::string('app.name', 'La Boutique de Cocotte');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Money\Currencies\ISOCurrencies;
|
||||
use Money\Currency;
|
||||
|
|
@ -29,8 +30,8 @@ class MoneyServiceProvider extends ServiceProvider
|
|||
$this->app->singleton(
|
||||
Currency::class,
|
||||
fn () => new Currency(
|
||||
// @phpstan-ignore argument.type
|
||||
config(
|
||||
// @phpstan-ignore argument.type (Should throw if not provided)
|
||||
Config::string(
|
||||
'app.currency',
|
||||
'EUR'
|
||||
)
|
||||
|
|
@ -40,8 +41,7 @@ class MoneyServiceProvider extends ServiceProvider
|
|||
$this->app->singleton(
|
||||
\NumberFormatter::class,
|
||||
fn () => new \NumberFormatter(
|
||||
// @phpstan-ignore argument.type
|
||||
config('app.locale', 'fr_FR'),
|
||||
Config::string('app.locale', 'fr_FR'),
|
||||
\NumberFormatter::CURRENCY
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -109,7 +109,6 @@ class RouteServiceProvider extends ServiceProvider
|
|||
fn (string $value) => $this->resolvePublishedProductWithPricing($value)
|
||||
);
|
||||
|
||||
// * CSP Route
|
||||
$this->cspReportRoute();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ class DataTableService
|
|||
return array_values(array_filter(
|
||||
$cast::cases(),
|
||||
fn ($item): bool => str_contains(
|
||||
// @phpstan-ignore method.notFound
|
||||
// @phpstan-ignore method.notFound (PhpStan cannot detect the label() method on BaseEnum cases)
|
||||
mb_strtolower((string) $item->label()),
|
||||
$searchLower
|
||||
)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ enum DiscountType: int
|
|||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::AMOUNT->name => 'Montant',
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ enum EmployeeSite: string
|
|||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::slhp->name => 'SLHP',
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ enum OrderStatus: int
|
|||
/**
|
||||
* Optional labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::WAITING->name => 'En attente',
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ enum PriceShowingMode: string
|
|||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::authenticated->name => 'Client Connecté',
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ enum ProductBrand: string
|
|||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::none->name => 'Sans marque',
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ enum RepeatFrequency: string
|
|||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::WEEKLY->name => 'Toutes les semaines',
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ enum SellUnit: string
|
|||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::PCE->name => 'Pièce',
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ enum StaticPageSlug: string
|
|||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::CONTACT->name => 'contact',
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ enum StatsCustomerType: int
|
|||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::nbSalarie->name => 'Nombre de salariés',
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ enum StatsShopType: int
|
|||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::nbActiveClients->name => 'Nombre de clients actifs',
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ enum TaxRate: int
|
|||
/**
|
||||
* Optional labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::TVA_20->name => 'TVA 20%',
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ enum InvoicingUnit: string
|
|||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::PCE->name => 'Pièce',
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ enum OrderUnit: string
|
|||
/**
|
||||
* Optionnal labels definition
|
||||
*
|
||||
* @phpstan-ignore-next-line
|
||||
* @phpstan-ignore-next-line classConstant.unused (Base enum usage)
|
||||
*/
|
||||
private const LABELS = [
|
||||
self::PCE->name => 'Pièce',
|
||||
|
|
|
|||
|
|
@ -195,12 +195,16 @@ class PickupSchedulingService
|
|||
->addDays(self::CUTOFF_DAY->value - 1)
|
||||
->addHours(self::CUTOFF_HOUR);
|
||||
|
||||
// @phpstan-ignore notIdentical.alwaysFalse
|
||||
return self::CUTOFF_WEEK_OFFSET !== 0
|
||||
? $deadline->addWeeks(self::CUTOFF_WEEK_OFFSET)
|
||||
return $this->getCutoffWeekOffset() !== 0
|
||||
? $deadline->addWeeks($this->getCutoffWeekOffset())
|
||||
: $deadline;
|
||||
}
|
||||
|
||||
private function getCutoffWeekOffset(): int
|
||||
{
|
||||
return self::CUTOFF_WEEK_OFFSET;
|
||||
}
|
||||
|
||||
protected function isBefore(CarbonInterface $date): bool
|
||||
{
|
||||
return $this->getNow()->lessThanOrEqualTo($date);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue