I\'m working on a CMS based on Zend Framework 3.0 to manage a DB I with Doctrine. What is my problem when managing packages with composer? Recently, I updated all the packag
Make sure your newest PHP version is running.
Sometimes when you check PHP version using php -v
it shows the latest installed version but the older one in running.
If you installed a new version of PHP, just remove older versions:
apt purge php7.0 php7.0-common
Having same issue, after checking lots of thing, my problem solved by removing older version.
You can try to use the following configuration. It works for me.
"require": {
"php": ">=5.5.9",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/orm": "2.5.6",
"doctrine/annotations": "1.4.*",
"doctrine/dbal": "2.5.4",
...
}
Also very helpful when you reporting composer/package issues is the output of composer show. Mine looks like this:
doctrine/annotations v1.4.0 Docblock Annotations Parser
doctrine/cache v1.7.0 Caching library offering an object-oriented API for many cache backends
doctrine/collections v1.5.0 Collections Abstraction library
doctrine/common v2.6.2 Common Library for Doctrine projects
doctrine/dbal v2.5.4 Database Abstraction Layer
doctrine/doctrine-bundle 1.6.8 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle 1.3.0 Symfony Bundle for Doctrine Cache
doctrine/inflector v1.2.0 Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator 1.0.5 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm v2.5.6 Object-Relational-Mapper for PHP
If you have such problems in the future, go to https://packagist.org/packages/ and search for package which causes problems.
For example doctrine/annotations: https://packagist.org/packages/doctrine/annotations#v1.5.0
Then look there for (requires: php: ^7.1) and if this package matches your PHP version. (In your case using PHP 7.0 it doesn't match)
But https://packagist.org/packages/doctrine/annotations#v1.4.0 matches your PHP version (requires: php: ^5.6 || ^7.0) and you can try to use it.
To avoid this kind of problems, a good practice is to set the composer config.platform
setting:
"config": {
"platform": {
"php": "7.0.23"
}
}
This will tell composer to update packages but only to a version that still supports this PHP version. So typically, this version number will be the version of your production server.
Just delete composer.lock in your project, same for the "vendor" folder.
run that and enjoy ->
php composer.phar selfupdate
php composer.phar install
This error caused by the latest version of Doctrine\Common\Annotations
use PHP 7.1. That's why it use void
as return type
. And it is not supported on PHP 7.0.*. This is new feature in PHP 7.1
I use doctrine-orm-module 1.1
in my ZF3 project using PHP 7.0. And it work well. So, just replace your doctrine-orm-module
version to 1.1
.
"doctrine/doctrine-orm-module": "^1.1"
I suggest you to define the version of dependencies you used in composer. This is purposed to make your project not broken when new version of dependencies released.