Skip to content

Commit

Permalink
Check php 7.4 compatibility (#1)
Browse files Browse the repository at this point in the history
* Added phpunit tests, removed old build process
* Set up with shivammathur/setup-php, configured phan
* Run php-cs-fixer @PHP70Migration, @PHP71Migration, @PHP73Migration
* Removed composer.lock from repo
* Added PHP 7.3, 7.4, 8.0 into a build matrix
  • Loading branch information
olexiyk authored Aug 31, 2021
1 parent 2280aed commit adf60cf
Show file tree
Hide file tree
Showing 20 changed files with 2,744 additions and 834 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: ci

on: [ push, pull_request ]

jobs:
build-test:
name: Test on PHP ${{ matrix.php-versions }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions: [ '7.3', '7.4', '8.0' ]

steps:
- uses: actions/checkout@v2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: ast
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install Composer dependencies
run: composer install --no-progress --prefer-dist --optimize-autoloader

- name: Test with phpunit
run: vendor/bin/phpunit

- name: Test with phan
run: vendor/bin/phan
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
bin/build/
vendor
composer.lock
76 changes: 76 additions & 0 deletions .phan/config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?php

/**
* This configuration will be read and overlaid on top of the
* default configuration. Command line arguments will be applied
* after this file is read.
*/
return [

// Supported values: `'5.6'`, `'7.0'`, `'7.1'`, `'7.2'`, `'7.3'`, `'7.4'`,
// `'8.0'`, `'8.1'`, `null`.
// If this is set to `null`,
// then Phan assumes the PHP version which is closest to the minor version
// of the php executable used to execute Phan.
'target_php_version' => '7.4',

'minimum_target_php_version' => '7.3',

'backward_compatibility_checks' => true,

// A list of directories that should be parsed for class and
// method information. After excluding the directories
// defined in exclude_analysis_directory_list, the remaining
// files will be statically analyzed for errors.
//
// Thus, both first-party and third-party code being used by
// your application should be included in this list.
'directory_list' => [
'src',
'tests',
'vendor/phpunit/phpunit/src',
],

// A directory list that defines files that will be excluded
// from static analysis, but whose class and method
// information should be included.
//
// Generally, you'll want to include the directories for
// third-party code (such as "vendor/") in this list.
//
// n.b.: If you'd like to parse but not analyze 3rd
// party code, directories containing that code
// should be added to the `directory_list` as
// to `exclude_analysis_directory_list`.
"exclude_analysis_directory_list" => [
'vendor/',
],

// A list of plugin files to execute.
// Plugins which are bundled with Phan can be added here by providing their name
// (e.g. 'AlwaysReturnPlugin')
//
// Documentation about available bundled plugins can be found
// at https://github.com/phan/phan/tree/v5/.phan/plugins
//
// Alternately, you can pass in the full path to a PHP file
// with the plugin's implementation.
// (e.g. 'vendor/phan/phan/.phan/plugins/AlwaysReturnPlugin.php')
'plugins' => [
// checks if a function, closure or method unconditionally returns.
// can also be written as 'vendor/phan/phan/.phan/plugins/AlwaysReturnPlugin.php'
'AlwaysReturnPlugin',
'DollarDollarPlugin',
'DuplicateArrayKeyPlugin',
'DuplicateExpressionPlugin',
'PregRegexCheckerPlugin',
'PrintfCheckerPlugin',
'SleepCheckerPlugin',
// Checks for syntactically unreachable statements in
// the global scope or function bodies.
'UnreachableCodePlugin',
'UseReturnValuePlugin',
'EmptyStatementListPlugin',
'LoopVariableReusePlugin',
],
];
8 changes: 0 additions & 8 deletions Makefile

This file was deleted.

67 changes: 2 additions & 65 deletions README.mdown
Original file line number Diff line number Diff line change
Expand Up @@ -13,67 +13,10 @@ reference for the format can be found here:

# Installation

**Method 1:** Install using Packagist.

1. Follow the instructions at http://packagist.org
2. In your new project, create a `composer.json` file which requires
LibRIS:

```javascript
{
"require": {
"technosophos/LibRIS": ">=1.0.0"
}
}
```bash
composer require researchgate/libris
```

When you next run `php composer.phar install` it will automatically
fetch and install LibRIS.

Note that as of LibRIS 2.0.0, the Composer autoloader can load
LibRIS:

```php
<?php
require 'vendor/.composer/autoload.php';

use \LibRIS\RISReader;

$reader = new RISReader();

//...
?>
```

**Method 2:** Install LibRIS using Pear

Use your `pear` client to install LibRIS:

pear channel-discover pear.querypath.org
pear install querypath/LibRIS

For more, see [pear.querypath.org](http://pear.querypath.org).

Use it in your scripts like this:

<?php
require 'LibRIS.php';
?>

If you have already installed LibRIS using Pear, you can upgrade your library to the latest stable release by doing `pear upgrade LibRIS`.

**Method 3:** Download LibRIS

1. Get LibRIS from [the downloads page](http://github.com/technosophos/LibRIS/downloads)
2. Uncompress the files (`tar -zxvf LibRIS-1.0.0.tgz`)
3. Put the files where you want them to go.

Use it in your scripts like this:

<?php
require 'path/to/LibRIS.php';
?>

# Using LibRIS

General usage for this class is simple:
Expand Down Expand Up @@ -122,12 +65,6 @@ If you found a bug, *please* let me know. The best way is to file a report at

You can also find me on Freenode's IRC in #querypath.

## The Phing Script

This file includes a Phing `build.xml` script. However, it is rarely used.

If you are interested in using this as part of a build toolchain, see [phing.info](http://phing.info)

## Why is there a README file and a README.mdown file?

* README is a required file for the Pear packaging system.
Expand Down
Loading

0 comments on commit adf60cf

Please sign in to comment.