-
-
Notifications
You must be signed in to change notification settings - Fork 138
Move to PHP 8.1 minimum version, add typing #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
aeb4b00
first batch
NicolasCARPi a8c297c
second batch with QR providers
NicolasCARPi ac721e5
add php-cs-fixer
NicolasCARPi 4be8355
remove php-parallel-lint: php-cs-fixer does much more
NicolasCARPi db0515e
fix versions in github workflow and add a lint-ci command
NicolasCARPi f1e73aa
fix the testsDependency folder
NicolasCARPi 79988ef
add phpstan
NicolasCARPi 225216a
fix php version in readme
NicolasCARPi 887f261
add CHANGELOG.md
NicolasCARPi 58a9628
add phpstan config file, ignore broken files because of optional lib
NicolasCARPi 7e06716
use relative path for LICENSE link in README
NicolasCARPi 75d8955
update the actions
NicolasCARPi aaf24a6
why is phpstan failing in actions?
NicolasCARPi 25f463d
turns out I had a global gitignore with `lib`... -_-'
NicolasCARPi 1e75674
fix action php version and handleColour function signature for bacon qr
NicolasCARPi 041d0e3
fix bacon construct signature
NicolasCARPi db6256b
fix endroid handleColor
NicolasCARPi f8ba3b2
fix endroid qr provider handleErrorCorrectionLevel signature
NicolasCARPi f034bc7
use interface
NicolasCARPi ad89250
try adding php8.2 in test matrix
NicolasCARPi b52655b
add ignore env to php-cs-fixer for ci (php 8.2 issue)
NicolasCARPi e049285
use lint-ci for bacon test
NicolasCARPi 4711674
crank phpstan to level 6
NicolasCARPi 921425d
use psr12 in phpcs config
NicolasCARPi 656e966
remove useless function comment
NicolasCARPi dc4e99e
use @PHP82Migration ruleset
NicolasCARPi 86338cf
split constructor in multilines
NicolasCARPi a968dd3
remove the MightNotMakeAssertions shim
NicolasCARPi e6e5d59
lint
NicolasCARPi afb5cb0
add Nicolas CARPi to authors in composer.json
NicolasCARPi 023bfc1
add Will Power in authors list in composer.json
NicolasCARPi ab76ac7
use phpunit 9 instead of `@stable`
NicolasCARPi 30248a8
address remarks made by MasterOdin
NicolasCARPi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -190,3 +190,4 @@ composer.lock | |
.vs/ | ||
|
||
.phpunit.result.cache | ||
.php-cs-fixer.cache |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* PHP-CS-Fixer config for RobThree/TwoFactorAuth | ||
*/ | ||
$finder = PhpCsFixer\Finder::create() | ||
->name('/\.php|\.php.dist$/') | ||
->exclude('build') | ||
->exclude('demo') | ||
->exclude('docs') | ||
->in(['lib', 'tests', 'testsDependency']) | ||
; | ||
|
||
$config = new PhpCsFixer\Config(); | ||
|
||
return $config->setRules(array( | ||
'@PSR2' => true, | ||
'@PSR12' => true, | ||
'@PHP82Migration' => true, | ||
'array_syntax' => ['syntax' => 'long'], | ||
'class_attributes_separation' => true, | ||
'declare_strict_types' => true, | ||
'dir_constant' => true, | ||
'is_null' => true, | ||
'no_homoglyph_names' => true, | ||
'no_null_property_initialization' => true, | ||
'no_php4_constructor' => true, | ||
'no_unused_imports' => true, | ||
'no_useless_else' => true, | ||
'non_printable_character' => true, | ||
'ordered_imports' => true, | ||
'ordered_class_elements' => true, | ||
'php_unit_construct' => true, | ||
'pow_to_exponentiation' => true, | ||
'psr_autoloading' => true, | ||
'random_api_migration' => true, | ||
'return_assignment' => true, | ||
'self_accessor' => true, | ||
'semicolon_after_instruction' => true, | ||
'short_scalar_cast' => true, | ||
'simplified_null_return' => true, | ||
'single_blank_line_before_namespace' => true, | ||
'single_class_element_per_statement' => true, | ||
'single_line_comment_style' => true, | ||
'single_quote' => true, | ||
'space_after_semicolon' => true, | ||
'standardize_not_equals' => true, | ||
'strict_param' => true, | ||
'ternary_operator_spaces' => true, | ||
'trailing_comma_in_multiline' => true, | ||
'trim_array_spaces' => true, | ||
'unary_operator_spaces' => true, | ||
'global_namespace_import' => [ | ||
'import_classes' => true, | ||
'import_functions' => true, | ||
'import_constants' => true, | ||
], | ||
)) | ||
->setFinder($finder) | ||
->setRiskyAllowed(true) | ||
; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# RobThree\TwoFactorAuth changelog | ||
|
||
# Version 2.x | ||
|
||
## Breaking changes | ||
|
||
### PHP Version | ||
|
||
Version 2.x requires at least PHP 8.1. | ||
|
||
### Constructor signature | ||
|
||
With version 2.x, the `algorithm` parameter of `RobThree\Auth\TwoFactorAuth` constructor is now an `enum`. | ||
|
||
On version 1.x: | ||
|
||
~~~php | ||
use RobThree\Auth\TwoFactorAuth; | ||
|
||
$lib = new TwoFactorAuth('issuer-name', 6, 30, 'sha1'); | ||
~~~ | ||
|
||
On version 2.x, simple change the algorithm from a `string` to the correct `enum`: | ||
|
||
~~~php | ||
use RobThree\Auth\TwoFactorAuth; | ||
use RobThree\Auth\Algorithm; | ||
|
||
$lib = new TwoFactorAuth('issuer-name', 6, 30, Algorithm::Sha1); | ||
~~~ | ||
|
||
See the [Algorithm.php](./lib/Algorithm.php) file to see available algorithms. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace RobThree\Auth; | ||
|
||
/** | ||
* List of supported cryptographic algorithms | ||
*/ | ||
enum Algorithm: string | ||
{ | ||
case Md5 = 'md5'; | ||
case Sha1 = 'sha1'; | ||
case Sha256 = 'sha256'; | ||
case Sha512 = 'sha512'; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.