Skip to content

Commit

Permalink
PHP7 has deprecated same-named functions as constructors
Browse files Browse the repository at this point in the history
As per, http://php.net/manual/en/language.oop5.decon.php, "Old style
constructors are DEPRECATED in PHP 7.0, and will be removed in a future
version. You should always use __construct() in new code." The current
tests fail on PHP7.0 based installs due to the deprecation warnings.

Bump the minimum version of PHP to 5.0.0 where __construct support was
added.

Signed-off-by: Nishanth Aravamudan <nish.aravamudan@canonical.com>
  • Loading branch information
Nishanth Aravamudan committed Apr 7, 2016
1 parent 9fa08bd commit fa24ff3
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cache/Lite.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class Cache_Lite
* @param array $options options
* @access public
*/
function Cache_Lite($options = array(NULL))
function __construct($options = array(NULL))
{
foreach($options as $key => $value) {
$this->setOption($key, $value);
Expand Down
4 changes: 2 additions & 2 deletions Cache/Lite/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ class Cache_Lite_File extends Cache_Lite
* @param array $options options
* @access public
*/
function Cache_Lite_File($options = array(NULL))
function __construct($options = array(NULL))
{
$options['lifetime'] = 0;
$this->Cache_Lite($options);
parent::__construct($options);
if (isset($options['masterFile'])) {
$this->_masterFile = $options['masterFile'];
} else {
Expand Down
4 changes: 2 additions & 2 deletions Cache/Lite/Function.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Cache_Lite_Function extends Cache_Lite
* @param array $options options
* @access public
*/
function Cache_Lite_Function($options = array(NULL))
function __construct($options = array(NULL))
{
$availableOptions = array('debugCacheLiteFunction', 'defaultGroup', 'dontCacheWhenTheOutputContainsNOCACHE', 'dontCacheWhenTheResultIsFalse', 'dontCacheWhenTheResultIsNull');
while (list($name, $value) = each($options)) {
Expand All @@ -91,7 +91,7 @@ function Cache_Lite_Function($options = array(NULL))
}
}
reset($options);
$this->Cache_Lite($options);
parent::__construct($options);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions Cache/Lite/Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class Cache_Lite_Output extends Cache_Lite
* @param array $options options
* @access public
*/
function Cache_Lite_Output($options)
function __construct($options)
{
$this->Cache_Lite($options);
parent::__construct($options);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
<dependencies>
<required>
<php>
<min>4.0.0</min>
<min>5.0.0</min>
</php>
<pearinstaller>
<min>1.5.4</min>
Expand Down
2 changes: 1 addition & 1 deletion tests/Cache_Lite_Function_classical.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class bench

class test
{
function test($options) {
function __construct($options) {
$this->foo = 'bar';
$cache = new Cache_Lite_Function($options);
echo($cache->call(array($this, 'method_to_bench'), 'foo', 'bar'));
Expand Down

0 comments on commit fa24ff3

Please sign in to comment.