Skip to content

Commit 871b634

Browse files
committed
Merge branch 'master' into 2.x
# Conflicts: # .travis.yml # Tests/RandomGenerator/NoRandomGeneratorTest.php # composer.json # phpunit.xml.dist
2 parents 32d6275 + 8d8a4c3 commit 871b634

File tree

6 files changed

+46
-56
lines changed

6 files changed

+46
-56
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
vendor/
22
composer.lock
33
/.php_cs.cache
4+
.phpunit
5+
.phpunit.result.cache
6+
/phpunit.xml

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
language: php
22

33
php:
4+
<<<<<<< HEAD
5+
=======
6+
- 7.3
7+
>>>>>>> master
48
- 7.4
9+
- 8.0
510
- nightly
611

712
env:
@@ -11,9 +16,17 @@ env:
1116
matrix:
1217
fast_finish: true
1318
include:
19+
<<<<<<< HEAD
1420
- php: 7.4
1521
env: CS_FIXER=run
1622
- php: 7.4
23+
=======
24+
- php: 8.0
25+
env: CS_FIXER=run
26+
- php: 7.3
27+
env: CS_FIXER=run
28+
- php: 7.3
29+
>>>>>>> master
1730
env: COMPOSER_FLAGS="--prefer-lowest"
1831
allow_failures:
1932
- php: nightly

README.md

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@ Simple library for generating random passwords.
1515
Requirements
1616
------------
1717

18-
* PHP >= 5.3.2
19-
(No longer testing <= PHP 5.6, and next version will drop support)
18+
* PHP >= 7.1
19+
20+
We only support PHP 7.3+
2021

2122
Installation
2223
------------
@@ -104,7 +105,6 @@ The segment separator will be remove from the possible characters.
104105
Human Password Generator Usage
105106
-------------------------------
106107

107-
108108
```php
109109
use Hackzilla\PasswordGenerator\Generator\HumanPasswordGenerator;
110110

@@ -157,14 +157,15 @@ $generator
157157
When setting the minimum and maximum values, be careful of unachievable settings.
158158

159159
For example the following will end up in an infinite loop.
160-
160+
```php
161161
$generator
162162
->setLength(4)
163163
->setOptionValue(RequirementPasswordGenerator::OPTION_UPPER_CASE, true)
164164
->setOptionValue(RequirementPasswordGenerator::OPTION_LOWER_CASE, false)
165165
->setMinimumCount(RequirementPasswordGenerator::OPTION_UPPER_CASE, 5)
166166
->setMaximumCount(RequirementPasswordGenerator::OPTION_LOWER_CASE, 1)
167167
;
168+
```
168169

169170
For the moment you can call ```$generator->validLimits()``` to test whether the counts will cause problems.
170171
If the method returns true, then you can proceed. If false, then generatePassword() will likely cause an infinite loop.
@@ -177,27 +178,7 @@ Example Implementations
177178
* Password Generator Bundle [https://github.com/hackzilla/password-generator-bundle]
178179

179180

180-
Caution
181+
Random Note
181182
-------
182183

183-
This library uses [mt_rand](http://www.php.net/manual/en/function.mt-rand.php) which is does not generate cryptographically secure values.
184-
Basically an attacker could predict the random passwords this library produces given the right conditions.
185-
186-
If you have a source of randomness you can inject it into the PasswordGenerator, using RandomGeneratorInterface.
187-
188-
PHP 7 has [random_int](http://www.php.net/random_int) function which they say is good to use for cryptographic random integers.
189-
190-
```php
191-
use Hackzilla\PasswordGenerator\Generator\HumanPasswordGenerator;
192-
use Hackzilla\PasswordGenerator\RandomGenerator\Php7RandomGenerator;
193-
194-
$generator = new HumanPasswordGenerator();
195-
196-
$generator
197-
->setRandomGenerator(new Php7RandomGenerator())
198-
->setWordList('/usr/share/dict/words')
199-
->setWordCount(3)
200-
->setWordSeparator('-');
201-
202-
$password = $generator->generatePasswords(10);
203-
```
184+
Since version 1.5.0, the library depends on the presence of [random_int](http://www.php.net/random_int) which is found in PHP 7.0+

Tests/RandomGenerator/NoRandomGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class NoRandomGeneratorTest extends \PHPUnit\Framework\TestCase
1010
{
1111
private $_object;
1212

13-
public function setup() : void
13+
public function setup(): void
1414
{
1515
$this->_object = new NoRandomGenerator();
1616
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"name": "Daniel Platt",
99
"email": "[email protected]",
10-
"homepage": "http://www.hackzilla.org"
10+
"homepage": "https://www.hackzilla.org"
1111
}
1212
],
1313
"require": {

phpunit.xml.dist

Lines changed: 21 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false" bootstrap="Tests/bootstrap.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
3+
<coverage>
4+
<include>
5+
<directory>./</directory>
6+
</include>
27

3-
<phpunit backupGlobals="false"
4-
backupStaticAttributes="false"
5-
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
9-
processIsolation="false"
10-
stopOnFailure="false"
11-
bootstrap="Tests/bootstrap.php"
12-
>
8+
<exclude>
9+
<directory>./Resources</directory>
10+
<directory>./Tests</directory>
11+
<directory>./vendor</directory>
12+
</exclude>
1313

14-
<testsuites>
15-
<testsuite name="Password Generator test suite">
16-
<directory suffix="Test.php">./Tests</directory>
17-
</testsuite>
18-
</testsuites>
14+
<report>
15+
<clover outputFile="build/logs/clover.xml"/>
16+
</report>
17+
</coverage>
1918

20-
<filter>
21-
<whitelist>
22-
<directory>./</directory>
23-
<exclude>
24-
<directory>./Resources</directory>
25-
<directory>./Tests</directory>
26-
<directory>./vendor</directory>
27-
</exclude>
28-
</whitelist>
29-
</filter>
30-
<logging>
31-
<log type="coverage-clover" target="build/logs/clover.xml"/>
32-
</logging>
19+
<testsuites>
20+
<testsuite name="Password Generator test suite">
21+
<directory suffix="Test.php">./Tests</directory>
22+
</testsuite>
23+
</testsuites>
24+
25+
<logging/>
3326
</phpunit>

0 commit comments

Comments
 (0)