Skip to content

Commit

Permalink
Requires PHP 7.2+
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Mar 18, 2018
1 parent 98c214b commit f70866a
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 33 deletions.
14 changes: 7 additions & 7 deletions .travis.yml
Expand Up @@ -4,17 +4,17 @@ cache:
directories:
- $COMPOSER_CACHE_DIR
- $HOME/.composer/cache
- $TRAVIS_BUILD_DIR/build
- build

language: php

php:
- 5.6
- 7.0
- 7.1
- 7.2
- nightly

before_script:
- if [[ $TRAVIS_PHP_VERSION != "5.6" ]]; then phpenv config-rm xdebug.ini; fi
matrix:
allow_failures:
- php: nightly

script:
- if [[ $TRAVIS_PHP_VERSION == "5.6" ]]; then make test-coveralls; else make test; fi
- if [[ $TRAVIS_PHP_VERSION == "7.2" ]]; then make test-coveralls; else make test; fi
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,7 +1,7 @@
icanboogie/bind-activerecord is free software.
It is released under the terms of the following BSD License.

Copyright (c) 2015-2017 by Olivier Laviale
Copyright (c) 2015-2018 by Olivier Laviale
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
18 changes: 9 additions & 9 deletions Makefile
@@ -1,15 +1,13 @@
# customization

PACKAGE_NAME = icanboogie/bind-activerecord
PACKAGE_VERSION = 4.0
PHPUNIT_VERSION = phpunit-5.7.phar
PACKAGE_VERSION = 5.0
PHPUNIT_VERSION = phpunit-7.phar
PHPUNIT_FILENAME = build/$(PHPUNIT_VERSION)
PHPUNIT = php $(PHPUNIT_FILENAME)

# do not edit the following lines

all: $(PHPUNIT_FILENAME) vendor

usage:
@echo "test: Runs the test suite.\ndoc: Creates the documentation.\nclean: Removes the documentation, the dependencies and the Composer files."

Expand All @@ -22,18 +20,20 @@ update:
autoload: vendor
@composer dump-autoload

test-dependencies: vendor $(PHPUNIT_FILENAME)

$(PHPUNIT_FILENAME):
mkdir -p build
wget https://phar.phpunit.de/$(PHPUNIT_VERSION) -O $(PHPUNIT_FILENAME)
wget https://phar.phpunit.de/$(PHPUNIT_VERSION) -O $(PHPUNIT_FILENAME) -q

test: all
test: test-dependencies
@$(PHPUNIT)

test-coverage: all
test-coverage: test-dependencies
@mkdir -p build/coverage
@$(PHPUNIT) --coverage-html ../build/coverage

test-coveralls: all
test-coveralls: test-dependencies
@mkdir -p build/logs
COMPOSER_ROOT_VERSION=$(PACKAGE_VERSION) composer require satooshi/php-coveralls
@$(PHPUNIT) --coverage-clover ../build/logs/clover.xml
Expand All @@ -52,4 +52,4 @@ clean:
@rm -fR vendor
@rm -f composer.lock

