Skip to content

Commit 3739381

Browse files
committed
Require PHP 8.1+
1 parent 729fed1 commit 3739381

14 files changed

Lines changed: 226 additions & 183 deletions

File tree

.cs.php

Lines changed: 64 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,68 @@
11
<?php
22

3-
return PhpCsFixer\Config::create()
3+
use PhpCsFixer\Config;
4+
5+
return (new Config())
46
->setUsingCache(false)
57
->setRiskyAllowed(true)
6-
//->setCacheFile(__DIR__ . '/.php_cs.cache')
7-
->setRules([
8-
'@PSR1' => true,
9-
'@PSR2' => true,
10-
'@Symfony' => true,
11-
'psr4' => true,
12-
// custom rules
13-
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'], // psr-5
14-
'phpdoc_to_comment' => false,
15-
'array_indentation' => true,
16-
'array_syntax' => ['syntax' => 'short'],
17-
'cast_spaces' => ['space' => 'none'],
18-
'concat_space' => ['spacing' => 'one'],
19-
'compact_nullable_typehint' => true,
20-
'declare_equal_normalize' => ['space' => 'single'],
21-
'increment_style' => ['style' => 'post'],
22-
'list_syntax' => ['syntax' => 'long'],
23-
'no_short_echo_tag' => true,
24-
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
25-
'phpdoc_align' => false,
26-
'phpdoc_no_empty_return' => false,
27-
'phpdoc_order' => true, // psr-5
28-
'phpdoc_no_useless_inheritdoc' => false,
29-
'protected_to_private' => false,
30-
'yoda_style' => false,
31-
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
32-
'ordered_imports' => [
33-
'sort_algorithm' => 'alpha',
34-
'imports_order' => ['class', 'const', 'function']
35-
],
36-
])
37-
->setFinder(PhpCsFixer\Finder::create()
38-
->in(__DIR__ . '/src')
39-
->in(__DIR__ . '/tests')
40-
->name('*.php')
41-
->ignoreDotFiles(true)
42-
->ignoreVCS(true));
8+
->setRules(
9+
[
10+
'@PSR1' => true,
11+
'@PSR2' => true,
12+
'@Symfony' => true,
13+
'psr_autoloading' => true,
14+
// custom rules
15+
'align_multiline_comment' => ['comment_type' => 'phpdocs_only'], // psr-5
16+
'phpdoc_to_comment' => false,
17+
'no_superfluous_phpdoc_tags' => false,
18+
'array_indentation' => true,
19+
'array_syntax' => ['syntax' => 'short'],
20+
'cast_spaces' => ['space' => 'none'],
21+
'concat_space' => ['spacing' => 'one'],
22+
'compact_nullable_typehint' => true,
23+
'declare_equal_normalize' => ['space' => 'single'],
24+
'general_phpdoc_annotation_remove' => [
25+
'annotations' => [
26+
'author',
27+
'package',
28+
],
29+
],
30+
'increment_style' => ['style' => 'post'],
31+
'list_syntax' => ['syntax' => 'short'],
32+
'echo_tag_syntax' => ['format' => 'long'],
33+
'phpdoc_add_missing_param_annotation' => ['only_untyped' => false],
34+
'phpdoc_align' => false,
35+
'phpdoc_no_empty_return' => false,
36+
'phpdoc_order' => true, // psr-5
37+
'phpdoc_no_useless_inheritdoc' => false,
38+
'protected_to_private' => false,
39+
'yoda_style' => false,
40+
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
41+
'ordered_imports' => [
42+
'sort_algorithm' => 'alpha',
43+
'imports_order' => ['class', 'const', 'function'],
44+
],
45+
'single_line_throw' => false,
46+
'declare_strict_types' => false,
47+
'blank_line_between_import_groups' => true,
48+
'fully_qualified_strict_types' => true,
49+
'no_null_property_initialization' => false,
50+
'operator_linebreak' => [
51+
'only_booleans' => true,
52+
'position' => 'beginning',
53+
],
54+
'global_namespace_import' => [
55+
'import_classes' => true,
56+
'import_constants' => null,
57+
'import_functions' => null
58+
]
59+
]
60+
)
61+
->setFinder(
62+
PhpCsFixer\Finder::create()
63+
->in(__DIR__ . '/src')
64+
->in(__DIR__ . '/tests')
65+
->name('*.php')
66+
->ignoreDotFiles(true)
67+
->ignoreVCS(true)
68+
);

.editorconfig

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
end_of_line = lf
7+
8+
[composer.json]
9+
indent_size = 4
10+
11+
[*.js]
12+
indent_size = 4
13+
14+
[*.neon]
15+
indent_size = 4
16+
indent_style = tab
17+
18+
[*.xml]
19+
indent_size = 4
20+
21+
[*.yml]
22+
indent_size = 4

