From d875761de801043919a2b51a1058c4937325b4e9 Mon Sep 17 00:00:00 2001 From: Rougin Gutib Date: Wed, 28 Aug 2024 00:24:47 +0800 Subject: [PATCH 1/2] Improve code quality, code documentation --- .github/workflows/build.yml | 45 ++++ .gitignore | 3 + .travis.yml | 31 --- CHANGELOG.md | 10 + composer.json | 106 +++++----- phpstan.neon | 15 ++ phpstyle.php | 76 +++++++ src/Controller.php | 40 ++++ src/Instance.php | 18 +- src/SparkPlug.php | 198 ++++++++++++------ src/helpers.php | 10 +- tests/Application/config/config.php | 1 + tests/Application/config/constants.php | 1 + tests/Application/config/database.php | 1 + .../Application/config/production/config.php | 1 + .../config/production/constants.php | 1 + tests/Application/config/routes.php | 1 + .../views/errors/cli/error_404.php | 1 + .../Application/views/errors/cli/error_db.php | 1 + .../views/errors/cli/error_general.php | 1 + .../Codeigniter/application/config/config.php | 1 + .../application/config/constants.php | 1 + .../application/config/database.php | 1 + .../application/config/production/config.php | 1 + .../config/production/constants.php | 1 + .../Codeigniter/application/config/routes.php | 1 + .../views/errors/cli/error_404.php | 1 + .../application/views/errors/cli/error_db.php | 1 + .../views/errors/cli/error_general.php | 1 + tests/InstanceTest.php | 11 +- tests/SparkPlugTest.php | 43 ++-- tests/Testcase.php | 29 +++ 32 files changed, 459 insertions(+), 194 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml create mode 100644 phpstan.neon create mode 100644 phpstyle.php create mode 100644 src/Controller.php create mode 100644 tests/Testcase.php diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..550e711 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +on: + push: + branches: [ 'master' ] + pull_request: + branches: [ 'master' ] + +permissions: + contents: read + +jobs: + run: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php-versions: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3' ] + + name: Run Unit Test on PHP ${{ matrix.php-versions }} + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + + - name: Check the PHP version + run: php -v + + - name: Validate composer.json and composer.lock + run: composer validate --strict + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + + - name: Run test suite + run: vendor/bin/phpunit --coverage-clover=coverage.clover + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4-beta + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 751f6c5..f6e2e42 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +.php-cs-fixer.cache +.phpunit.result.cache +app build composer.lock docs diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2fc8a15..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -dist: xenial -language: php -os: linux - -php: - - 5.6 - - 7.0 - - 7.1 - - 7.2 - - 7.3 - - 7.4 - -jobs: - include: - - php: 5.4 - dist: trusty - - php: 5.5 - dist: trusty - -before_install: - - echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - -before_script: - - travis_retry composer self-update - - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source - -script: - - vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover - -after_script: - - if [[ $TRAVIS_PHP_VERSION != 'hhvm' && $TRAVIS_PHP_VERSION != '7.0' ]]; then php vendor/bin/ocular code-coverage:upload --format=php-clover coverage.clover; fi \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 70bae07..e2b9486 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ All notable changes to `Spark Plug` will be documented in this file. +## [0.7.0](https://github.com/rougin/spark-plug/compare/v0.6.1...v0.7.0) - Unreleased + +### Added +- `Controller` for type-hinting `Codeigniter 3`'s libraries + +### Changed +- Code documentation by `php-cs-fixer`, code quality by `phpstan` +- Workflow from `Travis CI` to `Github Actions` +- Code coverage from `Scrutinizer CI` to `Codecov` + ## [0.6.1](https://github.com/rougin/spark-plug/compare/v0.6.0...v0.6.1) - 2018-12-11 ### Added diff --git a/composer.json b/composer.json index c157fe9..877ddaf 100644 --- a/composer.json +++ b/composer.json @@ -1,60 +1,60 @@ { - "name": "rougin/spark-plug", - "description": "Codeigniter applications as single variables.", - "keywords": ["codeigniter", "instance", "php", "spark-plug"], - "homepage": "https://roug.in/spark-plug/", - "license": "MIT", - "authors": - [ - { - "email": "rougingutib@gmail.com", - "homepage": "https://roug.in/", - "name": "Rougin Gutib", - "role": "Software Engineer" - } - ], - "require": + "name": "rougin/spark-plug", + "description": "Codeigniter 3 in a single variable.", + "keywords": [ "codeigniter", "php", "spark-plug" ], + "homepage": "https://roug.in/spark-plug/", + "license": "MIT", + "authors": + [ { - "php": ">=5.4.0" - }, - "require-dev": - { - "phpunit/phpunit": "~4.2|~5.7", - "rougin/codeigniter": "~3.0", - "scrutinizer/ocular": "~1.1.0" - }, - "autoload": - { - "psr-4": - { - "Rougin\\SparkPlug\\": "src" - } - }, - "autoload-dev": - { - "psr-4": - { - "Rougin\\SparkPlug\\": "tests" - } - }, - "scripts": + "email": "rougingutib@gmail.com", + "homepage": "https://roug.in/", + "name": "Rougin Gutib", + "role": "Software Engineer" + } + ], + "require": + { + "php": ">=5.4.0" + }, + "require-dev": + { + "phpunit/phpunit": "~4.2|~5.7|~6.0|~7.0|~8.0|~9.0", + "rougin/codeigniter": "~3.0", + "sanmai/phpunit-legacy-adapter": "~6.1|~8.0" + }, + "autoload": + { + "psr-4": { - "test": "phpunit" - }, - "extra": + "Rougin\\SparkPlug\\": "src" + } + }, + "autoload-dev": + { + "psr-4": { - "branch-alias": - { - "dev-master": "1.0-dev" - } - }, - "suggest": + "Rougin\\SparkPlug\\": "tests" + } + }, + "scripts": + { + "test": "phpunit" + }, + "extra": + { + "branch-alias": { - "rougin/codeigniter": "Packaged \"system\" folder of the Codeigniter framework.", - "rougin/combustor": "CRUD generator for the Codeigniter framework.", - "rougin/credo": "Doctrine ORM integration for the Codeigniter framework.", - "rougin/ignite": "Composer-based project for the Codeigniter framework.", - "rougin/refinery": "\"Ready-to-eat\" migrations for Codeigniter framework", - "rougin/wildfire": "Query Builder wrapper for the Codeigniter framework." + "dev-master": "1.0-dev" } + }, + "suggest": + { + "rougin/codeigniter": "Codeigniter 3's Composer-based package.", + "rougin/combustor": "A simple CRUD generator for Codeigniter 3.", + "rougin/credo": "A Doctrine ORM wrapper for Codeigniter 3.", + "rougin/ignite": "Codeigniter 3 as a Composer-based project.", + "rougin/refinery": "Database migrations for Codeigniter 3.", + "rougin/wildfire": "A Query Builder wrapper for Codeigniter 3." + } } \ No newline at end of file diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..517a3e3 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,15 @@ +parameters: + level: 9 + paths: + - src + - tests + excludePaths: + analyse: + - tests/Application/views + - tests/Codeigniter/application/views + scanDirectories: + - vendor/rougin/codeigniter/src + ignoreErrors: + - '#^Constant APPPATH not found\.$#' + - '#^Constant BASEPATH not found\.$#' + - '#^Constant ENVIRONMENT not found\.$#' \ No newline at end of file diff --git a/phpstyle.php b/phpstyle.php new file mode 100644 index 0000000..a327e31 --- /dev/null +++ b/phpstyle.php @@ -0,0 +1,76 @@ + true); + +$cscp = 'control_structure_continuation_position'; +$rules[$cscp] = ['position' => 'next_line']; + +$braces = array(); +$braces['control_structures_opening_brace'] = 'next_line_unless_newline_at_signature_end'; +$braces['functions_opening_brace'] = 'next_line_unless_newline_at_signature_end'; +$braces['anonymous_functions_opening_brace'] = 'next_line_unless_newline_at_signature_end'; +$braces['anonymous_classes_opening_brace'] = 'next_line_unless_newline_at_signature_end'; +$braces['allow_single_line_empty_anonymous_classes'] = false; +$braces['allow_single_line_anonymous_functions'] = false; +$rules['braces_position'] = $braces; + +$visibility = array('elements' => array()); +$visibility['elements'] = array('method', 'property'); +$rules['visibility_required'] = $visibility; + +$rules['phpdoc_var_annotation_correct_order'] = true; + +$rules['single_quote'] = ['strings_containing_single_quote_chars' => true]; + +$rules['no_unused_imports'] = true; + +$rules['align_multiline_comment'] = true; + +$rules['trim_array_spaces'] = true; + +$order = ['case_sensitive' => true]; +$order['null_adjustment'] = 'always_last'; +$rules['phpdoc_types_order'] = $order; + +$rules['new_with_parentheses'] = ['named_class' => false]; + +$rules['concat_space'] = ['spacing' => 'one']; + +$rules['no_empty_phpdoc'] = true; + +$groups = []; +$groups[] = ['template', 'extends']; +$groups[] = ['deprecated', 'link', 'see', 'since', 'codeCoverageIgnore']; +$groups[] = ['property', 'property-read', 'property-write']; +$groups[] = ['method']; +$groups[] = ['author', 'copyright', 'license']; +$groups[] = ['category', 'package', 'subpackage']; +$groups[] = ['param']; +$groups[] = ['return', 'throws']; +$rules['phpdoc_separation'] = ['groups' => $groups]; + +$align = ['align' => 'vertical']; +$align['tags'] = ['method', 'param', 'property', 'throws', 'type', 'var']; +$rules['phpdoc_align'] = $align; + +$rules['statement_indentation'] = false; + +$rules['align_multiline_comment'] = true; +// ----------------------------------------------- + +$finder = new \PhpCsFixer\Finder; + +$finder->in((array) $paths); + +$config = new \PhpCsFixer\Config; + +$config->setRules($rules); + +return $config->setFinder($finder); diff --git a/src/Controller.php b/src/Controller.php new file mode 100644 index 0000000..f604738 --- /dev/null +++ b/src/Controller.php @@ -0,0 +1,40 @@ + + */ +class Controller extends \CI_Controller +{ +} diff --git a/src/Instance.php b/src/Instance.php index 31ad8c0..8ce09fe 100644 --- a/src/Instance.php +++ b/src/Instance.php @@ -3,22 +3,20 @@ namespace Rougin\SparkPlug; /** - * Instance - * - * A static helper for the SparkPlug::instance method. - * * @package SparkPlug - * @author Rougin Gutib + * + * @author Rougin Gutib */ class Instance { /** - * Creates an instance of CodeIgniter based on the application path. + * Creates a Codeigniter instance based on the application path. + * + * @param string $path + * @param array $server + * @param array $globals * - * @param string $path - * @param array $server - * @param array $globals - * @return \CI_Controller + * @return \Rougin\SparkPlug\Controller */ public static function create($path = '', array $server = array(), array $globals = array()) { diff --git a/src/SparkPlug.php b/src/SparkPlug.php index 38434d3..5f87a98 100644 --- a/src/SparkPlug.php +++ b/src/SparkPlug.php @@ -3,22 +3,19 @@ namespace Rougin\SparkPlug; /** - * Spark Plug - * - * Returns Codeigniter applications as single variables. - * * @package SparkPlug - * @author Rougin Gutib + * + * @author Rougin Gutib */ class SparkPlug { /** - * @var array + * @var array */ - protected $constants = array(); + protected $consts = array(); /** - * @var array + * @var array */ protected $globals = array(); @@ -28,39 +25,45 @@ class SparkPlug protected $path = ''; /** - * @var array + * @var array */ protected $server = array(); /** - * @param array $globals - * @param array $server - * @param string|null $path + * @param array $globals + * @param array $server + * @param string|null $path */ public function __construct(array &$globals, array $server, $path = null) { - $this->globals =& $globals; + $this->globals = & $globals; - $this->path = $path === null ? getcwd() : $path; + $this->path = (string) getcwd(); + + if ($path) + { + $this->path = $path; + } $this->server = $server; - $apppath = $this->path . '/application/'; + $path = $this->path . '/application/'; - $this->constants['APPPATH'] = $apppath; + $this->consts['APPPATH'] = $path; - $this->constants['ENVIRONMENT'] = 'development'; + $this->consts['ENVIRONMENT'] = 'development'; - $this->constants['VENDOR'] = $this->path . '/vendor/'; + $this->consts['VENDOR'] = $this->path . '/vendor/'; - $this->constants['VIEWPATH'] = $apppath . 'views/'; + $this->consts['VIEWPATH'] = $path . 'views/'; } /** + * @deprecated since ~0.6, use "instance" instead. + * * Returns the Codeigniter singleton. - * NOTE: To be removed in v1.0.0. Use instance() instead. * - * @return \CI_Controller + * @return \Rougin\SparkPlug\Controller */ public function getCodeIgniter() { @@ -70,13 +73,13 @@ public function getCodeIgniter() /** * Returns the Codeigniter singleton. * - * @return \CI_Controller + * @return \Rougin\SparkPlug\Controller */ public function instance() { - $this->paths(); + $this->setPaths(); - $this->environment($this->constants['ENVIRONMENT']); + $this->environment($this->consts['ENVIRONMENT']); $this->constants(); @@ -86,9 +89,13 @@ public function instance() require 'helpers.php'; - $instance = \CI_Controller::get_instance(); + /** @var \Rougin\SparkPlug\Controller|null */ + $instance = Controller::get_instance(); - empty($instance) && $instance = new \CI_Controller; + if (empty($instance)) + { + $instance = new Controller; + } return $instance; } @@ -98,16 +105,19 @@ public function instance() * * @param string $key * @param string $value + * + * @return self */ public function set($key, $value) { - $this->constants[$key] = $value; - - $same = $key === 'APPPATH'; + $this->consts[$key] = $value; - $path = $this->constants[$key] . '/views/'; + $path = $this->consts[$key] . '/views/'; - $same && $this->constants['VIEWPATH'] = $path; + if ($key === 'APPPATH') + { + $this->consts['VIEWPATH'] = $path; + } return $this; } @@ -119,18 +129,29 @@ public function set($key, $value) */ protected function basepath() { - $directory = new \RecursiveDirectoryIterator(getcwd()); + $path = (string) getcwd(); + + $path = new \RecursiveDirectoryIterator($path); + + /** @var \SplFileInfo[] */ + $items = new \RecursiveIteratorIterator($path); + + $slash = DIRECTORY_SEPARATOR; - $iterator = new \RecursiveIteratorIterator($directory); + foreach ($items as $item) + { + $core = 'core' . $slash . 'CodeIgniter.php'; - foreach ($iterator as $item) { - $core = 'core' . DIRECTORY_SEPARATOR . 'CodeIgniter.php'; + $path = $item->getPathname(); - $exists = strpos($item->getPathname(), $core) !== false; + $exists = strpos($path, $core) !== false; - $path = str_replace($core, '', $item->getPathname()); + $path = str_replace($core, '', $path); - $exists && ! defined('BASEPATH') && define('BASEPATH', $path); + if ($exists && ! defined('BASEPATH')) + { + define('BASEPATH', (string) $path); + } } } @@ -141,13 +162,24 @@ protected function basepath() */ protected function charset() { - ini_set('default_charset', $charset = strtoupper(config_item('charset'))); + /** @var string */ + $charset = config_item('charset'); - defined('MB_ENABLED') || define('MB_ENABLED', extension_loaded('mbstring')); + $charset = strtoupper($charset); + + ini_set('default_charset', $charset); + + if (! defined('MB_ENABLED')) + { + define('MB_ENABLED', extension_loaded('mbstring')); + } $encoding = 'mbstring.internal_encoding'; - ! is_php('5.6') && ! ini_get($encoding) && ini_set($encoding, $charset); + if (! is_php('5.6') && ! ini_get($encoding)) + { + ini_set($encoding, $charset); + } $this->iconv(); } @@ -159,11 +191,12 @@ protected function charset() */ protected function common() { - $exists = class_exists('CI_Controller'); - require BASEPATH . 'core/Common.php'; - $exists || require BASEPATH . 'core/Controller.php'; + if (! class_exists('CI_Controller')) + { + require BASEPATH . 'core/Controller.php'; + } $this->charset(); } @@ -175,11 +208,20 @@ protected function common() */ protected function config() { - $this->globals['CFG'] =& load_class('Config', 'core'); + /** @var string */ + $config = load_class('Config', 'core'); + + $this->globals['CFG'] = & $config; + + /** @var string */ + $utf8 = load_class('Utf8', 'core'); + + $this->globals['UNI'] = & $utf8; - $this->globals['UNI'] =& load_class('Utf8', 'core'); + /** @var string */ + $security = load_class('Security', 'core'); - $this->globals['SEC'] =& load_class('Security', 'core'); + $this->globals['SEC'] = & $security; $this->core(); } @@ -193,13 +235,19 @@ protected function constants() { $config = APPPATH . 'config/'; - $constants = $config . ENVIRONMENT . '/constants.php'; + $consts = $config . ENVIRONMENT . '/constants.php'; $filename = $config . 'constants.php'; - file_exists($constants) && $filename = $constants; + if (file_exists($consts)) + { + $filename = $consts; + } - defined('FILE_READ_MODE') || require $filename; + if (! defined('FILE_READ_MODE')) + { + require $filename; + } } /** @@ -216,33 +264,48 @@ protected function core() load_class('Input', 'core'); load_class('Lang', 'core'); - + load_class('Output', 'core'); } /** * Sets up the current environment. * + * @param string $value + * * @return void */ protected function environment($value = 'development') { - isset($this->server['CI_ENV']) && $value = $this->server['CI_ENV']; + if (isset($this->server['CI_ENV'])) + { + $value = $this->server['CI_ENV']; + } - defined('ENVIRONMENT') || define('ENVIRONMENT', $value); + if (! defined('ENVIRONMENT')) + { + define('ENVIRONMENT', $value); + } } /** * Sets the ICONV constants. * - * @param boolean $enabled + * @param boolean $enabled + * * @return void */ protected function iconv($enabled = false) { - mb_substitute_character('none') && $enabled = defined('ICONV_ENABLED'); + if (mb_substitute_character('none') === true) + { + $enabled = defined('ICONV_ENABLED'); + } - $enabled || define('ICONV_ENABLED', extension_loaded('iconv')); + if (! $enabled) + { + define('ICONV_ENABLED', extension_loaded('iconv')); + } } /** @@ -250,20 +313,25 @@ protected function iconv($enabled = false) * * @return void */ - protected function paths() + protected function setPaths() { - $paths = array('APPPATH' => $this->constants['APPPATH']); + $paths = array('APPPATH' => $this->consts['APPPATH']); - $paths['VENDOR'] = $this->constants['VENDOR']; + $paths['VENDOR'] = $this->consts['VENDOR']; - $paths['VIEWPATH'] = $this->constants['VIEWPATH']; + $paths['VIEWPATH'] = $this->consts['VIEWPATH']; - foreach ((array) $paths as $key => $value) { - $defined = defined($key); - - $defined || define($key, $value); + foreach ($paths as $key => $value) + { + if (! defined($key)) + { + define($key, $value); + } } - defined('BASEPATH') || $this->basepath(); + if (! defined('BASEPATH')) + { + $this->basepath(); + } } } diff --git a/src/helpers.php b/src/helpers.php index 173fcb2..192009e 100644 --- a/src/helpers.php +++ b/src/helpers.php @@ -1,14 +1,18 @@ + * + * @author Rougin Gutib */ class InstanceTest extends SparkPlugTest { /** - * Sets up the Codeigniter instance. - * * @return void */ - public function setUp() + public function doSetUp() { $server = array('CI_ENV' => 'production'); @@ -23,6 +20,6 @@ public function setUp() $instance = Instance::create($folder, $server); - $this->codeigniter = $instance; + $this->ci = $instance; } } diff --git a/tests/SparkPlugTest.php b/tests/SparkPlugTest.php index 4c7752a..c1a7ce0 100644 --- a/tests/SparkPlugTest.php +++ b/tests/SparkPlugTest.php @@ -3,24 +3,23 @@ namespace Rougin\SparkPlug; /** - * Spark Plug Test - * * @package SparkPlug - * @author Rougin Gutib + * + * @author Rougin Gutib */ -class SparkPlugTest extends \PHPUnit_Framework_TestCase +class SparkPlugTest extends Testcase { /** - * @var \CI_Controller + * @var \Rougin\SparkPlug\Controller */ - protected $codeigniter; + protected $ci; /** * Sets up the Codeigniter instance. * * @return void */ - public function setUp() + public function doSetUp() { $_SERVER['CI_ENV'] = 'production'; @@ -32,47 +31,41 @@ public function setUp() $sparkplug->set('VIEWPATH', $folder . '/views/'); - $this->codeigniter = $sparkplug->instance(); + $this->ci = $sparkplug->instance(); } /** - * Checks if the Codeigniter instance is successfully retrieved. - * * @return void */ - public function testCodeigniterInstance() + public function test_ci_instance_retrieved() { - $expected = get_class($this->codeigniter); + $expected = get_class($this->ci); - $result = $this->codeigniter; + $result = $this->ci; $this->assertInstanceOf($expected, $result); } /** - * Checks if the loaded library can be retrieved. - * * @return void */ - public function testLoadLibrary() + public function test_library_loaded() { - $this->codeigniter->load->library('email'); + $this->ci->load->library('email'); - $expected = get_class($this->codeigniter->email); + $expected = get_class($this->ci->email); - $result = $this->codeigniter->email; + $result = $this->ci->email; $this->assertInstanceOf($expected, $result); } /** - * Checks if the loaded helper can be retrieved. - * * @return void */ - public function testLoadHelper() + public function test_helper_loaded() { - $this->codeigniter->load->helper('inflector'); + $this->ci->load->helper('inflector'); $this->assertTrue(function_exists('singular')); } @@ -82,9 +75,9 @@ public function testLoadHelper() * * @return void */ - public function testEnvironmentConstants() + public function test_environment_constants() { - $config = $this->codeigniter->config; + $config = $this->ci->config; // The said item is "true" in config/production/config.php // while it was "false" in the default config/config.php diff --git a/tests/Testcase.php b/tests/Testcase.php new file mode 100644 index 0000000..6d0998b --- /dev/null +++ b/tests/Testcase.php @@ -0,0 +1,29 @@ + + */ +class Testcase extends Legacy +{ + /** @phpstan-ignore-next-line */ + public function setExpectedException($exception) + { + if (method_exists($this, 'expectException')) + { + $this->expectException($exception); + + return; + } + + /** @phpstan-ignore-next-line */ + parent::setExpectedException($exception); + } +} From 07e4efd6fcbf42beac4fb299fb68b466fdde6756 Mon Sep 17 00:00:00 2001 From: Rougin Gutib Date: Wed, 28 Aug 2024 00:31:48 +0800 Subject: [PATCH 2/2] Remove pass as reference for PHP 8 onwards --- src/SparkPlug.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/SparkPlug.php b/src/SparkPlug.php index 5f87a98..7f3aeac 100644 --- a/src/SparkPlug.php +++ b/src/SparkPlug.php @@ -34,7 +34,7 @@ class SparkPlug * @param array $server * @param string|null $path */ - public function __construct(array &$globals, array $server, $path = null) + public function __construct(array $globals, array $server, $path = null) { $this->globals = & $globals;