yiisoft / yii2-app-basic

Yii 2.0 Basic Application Template
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
656 stars 788 forks source link

New installation doesn't work on php 5.6 #122

Closed inwoker closed 7 years ago

inwoker commented 7 years ago

What steps will reproduce the problem?

composer create-project --prefer-dist yiisoft/yii2-app-basic basic

What's expected?

Standart basic application homepage.

What do you get instead?

Parse error: syntax error, unexpected '?' in .../basic/vendor/phpunit/phpunit/src/Framework/TestCase.php on line 822

It works when I manually revert phpunit to 5.7.19. Maybe it's bug in phpunit and should I submit it there?

Additional info

Q A
Yii vesion 2.0.11
PHP version 5.6.13
Operating system Gentoo
samdark commented 7 years ago

I think so. At least it is not something we can fix within Yii framework.

inwoker commented 7 years ago

@samdark Phpunit > 6 now requires php>7. It makes yii2 default installation require php7. I guess it should be new requirement for yii2. Maybe you should reflect it in docs and maybe requirements.php?

cebe commented 7 years ago

if you install basic app on php 5.6 it should not install phpunit 6.

inwoker commented 7 years ago

@cebe Well. It does. That's the point.

cebe commented 7 years ago

it works for me on PHP 5.6:

$ php --version
PHP 5.6.30-0+deb8u1 (cli) (built: Feb  8 2017 08:50:21) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
    with Xdebug v2.2.5, Copyright (c) 2002-2014, by Derick Rethans
$ composer create-project --prefer-dist yiisoft/yii2-app-basic basic
Installing yiisoft/yii2-app-basic (2.0.11)
  - Installing yiisoft/yii2-app-basic (2.0.11): Downloading (100%)         
Created project in basic
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 59 installs, 0 updates, 0 removals     
  - Installing yiisoft/yii2-composer (2.0.5): Downloading (100%)         
  - Installing swiftmailer/swiftmailer (v5.4.8): Loading from cache
  - Installing bower-asset/jquery (2.2.4): Loading from cache
  - Installing bower-asset/yii2-pjax (v2.0.6): Loading from cache
  - Installing bower-asset/punycode (v1.3.2): Loading from cache
  - Installing cebe/markdown (1.1.1): Downloading (100%)         
  - Installing ezyang/htmlpurifier (v4.9.2): Loading from cache
  - Installing bower-asset/jquery.inputmask (3.3.6): Loading from cache
  - Installing yiisoft/yii2 (2.0.11.2): Downloading (100%)         
  - Installing yiisoft/yii2-swiftmailer (2.0.7): Loading from cache
  - Installing bower-asset/bootstrap (v3.3.7): Loading from cache
  - Installing yiisoft/yii2-bootstrap (2.0.6): Downloading (100%)         
  - Installing yiisoft/yii2-debug (2.0.9): Downloading (100%)         
  - Installing bower-asset/typeahead.js (v0.11.1): Downloading (100%)         
  - Installing phpspec/php-diff (v1.1.0): Downloading (100%)         
  - Installing yiisoft/yii2-gii (2.0.5): Downloading (100%)         
  - Installing fzaninotto/faker (v1.6.0): Downloading (100%)         
  - Installing yiisoft/yii2-faker (2.0.3): Downloading (100%)         
  - Installing psr/log (1.0.2): Downloading (100%)         
  - Installing symfony/debug (v3.3.0): Downloading (100%)         
  - Installing symfony/polyfill-mbstring (v1.3.0): Downloading (100%)         
  - Installing symfony/console (v3.3.0): Downloading (100%)         
  - Installing stecman/symfony-console-completion (0.7.0): Downloading (100%)         
  - Installing sebastian/diff (1.4.3): Loading from cache
  - Installing sebastian/recursion-context (2.0.0): Downloading (100%)         
  - Installing sebastian/exporter (2.0.0): Downloading (100%)         
  - Installing sebastian/comparator (1.2.4): Downloading (100%)         
  - Installing behat/gherkin (v4.4.5): Downloading (100%)         
  - Installing symfony/dom-crawler (v3.3.0): Downloading (100%)         
  - Installing symfony/css-selector (v3.3.0): Loading from cache
  - Installing symfony/browser-kit (v3.3.0): Loading from cache
  - Installing symfony/yaml (v3.3.0): Downloading (100%)         
  - Installing symfony/event-dispatcher (v3.3.0): Downloading (100%)         
  - Installing symfony/finder (v3.3.0): Downloading (100%)         
  - Installing psr/http-message (1.0.1): Downloading (100%)         
  - Installing guzzlehttp/psr7 (1.4.2): Downloading (100%)         
  - Installing doctrine/instantiator (1.0.5): Downloading (100%)         
  - Installing phpunit/php-text-template (1.2.1): Downloading (100%)         
  - Installing phpunit/phpunit-mock-objects (3.4.3): Downloading (100%)         
  - Installing sebastian/version (2.0.1): Downloading (100%)         
  - Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (100%)         
  - Installing phpunit/php-token-stream (1.4.11): Downloading (100%)         
  - Installing phpunit/php-file-iterator (1.4.2): Downloading (100%)         
  - Installing sebastian/environment (2.0.0): Downloading (100%)         
  - Installing phpunit/php-code-coverage (4.0.8): Downloading (100%)         
  - Installing sebastian/resource-operations (1.0.0): Downloading (100%)         
  - Installing sebastian/global-state (1.1.1): Downloading (100%)         
  - Installing phpunit/php-timer (1.0.9): Downloading (100%)         
  - Installing webmozart/assert (1.2.0): Downloading (100%)         
  - Installing phpdocumentor/reflection-common (1.0): Downloading (100%)         
  - Installing phpdocumentor/type-resolver (0.2.1): Downloading (100%)         
  - Installing phpdocumentor/reflection-docblock (3.1.1): Downloading (100%)         
  - Installing phpspec/prophecy (v1.7.0): Downloading (100%)         
  - Installing myclabs/deep-copy (1.6.1): Downloading (100%)         
  - Installing sebastian/object-enumerator (2.0.1): Downloading (100%)         
  - Installing phpunit/phpunit (5.7.20): Downloading (100%)         
  - Installing codeception/base (2.3.2): Downloading (100%)         
  - Installing codeception/verify (0.3.3): Downloading (100%)         
  - Installing codeception/specify (0.4.6): Downloading (100%)         