.gitattributes

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
1-
# Path-based git attributes
2-
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
3-
4-
public/* linguist-vendored
5-
docs/* linguist-documentation
6-
71
# Set the default behavior, in case people don't have core.autocrlf set.
82
# Git will always convert line endings to LF on checkout. You should use
93
# this for files that must keep LF endings, even on Windows.
104
* text eol=lf
115

6+
# ------------------------------------------------------------------------------
7+
# All the files and directories that can be excluded from dist,
8+
# we could have a more clean vendor/
9+
#
10+
# So when someone will install that package through with --prefer-dist option,
11+
# all the files and directories listed in .gitattributes file will be excluded.
12+
# This could have a big impact on big deployments and/or testing.
13+
# ------------------------------------------------------------------------------
14+
15+
/tests export-ignore
16+
/build export-ignore
17+
/docs export-ignore
18+
/build.xml export-ignore
19+
/phpunit.xml export-ignore
20+
/.gitattributes export-ignore
21+
/.gitignore export-ignore
22+
/.travis.* export-ignore
23+
/.scrutinizer.* export-ignore
24+
/.editorconfig export-ignore
25+
/.coveralls.* export-ignore
26+
1227
# Define binary file attributes.
1328
# - Do not treat them as text.
1429
# - Include binary diff in patches instead of "binary files differ."
30+
*.pdf binary
31+
*.mo binary
1532
*.gif binary
1633
*.ico binary
1734
*.jpg binary
35+
*.jpeg binary
1836
*.png binary
19-
*.phar binary
2037
*.zip binary
21-
*.gz binary
22-
*.otf binary
23-
*.eot binary
24-
*.svg binary
25-
*.ttf binary
26-
*.woff binary
27-
*.woff2 binary
28-
29-
# Ignore all test and documentation with "export-ignore".
30-
/.gitattributes export-ignore
31-
/.gitignore export-ignore
32-
/.travis.yml export-ignore
33-
/phpunit.xml.dist export-ignore
34-
/.scrutinizer.yml export-ignore
35-
/tests export-ignore
36-
/docs export-ignore

.github/workflows/build.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: build
2+
3+
on: [ push, pull_request ]
4+
5+
jobs:
6+
run:
7+
runs-on: ${{ matrix.operating-system }}
8+
strategy:
9+
matrix:
10+
operating-system: [ ubuntu-latest ]
11+
php-versions: [ '8.1', '8.2' ]
12+
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v1
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@v2
20+
with:
21+
php-version: ${{ matrix.php-versions }}
22+
extensions: mbstring, intl, zip
23+
coverage: none
24+
25+
- name: Check PHP Version
26+
run: php -v
27+
28+
- name: Check Composer Version
29+
run: composer -V
30+
31+
- name: Check PHP Extensions
32+
run: php -m
33+
34+
- name: Validate composer.json and composer.lock
35+
run: composer validate
36+
37+
- name: Install dependencies
38+
run: composer install --prefer-dist --no-progress --no-suggest
39+
40+
- name: Run test suite
41+
run: composer test:all

.github/workflows/php.yml

Lines changed: 0 additions & 41 deletions
This file was deleted.

.gitignore

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
1-
build/
2-
nbproject/
31
.idea/
4-
composer.phar
52
composer.lock
6-
.DS_STORE
7-
cache.properties
8-
.php_cs.cache
3+
nbproject/
94
vendor/
10-
tmp/
5+
build/
6+
.phpunit.cache/
7+
.phpunit.result.cache

.scrutinizer.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
filter:
2-
paths: ["src/*"]
3-
excluded_paths: ["vendor/*", "tests/*"]
2+
paths: [ "src/*" ]
3+
excluded_paths: [ "vendor/*", "tests/*" ]
44

55
checks:
66
php:
@@ -12,7 +12,10 @@ tools:
1212

1313
build:
1414
environment:
15-
php: 7.2
15+
php:
16+
version: 8.1.2
17+
ini:
18+
xdebug.mode: coverage
1619
mysql: false
1720
node: false
1821
postgresql: false
@@ -30,11 +33,9 @@ build:
3033
dependencies:
3134
before:
3235
- composer self-update
33-
- composer update --no-interaction --prefer-dist --no-progress
3436
tests:
3537
before:
36-
-
37-
command: vendor/bin/phpunit --coverage-clover build/logs/clover.xml
38+
- command: composer test:coverage
3839
coverage:
3940
file: 'build/logs/clover.xml'
4041
format: 'clover'

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# The MIT License (MIT)
22

3-
Copyright (c) 2020 odan
3+
Copyright (c) 2023 odan
44

55
> Permission is hereby granted, free of charge, to any person obtaining a copy
66
> of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Latest Version on Packagist](https://img.shields.io/github/release/selective-php/base32.svg)](https://packagist.org/packages/selective/base32)
44
[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE.md)
5-
[![Build Status](https://github.com/selective-php/base32/workflows/PHP/badge.svg)](https://github.com/selective-php/base32/actions)
5+
[![Build Status](https://github.com/selective-php/base32/workflows/build/badge.svg)](https://github.com/selective-php/base32/actions)
66
[![Coverage Status](https://scrutinizer-ci.com/g/selective-php/base32/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/selective-php/base32/code-structure)
77
[![Quality Score](https://scrutinizer-ci.com/g/selective-php/base32/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/selective-php/base32/?branch=master)
88
[![Total Downloads](https://img.shields.io/packagist/dt/selective/base32.svg)](https://packagist.org/packages/selective/base32/stats)
@@ -19,7 +19,7 @@ $ composer require selective/base32
1919

2020
## Requirements
2121

22-
* PHP 7.1.3+
22+
* PHP 8.1+
2323

2424
## Usage
2525

@@ -30,12 +30,15 @@ use Selective\Base32\Base32;
3030

3131
$str = 'abc 1234';
3232

33-
// Encode
3433
$base32 = new Base32();
35-
$encoded = $base32->encode($str); // MFRGGIBRGIZTI====
34+
35+
// Encode
36+
// MFRGGIBRGIZTI====
37+
$encoded = $base32->encode($str);
3638

3739
// Decode
38-
echo $base32->decode($encoded); // abc 1234
40+
// abc 1234
41+
echo $base32->decode($encoded);
3942
```
4043

4144
### Without padding and only lowercase
@@ -47,7 +50,9 @@ $str = 'abc 1234';
4750

4851
// Encode
4952
$encoded = $base32->encode($str, false);
50-
$encoded = strtolower($enc); // mfrggibrgizti
53+
54+
// mfrggibrgizti
55+
$encoded = strtolower($enc);
5156

5257
// Decode
5358
echo $base32->decode($encoded);

0 commit comments

Comments
 (0)