Skip to content

Commit

Permalink
Maintenance release, drop old PHP versions (#11)
Browse files Browse the repository at this point in the history
* Update phpunit
Set minimum PHP version to 8.0

* Add PHPStan

* Add github workflow for tests
  • Loading branch information
reinder83 committed Jun 6, 2023
1 parent 6da385b commit 4699074
Show file tree
Hide file tree
Showing 17 changed files with 169 additions and 279 deletions.
4 changes: 0 additions & 4 deletions .coveralls.yml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: test
run-name: test
on:
workflow_dispatch:
push:
branches: master
pull_request:
branches: master
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions:
- 8.2
- 8.1
- 8.0

name: PHP ${{ matrix.php-versions }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json
coverage: none

- name: Install dependencies
run: composer install

- name: Run tests
run: vendor/bin/phpunit
- name: Run static analysis
run: vendor/bin/phpstan
9 changes: 2 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
# Created by .ignore support plugin (hsz.mobi)
/vendor/
/.idea/
/build/.*
/build/api/
/build/logs/
/build/pdepend/
/build/coverage/
/.phpunit.result.cache
/cache.properties
/vendor/
composer.lock
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

15 changes: 4 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
[![Build Status][build-icon]][build-link]
[![Coverage Status][coverage-icon]][coverage-link]

# BinaryFlags
With this class you can easily add flags to your projects.

The number of flags you can use is limited to the architecture of your system, e.g.: 32 flags on a 32-bit system or 64 flags on 64-bit system.
To store 64-bits flags in a database, you will need to store it as UNSIGNED BIGINT in MySQL or an equivalant in your datastorage.
To store 64-bits flags in a database, you will need to store it as UNSIGNED BIGINT in MySQL or an equivalent in your datastore.

This package also comes with a trait which you can use to implement binary flags directly in your own class.

Expand Down Expand Up @@ -33,7 +30,7 @@ This can be passed as second argument in the constructor.
##### getFlagNames([int $mask, [bool $asArray=false]])
Give the name(s) for the given `$mask` or the current mask when omitted.
When `$asArray` is `true` the method will return an array with the names,
otherwise an comma separated string will be returned (default).
otherwise a comma separated string will be returned (default).

##### addFlag(int $flag)
Adds one or multiple flags to the current mask.
Expand All @@ -43,7 +40,7 @@ Removes one or multiple flags from the current mask.

##### checkFlag(int $flag, [bool $checkAll=true]): bool
Check if given flag(s) are set in the current mask.
By default it will check all bits in the given flag.
By default, it will check all bits in the given flag.
When you want to match any of the given flags set `$checkAll` to `false`.

##### checkAnyFlag(int $mask): bool
Expand Down Expand Up @@ -139,7 +136,7 @@ var_export($exampleFlags->checkAnyFlag(ExampleFlags::FOO | ExampleFlags::BAZ));
```

##### Flag names example
_By default the flag names are based on the constant names_
_By default, the flag names are based on the constant names_
```php
$exampleFlags = new ExampleFlags();

Expand Down Expand Up @@ -239,9 +236,5 @@ Or you can support me by buying me a coffee:

[![Buy me a coffee][buymeacoffee-icon]][buymeacoffee-link]

[build-icon]: https://travis-ci.org/reinder83/binary-flags.svg?branch=master
[build-link]: https://travis-ci.org/reinder83/binary-flags
[coverage-icon]: https://coveralls.io/repos/github/reinder83/binary-flags/badge.svg?branch=master&v=1
[coverage-link]: https://coveralls.io/github/reinder83/binary-flags?branch=master
[buymeacoffee-icon]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg
[buymeacoffee-link]: https://www.buymeacoffee.com/reinder83
34 changes: 0 additions & 34 deletions build/phpcs.xml

This file was deleted.

40 changes: 0 additions & 40 deletions build/phpmd.xml

This file was deleted.

36 changes: 0 additions & 36 deletions build/phpunit.xml

This file was deleted.

19 changes: 7 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,25 +28,20 @@
},
"config": {
"platform": {
"php": "5.6"
"php": "8.0"
}
},
"require": {
"php": "^8.0",
"ext-json": "*"
},
"require-dev": {
"phpmd/phpmd": "^2.6",
"sebastian/phpcpd": "^3.0",
"squizlabs/php_codesniffer": "^3.4",
"phpunit/phpunit": "^5.7",
"phploc/phploc": "^4.0",
"pdepend/pdepend": "^2.5",
"mayflower/php-codebrowser": "^1.1",
"johnkary/phpunit-speedtrap": "^1.1"
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^1.10"
},
"autoload-dev": {
"psr-4": {
"Reinder83\\BinaryFlags\\Tests\\": "tests/"
}
},
"require": {
"ext-json": "*"
}
}
7 changes: 7 additions & 0 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
level: max
checkGenericClassInNonGenericObjectType: false
paths:
- src
ignoreErrors:
- message: '#Dead catch - ReflectionException is never thrown in the try block#'
13 changes: 13 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" backupGlobals="false" backupStaticAttributes="false" verbose="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<include>
<directory>./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="BinaryFlags Tests">
<directory suffix="Test.php">./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
Loading

0 comments on commit 4699074

Please sign in to comment.