doctrine / instantiator

https://www.doctrine-project.org/projects/instantiator.html
MIT License
10.93k stars 60 forks source link

version 1.1.0 broke phpunit on PHP 5.4 ~ PHP 5.6 #30

Closed kinosang closed 7 years ago

kinosang commented 7 years ago

the changes on 1.1.0, such as

syntax error, unexpected ':', expecting ';' or '{' 

at vendor/doctrine/instantiator/src/Doctrine/Instantiator/Instantiator.php:95

broke phpunit on PHP 5.4 ~ PHP 5.6

Here's the dependency tree:

phpunit/phpunit 4.8.24 The PHP Unit Testing framework.
├──ext-dom *
├──ext-json *
├──ext-pcre *
├──ext-reflection *
├──ext-spl *
├──php >=5.3.3
├──phpspec/prophecy ^1.3.1
│  ├──doctrine/instantiator ^1.0.2
│  │  └──php >=5.3,<8.0-DEV

I wonder to know how to force composer to install the old release of doctrine/instantiator ^1.0.2.

alcaeus commented 7 years ago

See http://doctrine-project.org/2017/07/25/php-7.1-requirement-and-composer.html. Run composer update on PHP 5.x and you'll get a compatible version. Closing as invalid.

biggianteye commented 7 years ago

While that works, it's a bit ugly to have to do an update immediately after an install.

Ocramius commented 7 years ago

If your install is broken, then that's just because the locked dependency set is not compatible with your PHP version, and they shouldn't be locked to that set in first place

KeitelDOG commented 6 years ago

I had that problem too. Here's what happened to. On a fresh Macbook Pro, High Sierra comes with php7, I configure Laravel and updated composer with php7. And then I switched to php5.6.31, which was incompatible with installed version of doctrine/instantiator. I re run composer update and then it downgraded the doctrine dependencies and it works:

`- Updating mtdowling/cron-expression (v1.2.0 => v1.2.1): Loading from cache

chippyash commented 6 years ago

I am stunned at the level of arrogance from the doctrine team that considers removing a PHP major version not to be a BC break. But lesson learned. In future we should all pin to a feature version instead of allowing our systems to benefit from new features by pinning on the major version. Quite staggering.

However, for others that can't get to grips with the disappearance of PHP 5.X support in doctrine/instantiator V1.1.0, a simple fix is to put

"doctrine/instantiator": "1.0.5"

in your require-dev section. Phpunit, V 4* which uses it, will happily start working again.

Ocramius commented 6 years ago

You can put ^1.0.0 and let the SAT deal with it. There is nothing breaking here, except what was already widely explained above and in the linked article.

If you run composer update and composer install on incompatible systems, or if you prepare deployment packages on a system that is incompatible with your production environment, you will get into trouble anyway.

boly38 commented 6 years ago

Hi, following tests on my side, and instead of setup a static "doctrine/instantiator" version's. I finally setup a target platform php version by adding a config::platform section to the composer.json, cf. example under (doc).

    "config": {
        "platform": {
            "php": "5.6.32"
        }
    },

After composer update, doctrine/instantiator version (in composer.lock) is resolved to:

            "name": "doctrine/instantiator",
            "version": "1.0.5",

my 2 cents.