mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-30 13:34:28 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
6caf605fe2
commit
e01b06fb85
80 changed files with 173 additions and 218 deletions
|
@ -111,7 +111,7 @@ class AppExtension extends AbstractExtension
|
|||
public function getTests()
|
||||
{
|
||||
return [
|
||||
new TwigTest('instanceof', function ($var, $instance) {
|
||||
new TwigTest('instanceof', static function ($var, $instance) {
|
||||
return $var instanceof $instance;
|
||||
}),
|
||||
];
|
||||
|
@ -150,7 +150,7 @@ class AppExtension extends AbstractExtension
|
|||
return $this->entityURLGenerator->getURL($entity, $method);
|
||||
}
|
||||
|
||||
public function formatCurrency($amount, ?Currency $currency = null, int $decimals = 5)
|
||||
public function formatCurrency($amount, ?Currency $currency = null, int $decimals = 5): string
|
||||
{
|
||||
if ($amount instanceof BigDecimal) {
|
||||
$amount = (string) $amount;
|
||||
|
@ -159,12 +159,12 @@ class AppExtension extends AbstractExtension
|
|||
return $this->moneyFormatter->format($amount, $currency, $decimals);
|
||||
}
|
||||
|
||||
public function siFormat($value, $unit, $decimals = 2, bool $show_all_digits = false)
|
||||
public function siFormat($value, $unit, $decimals = 2, bool $show_all_digits = false): string
|
||||
{
|
||||
return $this->siformatter->format($value, $unit, $decimals, $show_all_digits);
|
||||
return $this->siformatter->format($value, $unit, $decimals);
|
||||
}
|
||||
|
||||
public function amountFormat($value, ?MeasurementUnit $unit, array $options = [])
|
||||
public function amountFormat($value, ?MeasurementUnit $unit, array $options = []): string
|
||||
{
|
||||
return $this->amountFormatter->format($value, $unit, $options);
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ class BarcodeExtension extends AbstractExtension
|
|||
public function getFilters()
|
||||
{
|
||||
return [
|
||||
new TwigFilter('barcodeSVG', function (string $content, string $type = 'QRCODE') {
|
||||
new TwigFilter('barcodeSVG', static function (string $content, string $type = 'QRCODE') {
|
||||
$barcodeFactory = new Barcode();
|
||||
$barcode = $barcodeFactory->getBarcodeObj($type, $content);
|
||||
|
||||
|
|
|
@ -60,7 +60,8 @@ final class InheritanceSecurityPolicy implements SecurityPolicyInterface
|
|||
{
|
||||
$this->allowedMethods = [];
|
||||
foreach ($methods as $class => $m) {
|
||||
$this->allowedMethods[$class] = array_map(function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]);
|
||||
$this->allowedMethods[$class] = array_map(
|
||||
static function ($value) { return strtr($value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz'); }, \is_array($m) ? $m : [$m]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ final class TypeLabelExtension extends AbstractExtension
|
|||
$this->nameGenerator = $elementTypeNameGenerator;
|
||||
}
|
||||
|
||||
public function getFunctions()
|
||||
public function getFunctions(): array
|
||||
{
|
||||
return [
|
||||
new TwigFunction('elementType', [$this->nameGenerator, 'getLocalizedTypeLabel']),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue