Skip to content

Commit

Permalink
code styles
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpapst committed Jul 28, 2024
1 parent 2f0e661 commit 9317755
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion EventSubscriber/ActionsSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function onActions(PageActionsEvent $event): void
]);
}

if (!isset($payload['counter'])) {
if (!isset($payload['counter']) || !is_numeric($payload['counter'])) {
return;
}

Expand Down
3 changes: 3 additions & 0 deletions Form/DemoType.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

/**
* @extends AbstractType<DemoEntity>
*/
class DemoType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
Expand Down
10 changes: 5 additions & 5 deletions Repository/DemoRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@

final class DemoRepository
{
/**
* @var string
*/
private string $storage;

public function __construct(string $dataDirectory)
Expand All @@ -37,8 +34,8 @@ public function getDemoEntity(): DemoEntity
if ($data !== false) {
$json = json_decode($data, true);

if (\array_key_exists('counter', $json)) {
$entity->setCounter($json['counter']);
if (\is_array($json) && \array_key_exists('counter', $json) && is_numeric($json['counter'])) {
$entity->setCounter((int) $json['counter']);
}
}

Expand All @@ -53,6 +50,9 @@ public function saveDemoEntity(DemoEntity $entity): void
$data = file_get_contents($this->storage);
if ($data !== false) {
$vars = json_decode($data, true);
if (!\is_array($vars)) {
throw new \Exception('Failed reading demo content storage file at data/demo.json');
}
}
}

Expand Down
2 changes: 0 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,3 @@ parameters:
- vendor/
treatPhpDocTypesAsCertain: false
inferPrivatePropertyTypeFromConstructor: true
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false

0 comments on commit 9317755

Please sign in to comment.