Skip to content

Commit

Permalink
refactor: Use friendsofphp/php-cs-fixer instead of squizlabs/php_code…
Browse files Browse the repository at this point in the history
…sniffer (#22)
  • Loading branch information
roadiz-ci committed Nov 6, 2024
1 parent b8da94b commit f55afa2
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 32 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,5 @@ jobs:
${{ runner.os }}-php-${{ matrix.php-version }}-
- name: Install Dependencies
run: composer install --no-scripts --no-ansi --no-interaction --no-progress
- name: Run PHP Code Sniffer
run: vendor/bin/phpcs --extensions=php --warning-severity=0 --standard=PSR12 -p ./src
- name: Run PHPStan
run: vendor/bin/phpstan analyse --no-progress -c phpstan.neon
3 changes: 0 additions & 3 deletions Makefile

This file was deleted.

3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
"ext-openssl": "*"
},
"require-dev": {
"phpstan/phpstan": "^1.5.3",
"squizlabs/php_codesniffer": "^3.5"
"phpstan/phpstan": "^1.5.3"
},
"autoload": {
"psr-4": {
Expand Down
14 changes: 0 additions & 14 deletions phpcs.xml.dist

This file was deleted.

3 changes: 1 addition & 2 deletions src/PasswordGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ class PasswordGenerator extends RandomGenerator implements PasswordGeneratorInte
* The available characters in each set are user friendly - there are no ambiguous
* characters such as i, l, 1, o, 0, etc.
*
* @param int $length
* @return string
*
* @see https://gist.github.com/tylerhall/521810
Expand All @@ -35,7 +34,7 @@ public function generatePassword(int $length = 12)
}

$all = \mb_str_split($all);
for ($i = 0; $i < $length - count($sets); $i++) {
for ($i = 0; $i < $length - count($sets); ++$i) {
$password .= $all[array_rand($all)];
}

Expand Down
1 change: 0 additions & 1 deletion src/PasswordGeneratorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
interface PasswordGeneratorInterface
{
/**
* @param int $length
* @return string
*/
public function generatePassword(int $length = 12);
Expand Down
9 changes: 1 addition & 8 deletions src/RandomGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ class RandomGenerator
protected ?LoggerInterface $logger;
protected bool $useOpenSsl;

/**
* @param LoggerInterface|null $logger
*/
public function __construct(LoggerInterface $logger = null)
public function __construct(?LoggerInterface $logger = null)
{
$this->logger = $logger;
// determine whether to use OpenSSL
Expand All @@ -30,10 +27,6 @@ public function __construct(LoggerInterface $logger = null)
}
}

/**
* @param int $nbBytes
* @return string
*/
public function getRandomNumber(int $nbBytes = 32): string
{
// try OpenSSL
Expand Down

0 comments on commit f55afa2

Please sign in to comment.