symfony/console suggests installing symfony/filesystem ()
symfony/console suggests installing symfony/process ()
symfony/browser-kit suggests installing symfony/process ()
symfony/event-dispatcher suggests installing symfony/dependency-injection ()
symfony/event-dispatcher suggests installing symfony/http-kernel ()
phpunit/php-code-coverage suggests installing ext-xdebug (^2.5.1)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
codeception/base suggests installing flow/jsonpath (For using JSONPath in REST module)
codeception/base suggests installing phpseclib/phpseclib (for SFTP option in FTP Module)
codeception/base suggests installing league/factory-muffin (For DataFactory module)
codeception/base suggests installing league/factory-muffin-faker (For Faker support in DataFactory module)
codeception/base suggests installing symfony/phpunit-bridge (For phpunit-bridge support)
Writing lock file
Generating autoload files
> yii\composer\Installer::postCreateProject
chmod('runtime', 0777)...done.
chmod('web/assets', 0777)...done.
chmod('yii', 0755)...done.
$ cd basic
$ composer show |grep phpunit
phpunit/php-code-coverage          4.0.8    Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator          1.4.2    FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template          1.2.1    Simple template engine.
phpunit/php-timer                  1.0.9    Utility class for timing
phpunit/php-token-stream           1.4.11   Wrapper around PHP's tokenizer extension.
phpunit/phpunit                    5.7.20   The PHP Unit Testing framework.
phpunit/phpunit-mock-objects       3.4.3    Mock Object library for PHPUnit

What are you doing differently?

inwoker commented 7 years ago

@cebe Sorry. For some reason my server has different versions of php for command line and nginx. The error was on my side.

bitsnaps commented 3 years ago

I had the same error, I had to tell composer which php version to use, for more details checkout this answer.