.PHONY: all autoload doc clean test test-coverage test-coveralls update
.PHONY: all autoload doc clean test test-coverage test-coveralls test-dependencies update
8 changes: 4 additions & 4 deletions README.md
Expand Up @@ -118,7 +118,7 @@ return [

## Requirements

The package requires PHP 5.6 or later.
The package requires PHP 7.2 or later.



Expand Down Expand Up @@ -180,8 +180,8 @@ The package is continuously tested by [Travis CI](http://about.travis-ci.org/).



[documentation]: https://icanboogie.org/api/bind-activerecord/4.0/
[ConnectionCollection]: https://icanboogie.org/api/activerecord/4.0/class-ICanBoogie.ActiveRecord.ConnectionCollection.html
[ModelCollection]: https://icanboogie.org/api/activerecord/4.0/class-ICanBoogie.ActiveRecord.ModelCollection.html
[documentation]: https://icanboogie.org/api/bind-activerecord/5.0/
[ConnectionCollection]: https://icanboogie.org/api/activerecord/5.0/class-ICanBoogie.ActiveRecord.ConnectionCollection.html
[ModelCollection]: https://icanboogie.org/api/activerecord/5.0/class-ICanBoogie.ActiveRecord.ModelCollection.html
[icanboogie/activerecord]: https://github.com/ICanBoogie/ActiveRecord
[ICanBoogie]: https://github.com/ICanBoogie/ICanBoogie
6 changes: 3 additions & 3 deletions composer.json
Expand Up @@ -20,9 +20,9 @@
"prefer-stable": true,
"prefer-dist": true,
"require": {
"php": ">=5.6",
"icanboogie/icanboogie": "^4.0",
"icanboogie/activerecord": "^4.0"
"php": "^7.2",
"icanboogie/icanboogie": "^5.0",
"icanboogie/activerecord": "^5.0"
},
"autoload": {
"psr-4": {
Expand Down
18 changes: 9 additions & 9 deletions lib/Hooks.php
Expand Up @@ -32,7 +32,7 @@ class Hooks
*
* @return array
*/
static private function synthesize_config_from_namespace(array $fragments, $namespace)
static private function synthesize_config_from_namespace(array $fragments, string $namespace): array
{
$config = [];

Expand All @@ -46,7 +46,7 @@ static private function synthesize_config_from_namespace(array $fragments, $name
$config[] = $fragment[$namespace];
}

return $config ? call_user_func_array('array_merge', $config) : [];
return $config ? array_merge(...$config) : [];
}

/**
Expand All @@ -56,7 +56,7 @@ static private function synthesize_config_from_namespace(array $fragments, $name
*
* @return array
*/
static public function synthesize_connections_config(array $fragments)
static public function synthesize_connections_config(array $fragments): array
{
return self::synthesize_config_from_namespace($fragments, 'connections');
}
Expand All @@ -68,7 +68,7 @@ static public function synthesize_connections_config(array $fragments)
*
* @return array
*/
static public function synthesize_models_config(array $fragments)
static public function synthesize_models_config(array $fragments): array
{
return self::synthesize_config_from_namespace($fragments, 'models');
}
Expand All @@ -85,7 +85,7 @@ static public function synthesize_models_config(array $fragments)
* @param Application\BootEvent $event
* @param Application $app
*/
static public function on_app_boot(Application\BootEvent $event, Application $app)
static public function on_app_boot(Application\BootEvent $event, Application $app): void
{
ActiveRecord\ModelProvider::define(function($id) use ($app) {

Expand All @@ -106,7 +106,7 @@ static public function on_app_boot(Application\BootEvent $event, Application $ap
*
* @return ConnectionCollection
*/
static public function app_lazy_get_connections(Application $app)
static public function app_lazy_get_connections(Application $app): ConnectionCollection
{
static $connections;

Expand All @@ -126,7 +126,7 @@ static public function app_lazy_get_connections(Application $app)
*
* @return ModelCollection
*/
static public function app_lazy_get_models(Application $app)
static public function app_lazy_get_models(Application $app): ModelCollection
{
static $models;

Expand All @@ -145,7 +145,7 @@ static public function app_lazy_get_models(Application $app)
*
* @return Connection
*/
static public function app_lazy_get_db(Application $app)
static public function app_lazy_get_db(Application $app): Connection
{
return $app->connections['primary'];
}
Expand Down Expand Up @@ -174,7 +174,7 @@ static public function active_record_validate(ActiveRecord $record)
*
* @return RuntimeActiveRecordCache
*/
static public function model_lazy_get_activerecord_cache(Model $model)
static public function model_lazy_get_activerecord_cache(Model $model): RuntimeActiveRecordCache
{
return new RuntimeActiveRecordCache($model);
}
Expand Down

0 comments on commit f70866a

Please sign in to comment.