mmoreram / php-formatter

PHP Formatter is a PHP developer friendly set of tools
MIT License
166 stars 17 forks source link

Fatal Errors with latest update and PHP 7.0+ #30

Closed matt-usurp closed 7 years ago

matt-usurp commented 7 years ago

I am having issues when running this on my docker box with the latest changes.

I find it strange that this gets past the build, but does the build ever test through the Console\Application class? This might want to be something we look in too if not?

Fatal error: Uncaught TypeError: ini_set() expects parameter 2 to be string, boolean given in /src/PHPFormatter/Console/Application.php on line 35

TypeError: ini_set() expects parameter 2 to be string, boolean given in /src/PHPFormatter/Console/Application.php on line 35

Call Stack:
    0.0007     351696   1. {main}() /bin/php-formatter:0
    0.0180     863312   2. Mmoreram\PHPFormatter\Console\Application->__construct() /bin/php-formatter:25
    0.0180     863312   3. ini_set() /src/PHPFormatter/Console/Application.php:35

The culprit looks to be here as described in the above stack and in the documentation: https://github.com/mmoreram/php-formatter/blob/v1.3.1/src/PHPFormatter/Console/Application.php#L34-L37

And looks like PHP documentation has been updated for PHP 7.0. string ini_set(string $varname , string $newvalue) http://php.net/manual/en/function.ini-set.php

$ php -v

PHP 7.0.12 (cli) (built: Nov  8 2016 23:49:58) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
    with Xdebug v2.5.0rc1, Copyright (c) 2002-2016, by Derick Rethans
mmoreram commented 7 years ago

@matt-usurp Thanks!

https://github.com/mmoreram/php-formatter/pull/31

This is the alive probe that strict_types in PHP^7.0 is a big big change in this language :)

Can you please check the PR?

Thanks!^^

matt-usurp commented 7 years ago

Added comment as this doesn't fix locally.

mmoreram commented 7 years ago

@matt-usurp Published tag 1.3.2 ;)

matt-usurp commented 7 years ago

Much thanks for the fast fix :)

mmoreram commented 7 years ago

Thanks to you for the fast feedback :)