Skip to content

Commit a24780a

Browse files
author
Robin Cawser
committed
Code quality fixes
1 parent 6e9c6c5 commit a24780a

5 files changed

Lines changed: 11 additions & 7 deletions

File tree

src/Vivait/StringGeneratorBundle/Generator/SecureBytesGenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ public function __construct(SecureRandom $secureRandom)
2424

2525
/**
2626
* @param integer $length
27-
* @return $this
27+
* @return ConfigurableGeneratorInterface
2828
*/
2929
public function setLength($length)
3030
{
3131
$this->length = $length;
32+
return $this;
3233
}
3334

3435
/**

src/Vivait/StringGeneratorBundle/Generator/SecureStringGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ class SecureStringGenerator implements ConfigurableGeneratorInterface
3535
*/
3636
public function __construct(Factory $factory)
3737
{
38-
3938
$this->factory = $factory;
4039
}
4140

@@ -83,12 +82,13 @@ public function getDefaultOptions(OptionsResolver $resolver)
8382

8483
/**
8584
* @param integer $length
86-
* @return $this
85+
* @return ConfigurableGeneratorInterface
8786
* @deprecated this will be deprecated in version 2.0 in favour of using callbacks on the generator. This is due to
8887
* some generators not actually needing a length - only random string type generators require it.
8988
*/
9089
public function setLength($length)
9190
{
92-
// TODO: Implement setLength() method.
91+
$this->length = $length;
92+
return $this;
9393
}
9494
}

src/Vivait/StringGeneratorBundle/Generator/StringGenerator.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,23 @@ public function setChars($chars)
3939
/**
4040
* Set the length of the generated string
4141
* @param $length
42-
* @return $this
42+
* @return ConfigurableGeneratorInterface
4343
*/
4444
public function setLength($length)
4545
{
4646
$this->length = $length;
47+
return $this;
4748
}
4849

4950
/**
5051
* @param $prefix
52+
* @return ConfigurableGeneratorInterface
5153
* @deprecated options should be used instead
5254
*/
5355
public function setPrefix($prefix)
5456
{
5557
$this->prefix = $prefix;
58+
return $this;
5659
}
5760

5861
/**

src/Vivait/StringGeneratorBundle/Model/ConfigurableGeneratorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function setOptions(array $options);
1414

1515
/**
1616
* @param OptionsResolver $resolver
17-
* @return mixed
17+
* @return void|OptionsResolver
1818
*/
1919
public function getDefaultOptions(OptionsResolver $resolver);
2020
}

src/Vivait/StringGeneratorBundle/Model/GeneratorInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface GeneratorInterface
66
{
77
/**
88
* @param integer $length
9-
* @return $this
9+
* @return GeneratorInterface
1010
* @deprecated this will be deprecated in version 2.0 in favour of using callbacks on the generator. This is due to
1111
* some generators not actually needing a length - only random string type generators require it.
1212
*/

0 commit comments

Comments
 (0)