diff --git a/.travis.yml b/.travis.yml index f589430..7be569e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/LICENSE b/LICENSE index 26ac4fa..8839aca 100644 --- a/LICENSE +++ b/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, diff --git a/Makefile b/Makefile index a5f1a85..68c2a94 100644 --- a/Makefile +++ b/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." @@ -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 @@ -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 diff --git a/README.md b/README.md index 21b805c..ecdc7f7 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ return [ ## Requirements -The package requires PHP 5.6 or later. +The package requires PHP 7.2 or later. @@ -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 diff --git a/composer.json b/composer.json index d29f77e..873b806 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/lib/Hooks.php b/lib/Hooks.php index 2fad2c0..df4e519 100644 --- a/lib/Hooks.php +++ b/lib/Hooks.php @@ -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 = []; @@ -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) : []; } /** @@ -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'); } @@ -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'); } @@ -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) { @@ -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; @@ -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; @@ -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']; } @@ -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); }