Release 2.20.0 (#4987)
This commit is contained in:
@@ -17,7 +17,7 @@ final class Expose
|
||||
public function __construct(public ?string $name = null, public ?string $label = null, string $type = 'string', public ?string $exp = null, public ?string $translationDomain = null)
|
||||
{
|
||||
if (!\in_array($type, ['string', 'datetime', 'date', 'time', 'integer', 'float', 'duration', 'boolean', 'array'])) {
|
||||
throw new \InvalidArgumentException(sprintf('Unknown type "%s" on annotation "%s".', $type, self::class));
|
||||
throw new \InvalidArgumentException(\sprintf('Unknown type "%s" on annotation "%s".', $type, self::class));
|
||||
}
|
||||
$this->type = $type;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ abstract class AbstractSpreadsheetRenderer
|
||||
|
||||
protected function setDurationTotal(Worksheet $sheet, int $column, int $row, string $startCoordinate, string $endCoordinate): void
|
||||
{
|
||||
$sheet->setCellValue(CellAddress::fromColumnAndRow($column, $row), sprintf('=SUBTOTAL(9,%s:%s)', $startCoordinate, $endCoordinate));
|
||||
$sheet->setCellValue(CellAddress::fromColumnAndRow($column, $row), \sprintf('=SUBTOTAL(9,%s:%s)', $startCoordinate, $endCoordinate));
|
||||
$style = $sheet->getStyle(CellAddress::fromColumnAndRow($column, $row));
|
||||
$style->getNumberFormat()->setFormatCode($this->durationFormat);
|
||||
}
|
||||
@@ -204,19 +204,19 @@ abstract class AbstractSpreadsheetRenderer
|
||||
if (null === $duration) {
|
||||
$duration = 0;
|
||||
}
|
||||
$sheet->setCellValue(CellAddress::fromColumnAndRow($column, $row), sprintf('=%s/%s', $duration, $this->durationBase));
|
||||
$sheet->setCellValue(CellAddress::fromColumnAndRow($column, $row), \sprintf('=%s/%s', $duration, $this->durationBase));
|
||||
$sheet->getStyle(CellAddress::fromColumnAndRow($column, $row))->getNumberFormat()->setFormatCode($this->durationFormat);
|
||||
}
|
||||
|
||||
protected function setRateTotal(Worksheet $sheet, int $column, int $row, string $startCoordinate, string $endCoordinate): void
|
||||
{
|
||||
$sheet->setCellValue(CellAddress::fromColumnAndRow($column, $row), sprintf('=SUBTOTAL(9,%s:%s)', $startCoordinate, $endCoordinate));
|
||||
$sheet->setCellValue(CellAddress::fromColumnAndRow($column, $row), \sprintf('=SUBTOTAL(9,%s:%s)', $startCoordinate, $endCoordinate));
|
||||
}
|
||||
|
||||
protected function setRateStyle(Worksheet $sheet, int $column, int $row, ?string $currency): void
|
||||
{
|
||||
$sheet->getStyle(CellAddress::fromColumnAndRow($column, $row))->getNumberFormat()->setFormatCode(
|
||||
sprintf($this->rateFormat, $currency ?? '')
|
||||
\sprintf($this->rateFormat, $currency ?? '')
|
||||
);
|
||||
}
|
||||
|
||||
@@ -710,7 +710,7 @@ abstract class AbstractSpreadsheetRenderer
|
||||
}
|
||||
|
||||
if (!\array_key_exists('render', $settings) || !\is_callable($settings['render'])) {
|
||||
throw new \RuntimeException(sprintf('Missing or invalid renderer for export column %s', $label));
|
||||
throw new \RuntimeException(\sprintf('Missing or invalid renderer for export column %s', $label));
|
||||
}
|
||||
|
||||
$amount = $settings['render']($sheet, $entryHeaderRow, $entryHeaderColumn, $exportItem);
|
||||
|
||||
@@ -57,7 +57,7 @@ class CsvRenderer extends AbstractSpreadsheetRenderer
|
||||
|
||||
protected function setDuration(Worksheet $sheet, int $column, int $row, ?int $duration): void
|
||||
{
|
||||
$sheet->setCellValue(CellAddress::fromColumnAndRow($column, $row), sprintf('=%s', $duration ?? 0));
|
||||
$sheet->setCellValue(CellAddress::fromColumnAndRow($column, $row), \sprintf('=%s', $duration ?? 0));
|
||||
}
|
||||
|
||||
protected function setRate(Worksheet $sheet, int $column, int $row, ?float $rate, ?string $currency): void
|
||||
|
||||
@@ -161,7 +161,7 @@ final class ServiceExport
|
||||
$items = array_merge($items, $repository->getExportItemsForQuery($query));
|
||||
if ($max !== null && \count($items) > $max) {
|
||||
throw new TooManyItemsExportException(
|
||||
sprintf('Limit reached! Expected max. %s items but got %s', $max, \count($items))
|
||||
\sprintf('Limit reached! Expected max. %s items but got %s', $max, \count($items))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ final class DurationFormatter implements CellFormatterInterface
|
||||
throw new \InvalidArgumentException('Unsupported value given, only int is supported');
|
||||
}
|
||||
|
||||
$sheet->setCellValue(CellAddress::fromColumnAndRow($column, $row), sprintf('=%s/86400', $value));
|
||||
$sheet->setCellValue(CellAddress::fromColumnAndRow($column, $row), \sprintf('=%s/86400', $value));
|
||||
$sheet->getStyle(CellAddress::fromColumnAndRow($column, $row))->getNumberFormat()->setFormatCode(self::DURATION_FORMAT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,13 +56,13 @@ final class AnnotationExtractor implements ExtractorInterface
|
||||
foreach ($definitions as $definition) {
|
||||
$arguments = $definition->getArguments();
|
||||
if (!\array_key_exists('name', $arguments) || $arguments['name'] === null) {
|
||||
throw new ExtractorException(sprintf('@Expose needs the "name" attribute on class level hierarchy, check %s::class', $value));
|
||||
throw new ExtractorException(\sprintf('@Expose needs the "name" attribute on class level hierarchy, check %s::class', $value));
|
||||
}
|
||||
if (!\array_key_exists('exp', $arguments) || $arguments['exp'] === null) {
|
||||
throw new ExtractorException(sprintf('@Expose needs the "exp" attribute on class level hierarchy, check %s::class', $value));
|
||||
throw new ExtractorException(\sprintf('@Expose needs the "exp" attribute on class level hierarchy, check %s::class', $value));
|
||||
}
|
||||
if (!\array_key_exists('label', $arguments) || $arguments['label'] === null) {
|
||||
throw new ExtractorException(sprintf('@Expose needs the "label" attribute on class level hierarchy, check %s::class', $value));
|
||||
throw new ExtractorException(\sprintf('@Expose needs the "label" attribute on class level hierarchy, check %s::class', $value));
|
||||
}
|
||||
|
||||
$parsed = $this->expressionLanguage->parse($arguments['exp'], ['object']);
|
||||
@@ -87,10 +87,10 @@ final class AnnotationExtractor implements ExtractorInterface
|
||||
foreach ($definitions as $definition) {
|
||||
$arguments = $definition->getArguments();
|
||||
if (\array_key_exists('exp', $arguments) && $arguments['exp'] !== null) {
|
||||
throw new ExtractorException(sprintf('@Expose only supports the "exp" attribute on class level hierarchy, check %s::$%s', $value, $property->getName()));
|
||||
throw new ExtractorException(\sprintf('@Expose only supports the "exp" attribute on class level hierarchy, check %s::$%s', $value, $property->getName()));
|
||||
}
|
||||
if (!\array_key_exists('label', $arguments) || $arguments['label'] === null) {
|
||||
throw new ExtractorException(sprintf('@Expose needs the "label" attribute on property level hierarchy, check %s::$%s', $value, $property->getName()));
|
||||
throw new ExtractorException(\sprintf('@Expose needs the "label" attribute on property level hierarchy, check %s::$%s', $value, $property->getName()));
|
||||
}
|
||||
|
||||
$name = $property->getName();
|
||||
@@ -120,15 +120,15 @@ final class AnnotationExtractor implements ExtractorInterface
|
||||
$definitions = $method->getAttributes(Expose::class);
|
||||
foreach ($definitions as $definition) {
|
||||
if (\count($method->getParameters()) > 0) {
|
||||
throw new ExtractorException(sprintf('@Expose does not support method %s::%s(...) as it has required parameters.', $value, $method->getName()));
|
||||
throw new ExtractorException(\sprintf('@Expose does not support method %s::%s(...) as it has required parameters.', $value, $method->getName()));
|
||||
}
|
||||
|
||||
$arguments = $definition->getArguments();
|
||||
if (\array_key_exists('exp', $arguments) && $arguments['exp'] !== null) {
|
||||
throw new ExtractorException(sprintf('@Expose only supports the "exp" attribute on method level hierarchy, check %s::%s()', $value, $method->getName()));
|
||||
throw new ExtractorException(\sprintf('@Expose only supports the "exp" attribute on method level hierarchy, check %s::%s()', $value, $method->getName()));
|
||||
}
|
||||
if (!\array_key_exists('label', $arguments) || $arguments['label'] === null) {
|
||||
throw new ExtractorException(sprintf('@Expose needs the "label" attribute on method level hierarchy, check %s::%s()', $value, $method->getName()));
|
||||
throw new ExtractorException(\sprintf('@Expose needs the "label" attribute on method level hierarchy, check %s::%s()', $value, $method->getName()));
|
||||
}
|
||||
|
||||
$name = $method->getName();
|
||||
|
||||
Reference in New Issue
Block a user