Skip to content

Commit

Permalink
Fixes after the fork to set compatibility with PHP8.1 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ecourtial authored Mar 9, 2022
1 parent a38b6f5 commit be5b775
Show file tree
Hide file tree
Showing 12 changed files with 597 additions and 42 deletions.
183 changes: 183 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
version: '2.1'
executors:
php7-4:
docker:
- image: php:7.4-alpine
working_directory: ~/repo
php8-0:
docker:
- image: php:8.0-alpine
working_directory: ~/repo
php8-1:
docker:
- image: php:8.1-alpine
working_directory: ~/repo

jobs:
composer7-4:
executor: php7-4
steps:
- run:
name: Install alpine requirements for composer
command: apk add git openssh-client curl patch sqlite php-sqlite3
- checkout
- run:
name: composer
command: |
if [[ ! -f vendor/autoload.php ]]; then
curl https://getcomposer.org/composer-stable.phar --location --silent --output /usr/bin/composer; \
chmod +x /usr/bin/composer; \
composer install --no-progress --no-interaction; \
fi
- save_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
paths:
- ./vendor
- persist_to_workspace:
root: .
paths:
- vendor

behat7-4:
executor: php7-4
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Install alpine requirements for behat
command: apk add sqlite php-sqlite3
- run:
name: Behat
command: examples/scripts/create_schema.sh && php examples/scripts/load_fixtures.php && vendor/behat/behat/bin/behat --colors -vvv

phpunit7-4:
executor: php7-4
steps:
- checkout
- attach_workspace:
at: .
- run:
name: PHP Unit
command: vendor/bin/phpunit

composer8-0:
executor: php8-0
steps:
- run:
name: Install alpine requirements for checkout
command: apk add git openssh-client curl patch
- checkout
- run:
name: composer
command: |
if [[ ! -f vendor/autoload.php ]]; then
curl https://getcomposer.org/composer-stable.phar --location --silent --output /usr/bin/composer; \
chmod +x /usr/bin/composer; \
composer install --no-progress --no-interaction; \
fi
- save_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
paths:
- ./vendor
- persist_to_workspace:
root: .
paths:
- vendor

behat8-0:
executor: php8-0
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Install alpine requirements for behat
command: apk add sqlite php-sqlite3
- run:
name: Behat
command: examples/scripts/create_schema.sh && php examples/scripts/load_fixtures.php && vendor/behat/behat/bin/behat --colors -vvv

phpunit8-0:
executor: php8-0
steps:
- checkout
- attach_workspace:
at: .
- run:
name: PHP Unit
command: vendor/bin/phpunit


composer8-1:
executor: php8-1
steps:
- run:
name: Install alpine requirements for checkout
command: apk add git openssh-client curl patch
- checkout
- run:
name: composer
command: |
if [[ ! -f vendor/autoload.php ]]; then
curl https://getcomposer.org/composer-stable.phar --location --silent --output /usr/bin/composer; \
chmod +x /usr/bin/composer; \
composer install --no-progress --no-interaction; \
fi
- save_cache:
key: composer-{{ checksum "composer.json" }}-{{ checksum "composer.lock" }}
paths:
- ./vendor
- persist_to_workspace:
root: .
paths:
- vendor

behat8-1:
executor: php8-1
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Install alpine requirements for behat
command: apk add sqlite php-sqlite3
- run:
name: Behat
command: examples/scripts/create_schema.sh && php examples/scripts/load_fixtures.php && vendor/behat/behat/bin/behat --colors -vvv

phpunit8-1:
executor: php8-1
steps:
- checkout
- attach_workspace:
at: .
- run:
name: PHP Unit
command: vendor/bin/phpunit

workflows:
version: '2.1'
Code quality:
jobs:
- composer7-4
- composer8-0
- composer8-1
- phpunit7-4:
requires:
- composer7-4
- behat7-4:
requires:
- composer7-4
- phpunit8-0:
requires:
- composer8-0
- behat8-0:
requires:
- composer8-0
- phpunit8-1:
requires:
- composer8-1
- behat8-1:
requires:
- composer8-1
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/vendor/
/composer.lock
/examples/rulerz.db
.idea
.phpunit.result.cache
30 changes: 0 additions & 30 deletions .travis.yml

This file was deleted.

7 changes: 7 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Changelog

## 1.0.1 (First version after the Wizaplace fork)
* Change dependency to rulerz to the Wizaplace's version.
* Applied the same composer patches already applied to rulerz to make the tests to pass with PHP8.1.
* Removed Travis CI configuration file.
* Added Circle CI integration: checks for PHP7.4, 8.0 and 8.1.
39 changes: 29 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,32 @@
}
],
"require": {
"php": ">=7.1",

"kphoen/rulerz": "dev-master as 1.0.0",

"doctrine/dbal": "^2.4"
"php": ">=7.4",
"kphoen/rulerz": "^1",
"doctrine/dbal": "^2.4",
"symplify/vendor-patches": "^9.3"
},
"require-dev": {
"liip/rmt": "^1.2",

"behat/behat": "~3.0",

"phpunit/phpunit": "^7.1",
"kphoen/rusty": "dev-master"
"phpunit/phpunit": "^9.5"
},
"extra": {
"patches": {
"hoa/compiler": [
"patches/hoa-compiler-llk-rule-rule-php.patch"
],
"hoa/stream": [
"patches/hoa-stream-stream-php.patch"
],
"hoa/iterator": [
"patches/hoa-iterator-lookahead-php.patch",
"patches/hoa-iterator-buffer-php.patch"
],
"hoa/protocol": [
"patches/hoa-protocol-node-node-php.patch"
]
}
},
"autoload": {
"psr-4": { "RulerZ\\DoctrineDBAL\\": "src/" }
Expand All @@ -33,5 +46,11 @@
"psr-4": {
"Tests\\RulerZ\\": "tests/"
}
}
},
"repositories": [
{
"type": "git",
"url": "https://github.com/wizaplace/rulerz"
}
]
}
11 changes: 11 additions & 0 deletions patches/hoa-compiler-llk-rule-rule-php.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- /dev/null
+++ ../Llk/Rule/Rule.php
@@ -181,7 +181,7 @@
{
$old = $this->_nodeId;

- if (false !== $pos = strpos($nodeId, ':')) {
+ if (null !== $nodeId && false !== $pos = strpos($nodeId, ':')) {
$this->_nodeId = substr($nodeId, 0, $pos);
$this->_nodeOptions = str_split(substr($nodeId, $pos + 1));
} else {
Loading

0 comments on commit be5b775

Please sign in to comment.