Skip to content

Commit 1f77828

Browse files
committed
minor #152 apply code style fixes (xabbuh)
This PR was merged into the 0.3-dev branch. Discussion ---------- apply code style fixes Commits ------- 9dd89ab apply code style fixes
2 parents a24418d + 9dd89ab commit 1f77828

File tree

11 files changed

+16
-16
lines changed

11 files changed

+16
-16
lines changed

src/Qossmic/DataMapper/DataMapper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public function mapFormsToData(\Traversable $forms, mixed &$data): void
143143
if (1 === \count($forms)) {
144144
$this->propertyAccessor->setValue($data, $writePropertyPath, reset($forms)->getData());
145145
} elseif (!\is_object($data)) {
146-
throw new LogicException(sprintf('Mapping multiple forms to a single method requires the form data to be an object but is "%s".', \gettype($data)));
146+
throw new LogicException(\sprintf('Mapping multiple forms to a single method requires the form data to be an object but is "%s".', \gettype($data)));
147147
} else {
148148
$formData = [];
149149

src/Qossmic/ExceptionHandling/ExceptionHandlerRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function has(string $strategy): bool
4343
public function get(string $strategy): ExceptionHandlerInterface
4444
{
4545
if (!isset($this->strategies[$strategy])) {
46-
throw new \InvalidArgumentException(sprintf('The exception handling strategy "%s" is not registered (use one of ["%s"]).', $strategy, implode(', ', array_keys($this->strategies))));
46+
throw new \InvalidArgumentException(\sprintf('The exception handling strategy "%s" is not registered (use one of ["%s"]).', $strategy, implode(', ', array_keys($this->strategies))));
4747
}
4848

4949
/* @phpstan-ignore-next-line */

src/Qossmic/Extension/RichModelFormsTypeExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public function configureOptions(OptionsResolver $resolver): void
123123

124124
foreach ($value as $strategy) {
125125
if (!$this->exceptionHandlerRegistry->has($strategy)) {
126-
throw new InvalidConfigurationException(sprintf('The "%s" error handling strategy is not registered.', $strategy));
126+
throw new InvalidConfigurationException(\sprintf('The "%s" error handling strategy is not registered.', $strategy));
127127
}
128128
}
129129

@@ -134,7 +134,7 @@ public function configureOptions(OptionsResolver $resolver): void
134134
$resolver->setAllowedTypes('factory', ['string', 'array', 'null', \Closure::class]);
135135
$resolver->setNormalizer('factory', function (Options $options, $value) {
136136
if (\is_string($value) && !class_exists($value)) {
137-
throw new InvalidConfigurationException(sprintf('The configured value for the "factory" option is not a valid class name ("%s" given).', $value));
137+
throw new InvalidConfigurationException(\sprintf('The configured value for the "factory" option is not a valid class name ("%s" given).', $value));
138138
}
139139

140140
if (\is_array($value) && !\is_callable($value)) {

src/Qossmic/Instantiator/ObjectInstantiator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,19 @@ public function instantiateObject(): ?object
3535
$factoryMethod = (new \ReflectionClass($this->factory))->getConstructor();
3636

3737
if (null === $factoryMethod) {
38-
throw new TransformationFailedException(sprintf('The class "%s" used as a factory does not have a constructor.', $this->factory));
38+
throw new TransformationFailedException(\sprintf('The class "%s" used as a factory does not have a constructor.', $this->factory));
3939
}
4040

4141
$factoryMethodAsString = $this->factory.'::__construct';
4242
if (!$factoryMethod->isPublic()) {
43-
throw new TransformationFailedException(sprintf('The factory method %s() is not public.', $factoryMethodAsString));
43+
throw new TransformationFailedException(\sprintf('The factory method %s() is not public.', $factoryMethodAsString));
4444
}
4545
} elseif (\is_array($this->factory) && \is_callable($this->factory)) {
4646
$class = \is_object($this->factory[0]) ? \get_class($this->factory[0]) : $this->factory[0];
4747
$factoryMethod = (new \ReflectionMethod($class, $this->factory[1]));
4848
$factoryMethodAsString = $class.'::'.$this->factory[1];
4949
if (!$factoryMethod->isPublic()) {
50-
throw new TransformationFailedException(sprintf('The factory method %s() is not public.', $factoryMethodAsString));
50+
throw new TransformationFailedException(\sprintf('The factory method %s() is not public.', $factoryMethodAsString));
5151
}
5252
} elseif ($this->factory instanceof \Closure) {
5353
$factoryMethod = new \ReflectionFunction($this->factory);

tests/Fixtures/DependencyInjection/Kernel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
4949

5050
public function getCacheDir(): string
5151
{
52-
return sprintf('%s/RichModelForms/%d/cache', sys_get_temp_dir(), self::VERSION_ID);
52+
return \sprintf('%s/RichModelForms/%d/cache', sys_get_temp_dir(), self::VERSION_ID);
5353
}
5454

5555
public function getLogDir(): string
5656
{
57-
return sprintf('%s/RichModelForms/%d/log', sys_get_temp_dir(), self::VERSION_ID);
57+
return \sprintf('%s/RichModelForms/%d/log', sys_get_temp_dir(), self::VERSION_ID);
5858
}
5959
}

tests/Fixtures/Form/ChangeProductStockType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void
2929
->add('stock', IntegerType::class, [
3030
'handle_exception' => $options['expected_stock_exception'],
3131
])
32-
->setDataMapper(new class() implements DataMapperInterface {
32+
->setDataMapper(new class implements DataMapperInterface {
3333
public function mapDataToForms($data, $forms): void
3434
{
3535
foreach ($forms as $form) {

tests/Fixtures/Form/GrossPriceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class GrossPriceType extends AbstractType
2929
public function buildForm(FormBuilderInterface $builder, array $options): void
3030
{
3131
if (null === $options['factory']) {
32-
throw new InvalidConfigurationException(sprintf('The %s requires a configured value for the "factory" option.', self::class));
32+
throw new InvalidConfigurationException(\sprintf('The %s requires a configured value for the "factory" option.', self::class));
3333
}
3434

3535
$builder

tests/Fixtures/Form/PriceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class PriceType extends AbstractType
2626
public function buildForm(FormBuilderInterface $builder, array $options): void
2727
{
2828
if (null === $options['factory']) {
29-
throw new InvalidConfigurationException(sprintf('The %s requires a configured value for the "factory" option.', self::class));
29+
throw new InvalidConfigurationException(\sprintf('The %s requires a configured value for the "factory" option.', self::class));
3030
}
3131
}
3232

tests/Fixtures/Model/Category.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function moveTo(self $parent): void
6262
private function validateName(string $name): void
6363
{
6464
if (\strlen($name) < 3) {
65-
throw new \LengthException(sprintf('The name must have a length of at least three characters ("%s" given).', $name));
65+
throw new \LengthException(\sprintf('The name must have a length of at least three characters ("%s" given).', $name));
6666
}
6767
}
6868
}

tests/Fixtures/Model/GrossPrice.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ final class GrossPrice
2323
public function __construct(int $amount, int $taxRate)
2424
{
2525
if ($amount < 0) {
26-
throw new \InvalidArgumentException(sprintf('A price cannot be less than 0 (%d given).', $amount));
26+
throw new \InvalidArgumentException(\sprintf('A price cannot be less than 0 (%d given).', $amount));
2727
}
2828

2929
if (!\in_array($taxRate, [7, 19], true)) {
30-
throw new \InvalidArgumentException(sprintf('The tax rate must be 7%% or 19%% (%d%% given).', $taxRate));
30+
throw new \InvalidArgumentException(\sprintf('The tax rate must be 7%% or 19%% (%d%% given).', $taxRate));
3131
}
3232

3333
$this->amount = $amount;

tests/Fixtures/Model/Price.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ final class Price
2222
public function __construct(int $amount)
2323
{
2424
if ($amount < 0) {
25-
throw new \InvalidArgumentException(sprintf('A price cannot be less than 0 (%d given).', $amount));
25+
throw new \InvalidArgumentException(\sprintf('A price cannot be less than 0 (%d given).', $amount));
2626
}
2727

2828
$this->amount = $amount;

0 commit comments

Comments
 (0)