Start of PHP 7 updates

This commit is contained in:
Timothy Warren 2016-10-13 13:11:22 -04:00
parent 2fa295ee6a
commit 258ebf30ef
52 changed files with 311 additions and 92 deletions

View File

@ -3,7 +3,7 @@
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,7 +1,9 @@
<?php
declare(strict_types=1);
$ion_file_patterns = [
'src/*.php'
$file_patterns = [
'src/*.php',
'tests/**/*.php',
];
if ( ! function_exists('glob_recursive'))
@ -34,6 +36,13 @@ function get_text_to_replace($tokens)
{
return "<?php\n" . $tokens[1][1];
}
// If there is a declare strict types,
else if ($tokens[1][0] === T_DECLARE && $tokens[9][0] === T_DOC_COMMENT)
{
// '<?php' and 'declare(strict_types=1);' makes for 8 tokens
// replace it all
return "<?php\ndeclare(strict_types=1);\n" . $tokens[9][1];
}
else if ($tokens[1][0] !== T_DOC_COMMENT)
{
return "<?php";
@ -54,17 +63,17 @@ function replace_files(array $files, $template)
$text_to_replace = get_text_to_replace($tokens);
$header = file_get_contents(__DIR__ . $template);
$new_text = "<?php\n{$header}";
$new_text = "<?php declare(strict_types=1);\n{$header}";
$new_source = str_replace($text_to_replace, $new_text, $source);
file_put_contents($file, $new_source);
}
}
foreach ($ion_file_patterns as $glob)
foreach ($file_patterns as $glob)
{
$files = glob_recursive($glob);
replace_files($files, '/ion_header_comment.txt');
replace_files($files, '/header_comment.txt');
}
echo "Successfully updated headers \n";
echo "Successfully updated headers \n";

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,10 +1,10 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 5.6
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\Cache;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\Cache\Driver;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\Cache\Driver;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\Cache\Driver;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\Cache\Driver;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\Cache\Driver;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\Di;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\Di;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\Exception;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\Model;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\Transformer;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\Type;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\View;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\View;

View File

@ -1,4 +1,18 @@
<?php
<?php declare(strict_types=1);
/**
* Ion
*
* Building blocks for web development
*
* PHP version 7
*
* @package Ion
* @author Timothy J. Warren <tim@timshomepage.net>
* @copyright 2015 - 2016 Timothy J. Warren
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 1.0.0
* @link https://git.timshomepage.net/timw4mail/ion
*/
namespace Aviat\Ion\Tests\View;