Skip to content

Commit

Permalink
Merge branch 'feature/modernise' of https://github.com/Chris53897/php…
Browse files Browse the repository at this point in the history
  • Loading branch information
landy2005 committed Nov 2, 2023
2 parents 58e5ccd + 30ce239 commit 61fcdaa
Show file tree
Hide file tree
Showing 30 changed files with 248 additions and 214 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# .github/workflows/code_checks.yaml
name: Code_Checks

on: ["push", "pull_request"]

jobs:
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php: ['7.4']
stability: [ prefer-stable ]
experimental: [false]
include:
- php: '7.4'
stability: prefer-lowest
- php: '8.0'
- php: '8.1'
- php: '8.2'

name: PHP ${{ matrix.php }} - ${{ matrix.stability }} tests
steps:
# basically git clone
- uses: actions/checkout@v3

- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.composer/cache/files
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

# use PHP of specific version
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: pcov
coverage: pcov

- name: Install dependencies
run: |
composer install --verbose --prefer-dist --no-interaction -o
- name: Execute tests
run: vendor/bin/phpunit -c ./tests/phpunit.xml.dist ./tests --verbose

cs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none # disable xdebug, pcov
- run: composer install --no-progress
- run: ./vendor/bin/phpcs --encoding=utf-8 --extensions=php --standard=./tests/phpcs.xml -nsp ./

3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ Desktop.ini

# Vagrant files
/.vagrant/

.phpunit.result.cache
tests/clover.xml
35 changes: 0 additions & 35 deletions .travis.yml

This file was deleted.

7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
## v2.2.0 (April XXth, 2019)
## v2.2.1 (xxx)
- Drop support of php < 7.4

## v2.2.0 (Feb 17th, 2021)
- Added support for php 8.0
- Added option power factor for Si factor, ie for square (2) and cubic (3)
- Added new Physical Quantity volume flow with commonly used units
- Added lowercase aliases for temperature units
Expand All @@ -14,7 +18,6 @@
- Additional unit for power: dBm
- Fixed native unit for mass as gram


## v2.1.0 (July 24th, 2016)
- Added getUnitDefinitions() method to PhysicalQuantity classes, to get a raw list of UnitofMeasure objects defined on that quantity
- Added UPPERCASE templating support for autogenerated metric units to support names like MEGA_METERS, for example.
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,17 @@ isTooTallToRideThisTrain( new Length(2, 'm') );
```

## Installation
This library is best included in your projects via Composer. See the [Composer website](http://getcomposer.org/) for more details, and see the [Packagist.org site for this library](https://packagist.org/packages/php-units-of-measure/php-units-of-measure).
This library is best included in your projects via Composer. See the [Composer website](https://getcomposer.org/) for more details, and see the [Packagist.org site for this library](https://packagist.org/packages/php-units-of-measure/php-units-of-measure).

If you'd prefer to manually include this library as a dependency in your project, then it is recommended that you use a [PSR-4](http://www.php-fig.org/psr/psr-4/) compliant PHP autoloader. The mapping between this project's root namespace and its base directory is:
If you'd prefer to manually include this library as a dependency in your project, then it is recommended that you use a [PSR-4](https://www.php-fig.org/psr/psr-4/) compliant PHP autoloader. The mapping between this project's root namespace and its base directory is:
- vendor namespace 'PhpUnitsOfMeasure\' maps to the library's base directory 'source/'

See the documentation of your autoloader for further instructions.

### Project Tags and Versions
This project follows the guidelines set out in [Semantic Versioning 2.0.0](http://semver.org/spec/v2.0.0.html). In general, versions are of the form 'X.Y.Z', and increments to X denote backward-incompatible major changes.
This project follows the guidelines set out in [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html). In general, versions are of the form 'X.Y.Z', and increments to X denote backward-incompatible major changes.

It is recommended that if your project includes this project as a dependency and you are using an automated dependency management tool such as [Composer](http://getcomposer.org/), then you should 'pin' the major version (X) and allow only variations in 'Y' (minor changes) and 'Z' (bugfixes). See the documentation of your dependency manager for more details.
It is recommended that if your project includes this project as a dependency and you are using an automated dependency management tool such as [Composer](https://getcomposer.org/), then you should 'pin' the major version (X) and allow only variations in 'Y' (minor changes) and 'Z' (bugfixes). See the documentation of your dependency manager for more details.


## Use
Expand Down Expand Up @@ -239,7 +239,7 @@ class Length extends AbstractPhysicalQuantity
Now any program which uses `Length` will start with the cubits unit already built in. Note that here we used the more concise linear unit factory method, but the result is equivalent to the expanded form calling the `UnitOfMeasure` constructor, as used above. Also, notice that the `static` keyword was used instead of the class name, though either would be acceptable in this case.

### Adding New Physical Quantities
[Physical quantities](http://en.wikipedia.org/wiki/Physical_quantity) are categories of measurable values, like mass, length, force, etc.
[Physical quantities](https://en.wikipedia.org/wiki/Physical_quantity) are categories of measurable values, like mass, length, force, etc.

For physical quantities that are not already present in this library, it will be necessary to write a class to support a new one. All physical quantities implement the `\PhpUnitsOfMeasure\PhysicalQuantityInterface` interface, typically extend the `\PhpUnitsOfMeasure\AbstractPhysicalQuantity` class, and typically have only an `initialize()` method which creates the quantity's units of measure. See above for typical examples of physical quantity classes and of how to add new units to a quantity class.

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
},

"require": {
"php": ">=5.6.0"
"php": ">=7.4"
},

"require-dev": {
"phpunit/phpunit": "6.*",
"squizlabs/php_codesniffer": "3.5.*"
"phpunit/phpunit": "^9.5",
"squizlabs/php_codesniffer": "^3.7"
},

"replace": {
Expand Down
Loading

0 comments on commit 61fcdaa

Please sign in to comment.