Skip to content

Commit 380a07e

Browse files
committed
minor #941 Added missing return types (Coderberg)
This PR was merged into the master branch. Discussion ---------- Added missing return types Commits ------- 386f504 Added missing return types
2 parents a50e3e4 + 386f504 commit 380a07e

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

src/Command/AddUserCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function __construct(EntityManagerInterface $em, UserPasswordEncoderInter
7373
/**
7474
* {@inheritdoc}
7575
*/
76-
protected function configure()
76+
protected function configure(): void
7777
{
7878
$this
7979
->setDescription('Creates users and stores them in the database')
@@ -92,7 +92,7 @@ protected function configure()
9292
* This optional method is the first one executed for a command after configure()
9393
* and is useful to initialize properties based on the input arguments and options.
9494
*/
95-
protected function initialize(InputInterface $input, OutputInterface $output)
95+
protected function initialize(InputInterface $input, OutputInterface $output): void
9696
{
9797
// SymfonyStyle is an optional feature that Symfony provides so you can
9898
// apply a consistent look to the commands of your application.
@@ -167,7 +167,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
167167
* This method is executed after interact() and initialize(). It usually
168168
* contains the logic to execute to complete this command task.
169169
*/
170-
protected function execute(InputInterface $input, OutputInterface $output)
170+
protected function execute(InputInterface $input, OutputInterface $output): void
171171
{
172172
$stopwatch = new Stopwatch();
173173
$stopwatch->start('add-user-command');
@@ -203,7 +203,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
203203
}
204204
}
205205

206-
private function validateUserData($username, $plainPassword, $email, $fullName)
206+
private function validateUserData($username, $plainPassword, $email, $fullName): void
207207
{
208208
// first check if a user with the same username already exists.
209209
$existingUser = $this->users->findOneBy(['username' => $username]);

src/Command/DeleteUserCommand.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public function __construct(EntityManagerInterface $em, Validator $validator, Us
6161
/**
6262
* {@inheritdoc}
6363
*/
64-
protected function configure()
64+
protected function configure(): void
6565
{
6666
$this
6767
->setDescription('Deletes users from the database')
@@ -79,7 +79,7 @@ protected function configure()
7979
);
8080
}
8181

82-
protected function initialize(InputInterface $input, OutputInterface $output)
82+
protected function initialize(InputInterface $input, OutputInterface $output): void
8383
{
8484
// SymfonyStyle is an optional feature that Symfony provides so you can
8585
// apply a consistent look to the commands of your application.
@@ -108,7 +108,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
108108
$input->setArgument('username', $username);
109109
}
110110

111-
protected function execute(InputInterface $input, OutputInterface $output)
111+
protected function execute(InputInterface $input, OutputInterface $output): void
112112
{
113113
$username = $this->validator->validateUsername($input->getArgument('username'));
114114

src/Command/ListUsersCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function __construct(\Swift_Mailer $mailer, $emailSender, UserRepository
5555
/**
5656
* {@inheritdoc}
5757
*/
58-
protected function configure()
58+
protected function configure(): void
5959
{
6060
$this
6161
->setDescription('Lists all the existing users')

src/DataFixtures/AppFixtures.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ public function __construct(UserPasswordEncoderInterface $passwordEncoder)
2929
$this->passwordEncoder = $passwordEncoder;
3030
}
3131

32-
public function load(ObjectManager $manager)
32+
public function load(ObjectManager $manager): void
3333
{
3434
$this->loadUsers($manager);
3535
$this->loadTags($manager);
3636
$this->loadPosts($manager);
3737
}
3838

39-
private function loadUsers(ObjectManager $manager)
39+
private function loadUsers(ObjectManager $manager): void
4040
{
4141
foreach ($this->getUserData() as [$fullname, $username, $password, $email, $roles]) {
4242
$user = new User();
@@ -53,7 +53,7 @@ private function loadUsers(ObjectManager $manager)
5353
$manager->flush();
5454
}
5555

56-
private function loadTags(ObjectManager $manager)
56+
private function loadTags(ObjectManager $manager): void
5757
{
5858
foreach ($this->getTagData() as $index => $name) {
5959
$tag = new Tag();
@@ -66,7 +66,7 @@ private function loadTags(ObjectManager $manager)
6666
$manager->flush();
6767
}
6868

69-
private function loadPosts(ObjectManager $manager)
69+
private function loadPosts(ObjectManager $manager): void
7070
{
7171
foreach ($this->getPostData() as [$title, $slug, $summary, $content, $publishedAt, $author, $tags]) {
7272
$post = new Post();

src/Form/CommentType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class CommentType extends AbstractType
3232
/**
3333
* {@inheritdoc}
3434
*/
35-
public function buildForm(FormBuilderInterface $builder, array $options)
35+
public function buildForm(FormBuilderInterface $builder, array $options): void
3636
{
3737
// By default, form fields include the 'required' attribute, which enables
3838
// the client-side form validation. This means that you can't test the
@@ -50,7 +50,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
5050
/**
5151
* {@inheritdoc}
5252
*/
53-
public function configureOptions(OptionsResolver $resolver)
53+
public function configureOptions(OptionsResolver $resolver): void
5454
{
5555
$resolver->setDefaults([
5656
'data_class' => Comment::class,

src/Form/PostType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class PostType extends AbstractType
3131
/**
3232
* {@inheritdoc}
3333
*/
34-
public function buildForm(FormBuilderInterface $builder, array $options)
34+
public function buildForm(FormBuilderInterface $builder, array $options): void
3535
{
3636
// For the full reference of options defined by each form field type
3737
// see https://symfony.com/doc/current/reference/forms/types.html
@@ -70,7 +70,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
7070
/**
7171
* {@inheritdoc}
7272
*/
73-
public function configureOptions(OptionsResolver $resolver)
73+
public function configureOptions(OptionsResolver $resolver): void
7474
{
7575
$resolver->setDefaults([
7676
'data_class' => Post::class,

src/Form/Type/DateTimePickerType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function __construct(MomentFormatConverter $converter)
3838
/**
3939
* {@inheritdoc}
4040
*/
41-
public function buildView(FormView $view, FormInterface $form, array $options)
41+
public function buildView(FormView $view, FormInterface $form, array $options): void
4242
{
4343
$view->vars['attr']['data-date-format'] = $this->formatConverter->convert($options['format']);
4444
$view->vars['attr']['data-date-locale'] = mb_strtolower(str_replace('_', '-', \Locale::getDefault()));
@@ -47,7 +47,7 @@ public function buildView(FormView $view, FormInterface $form, array $options)
4747
/**
4848
* {@inheritdoc}
4949
*/
50-
public function configureOptions(OptionsResolver $resolver)
50+
public function configureOptions(OptionsResolver $resolver): void
5151
{
5252
$resolver->setDefaults([
5353
'widget' => 'single_text',

src/Form/Type/TagsInputType.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function __construct(TagRepository $tags)
4040
/**
4141
* {@inheritdoc}
4242
*/
43-
public function buildForm(FormBuilderInterface $builder, array $options)
43+
public function buildForm(FormBuilderInterface $builder, array $options): void
4444
{
4545
$builder
4646
// The Tag collection must be transformed into a comma separated string.
@@ -55,7 +55,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
5555
/**
5656
* {@inheritdoc}
5757
*/
58-
public function buildView(FormView $view, FormInterface $form, array $options)
58+
public function buildView(FormView $view, FormInterface $form, array $options): void
5959
{
6060
$view->vars['tags'] = $this->tags->findAll();
6161
}

0 commit comments

Comments
 (0)