Try to update Sonata, have error with jms-serializer - symfony

I need to update my bundles for security reasons but when i try to do a composer update, i have a lot of problem with sonata.
First, SonataCore, sonataMedia and JMS-serializer disappear.
bundles.php
If a tried to reinstall SonataCore with composer require sonata-project/core-bundle
i have this error: Problem 1 - Root composer.json requires sonata-project/core-bundle ^3.20 -> satisfiable by sonata-project/core-bundle[3.20.0]. - sonata-project/core-bundle 3.20.0 requires sonata-project/form-extensions ^0.1 -> found sonata-project/form-extensions[0.1.0, 0.1.1, 0.1.2] but the package is fixed to 1.16.1 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
If a tried to reinstall SonataMedia with composer require sonata-project/media-bundle,
i have this error: Problem 1 - sonata-project/media-bundle[4.1.0, ..., 4.1.5] require doctrine/persistence ^2.0 -> found doctrine/persistence[2.0.0, ..., 2.5.3] but the package is fixed to 1.3.8 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command. - Root composer.json requires sonata-project/media-bundle ^4.1 -> satisfiable by sonata-project/media-bundle[4.1.0, ..., 4.1.5].
I can install JMS-Serializer but then, i have an error with jms_serializer.handler_registry even though i use it nowhere in my code (but it appears in the cache).
My composer.json :
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-json": "*",
"composer/package-versions-deprecated": "1.11.99.5",
"dekalee/mailjet-bundle": "^2.1",
"doctrine/common": "^2",
"doctrine/doctrine-bundle": "^2",
"doctrine/doctrine-migrations-bundle": "^2",
"doctrine/orm": "^2",
"friendsofsymfony/rest-bundle": "^2.6",
"friendsofsymfony/user-bundle": "~2.0",
"guzzlehttp/guzzle": "^6.5",
"hslavich/oneloginsaml-bundle": "^1.4",
"jmose/command-scheduler-bundle": "^2.2",
"jms/serializer-bundle": "^4.0",
"michaeldegroot/doctrine-encrypt-bundle": "^4.0",
"nelmio/api-doc-bundle": "^3.5",
"paragonie/halite": "^4",
"phpoffice/phpspreadsheet": "^1.10",
"sonata-project/admin-bundle": "^3.56",
"sonata-project/doctrine-orm-admin-bundle": "^3.12",
"sonata-project/formatter-bundle": "^4.1",
"sonata-project/intl-bundle": "^2.7",
"sonata-project/user-bundle": "^4.5",
"symfony/console": "4.4.*",
"symfony/dotenv": "4.4.*",
"symfony/flex": "^1.3.1",
"symfony/framework-bundle": "4.4.*",
"symfony/mailer": "4.4.*",
"symfony/mime": "4.4.*",
"symfony/monolog-bundle": "^3.5",
"symfony/serializer": "4.4.*",
"symfony/swiftmailer-bundle": "^3.4",
"symfony/translation": "4.4.*",
"symfony/twig-bundle": "4.4.*",
"symfony/yaml": "4.4.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0",
"vich/uploader-bundle": "^1.12"
},
"require-dev": {
"sonata-project/easy-extends-bundle": "^2.5",
"symfony/debug-bundle": "4.4.*",
"symfony/maker-bundle": "^1.14",
"symfony/stopwatch": "4.4.*",
"symfony/web-profiler-bundle": "4.4.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true,
"allow-plugins": {
"ocramius/package-versions": true,
"symfony/flex": true
}
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": "true",
"require": "4.4.*"
}
}
}
I'm a novice in project management so i have no idea how to resolve all of this, i hope you can help me.

Related

PHPUnit; API Platform v. 3; "Error: Xdebug has detected a possible infinite loop"

I upgraded my API Platform project from v. 2.7 to v. 3.
Using the version 2.7 I was able to run my unit tests without problems. But now after upgrading to version 3, I receive the following error:
Error : Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames
Console output:
/PhpstormProjects/Members/lloyd-members-api/vendor/symfony/dependency-injection/Compiler/ResolveNoPreloadPass.php:81
/PhpstormProjects/Members/lloyd-members-api/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:91
/PhpstormProjects/Members/lloyd-members-api/vendor/symfony/dependency-injection/Compiler/ResolveNoPreloadPass.php:92
/PhpstormProjects/Members/lloyd-members-api/vendor/symfony/dependency-injection/Compiler/ResolveNoPreloadPass.php:40
/PhpstormProjects/Members/lloyd-members-api/vendor/symfony/dependency-injection/Compiler/Compiler.php:73
/PhpstormProjects/Members/lloyd-members-api/vendor/symfony/dependency-injection/ContainerBuilder.php:716
/PhpstormProjects/Members/lloyd-members-api/vendor/symfony/http-kernel/Kernel.php:538
PhpstormProjects/Members/lloyd-members-api/vendor/symfony/http-kernel/Kernel.php:767
/PhpstormProjects/Members/lloyd-members-api/vendor/symfony/http-kernel/Kernel.php:128
/PhpstormProjects/Members/lloyd-members-api/vendor/symfony/framework-bundle/Test/KernelTestCase.php:72
/PhpstormProjects/Members/lloyd-members-api/vendor/api-platform/core/src/Symfony/Bundle/Test/ApiTestCase.php:49
/PhpstormProjects/Members/lloyd-members-api/tests/EasyTest.php:16
I simplified the test to the minimum:
<?php
namespace App\Tests;
use ApiPlatform\Symfony\Bundle\Test\ApiTestCase;
class EasyTest extends ApiTestCase
{
public function testSomething(): void
{
$this->assertTrue(true);
}
public function testProblem(): void
{
self::createClient();
$this->assertTrue(true);
}
}
testSomething() runs as it should.
testProblem() results in the error.
This is my composer.json
{
"type": "project",
"license": "proprietary",
"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"ext-ctype": "*",
"ext-curl": "*",
"ext-exif": "*",
"ext-gd": "*",
"ext-iconv": "*",
"api-platform/core": "^3.0",
"composer/package-versions-deprecated": "1.11.99.4",
"doctrine/annotations": "^1.0",
"doctrine/doctrine-bundle": "^2.7",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.13",
"imagine/imagine": "^1.3",
"jonasarts/phpqrcode-bundle": "^6.0",
"lexik/jwt-authentication-bundle": "^2.15",
"nelmio/cors-bundle": "^2.2",
"phpdocumentor/reflection-docblock": "^5.3",
"symfony-bundles/json-request-bundle": "^4.0",
"symfony/apache-pack": "^1.0",
"symfony/asset": "6.1.*",
"symfony/console": "6.1.*",
"symfony/dotenv": "6.1.*",
"symfony/expression-language": "6.1.*",
"symfony/flex": "^2",
"symfony/form": "6.1.*",
"symfony/framework-bundle": "6.1.*",
"symfony/http-client": "6.1.*",
"symfony/mailer": "6.1.*",
"symfony/monolog-bundle": "^3.7",
"symfony/property-access": "6.1.*",
"symfony/property-info": "6.1.*",
"symfony/proxy-manager-bridge": "6.1.*",
"symfony/requirements-checker": "^2.0",
"symfony/runtime": "6.1.*",
"symfony/security-bundle": "6.1.*",
"symfony/serializer": "6.1.*",
"symfony/twig-bundle": "6.1.*",
"symfony/uid": "6.1.*",
"symfony/validator": "6.1.*",
"symfony/yaml": "6.1.*",
"twig/cssinliner-extra": "^3.3",
"twig/extra-bundle": "^3.3",
"twig/twig": "^2.12|^3.0",
"vich/uploader-bundle": "^1.19"
},
"config": {
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
},
"sort-packages": true,
"allow-plugins": {
"composer/package-versions-deprecated": true,
"symfony/flex": true,
"symfony/runtime": true
}
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php80": "*",
"symfony/polyfill-php81": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd",
"requirements-checker": "script"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "6.1.*"
}
},
"require-dev": {
"hautelook/alice-bundle": "^2.10",
"justinrainbow/json-schema": "^5.2",
"phpstan/phpstan": "^1.4",
"phpunit/phpunit": "^9.5",
"rector/rector": "^0.12.21",
"roave/security-advisories": "dev-latest",
"symfony/browser-kit": "6.1.*",
"symfony/css-selector": "6.1.*",
"symfony/debug-bundle": "6.1.*",
"symfony/maker-bundle": "^1.36",
"symfony/phpunit-bridge": "^6.1",
"symfony/stopwatch": "6.1.*",
"symfony/var-dumper": "6.1.*",
"symfony/web-profiler-bundle": "6.1.*"
}
}
Composer is up to date (composer up).
Composer recipes are all up to date.
Can't find the problem. Removed vendor folder. Same problem.
I can run the tests with the following flag:
-dxdebug.mode=debug
In this case everything works fine.
Thank you!

composer install/update trigger Class Doctrine\Common\Cache\ArrayCache does not exist

I'm using symfony5 and wanted to deploy earlier today, which failed with the following error on vendor loading with composer install or composer update :
according to this issue 'Class Doctrine\Common\Cache\ArrayCache does not exist' when installing a symfony project which worked for some the error might come from my doctrine version but as i have not updated it in the past few days I do not understand how it could
Here is my composer.json in case:
{
"type": "project",
"license": "MIT",
"require": {
"php": ">=7.4",
"ext-ctype": "*",
"ext-iconv": "*",
"ext-json": "*",
"ext-zip": "*",
"api-platform/core": "^2.5",
"beberlei/doctrineextensions": "^1.3",
"composer/package-versions-deprecated": "^1.11",
"digitick/sepa-xml": "^2.1",
"doctrine/annotations": "^1.0",
"doctrine/doctrine-bundle": "^2.1",
"doctrine/doctrine-migrations-bundle": "^3.0",
"doctrine/orm": "^2.7",
"gesdinet/jwt-refresh-token-bundle": "^0.9.1",
"giggsey/libphonenumber-for-php": "^8.12",
"guzzlehttp/guzzle": "^7.0",
"h4cc/wkhtmltopdf-amd64": "^0.12.4",
"jsor/doctrine-postgis": "^1.7",
"knplabs/knp-snappy-bundle": "^1.8",
"lcobucci/jwt": "^3.3",
"lexik/jwt-authentication-bundle": "^2.8",
"nelmio/cors-bundle": "^2.1",
"phpdocumentor/reflection-docblock": "^5.2",
"ramsey/uuid": "^4.1",
"sensio/framework-extra-bundle": "^5.6",
"stof/doctrine-extensions-bundle": "^1.5",
"stripe/stripe-php": "^7.62",
"symfony/amqp-messenger": "5.1.*",
"symfony/asset": "5.1.*",
"symfony/console": "5.1.*",
"symfony/dependency-injection": "5.1.*",
"symfony/dotenv": "5.1.*",
"symfony/expression-language": "5.1.*",
"symfony/flex": "^1.3.1",
"symfony/framework-bundle": "5.1.*",
"symfony/http-client": "5.1.*",
"symfony/mailer": "5.1.*",
"symfony/mercure-bundle": "^0.2.5",
"symfony/messenger": "5.1.*",
"symfony/monolog-bundle": "^3.6",
"symfony/property-access": "5.1.*",
"symfony/property-info": "5.1.*",
"symfony/security-bundle": "5.1.*",
"symfony/serializer": "5.1.*",
"symfony/translation": "5.1.*",
"symfony/twig-bundle": "5.1.*",
"symfony/validator": "5.1.*",
"symfony/yaml": "5.1.*",
"twig/cssinliner-extra": "^3.1",
"twig/extra-bundle": "^2.12|^3.0",
"twig/inky-extra": "^3.1",
"twig/twig": "^2.12|^3.0",
"twilio/sdk": "^6.16",
"vich/uploader-bundle": "^1.16"
},
"require-dev": {
"api-platform/schema-generator": "^2.2",
"dama/doctrine-test-bundle": "^6.4",
"doctrine/doctrine-fixtures-bundle": "^3.3",
"fzaninotto/faker": "^1.9",
"justinrainbow/json-schema": "^5.2",
"symfony/browser-kit": "^5.1",
"symfony/css-selector": "^5.1",
"symfony/debug-bundle": "^5.1",
"symfony/maker-bundle": "^1.21",
"symfony/phpunit-bridge": "^5.1",
"symfony/stopwatch": "^5.1",
"symfony/var-dumper": "^5.1",
"symfony/web-profiler-bundle": "^5.1"
},
"config": {
"optimize-autoloader": true,
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php74": "*",
"symfony/polyfill-php73": "*",
"symfony/polyfill-php72": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "5.1.*"
}
}
}
Does anyone know where this error could come from or can think of possbile leads about possible resolution as I am stuck on this problem
Thank you
Update
result of composer install -v
As you can read in an issue posted in the issue tracker of doctrine/cache, that class has been deprecated in v1 of that package, and removed in v2.
If you still want to use that class, run composer require doctrine/cache "^1.12" to install a version of that package from the v1 branch.
On the long run, you should check where your application requires that class and search for alternatives. If you need help with that, please share more details.

Composer install suddenly fails because of symfony/flex

I'm having this problem out of the blue. I didn't change anything in composer and it ran just fine up until last week. Now when I run composer install I get this at the end:
Generating autoload files
ocramius/package-versions: Generating version class...
ocramius/package-versions: ...done generating version class
[ErrorException]
Undefined index: vulnerabilities
This makes my deploys crash and now I can't release anything on staging or production.
I've removed packages one by one and managed to trace the issue back to symfony/flex. I tried updating it, but composer just freezes on a random step that means nothing to me.
I've tried removing it and running a clean composer require symfony/flex in case there was a problem with my version - it installs it then tries to update dependencies and freezes forever.
I've tried:
composer clearcache
composer self-update
composer update --no-plugins --noscripts
Nothing works. It still freezes on update and still gives me the error on install. I am nearing desperation.
This is my composer.json file:
{
"type": "project",
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": "^7.1.3",
"ext-iconv": "*",
"ext-json": "*",
"ext-intl": "*",
"beberlei/doctrineextensions": "^1.2",
"brick/math": "0.7.*",
"doctrine/doctrine-bundle": "^1.12.6",
"dompdf/dompdf": "^0.8.2",
"fervo/enum-bundle": "^2.2",
"friendsofsymfony/jsrouting-bundle": "^2.1",
"friendsofsymfony/rest-bundle": "^2.0",
"friendsofsymfony/user-bundle": "^2.1.2",
"knplabs/knp-snappy-bundle": "^1.5",
"lexik/jwt-authentication-bundle": "^2.6",
"nelmio/api-doc-bundle": "^3.6",
"phpoffice/phpword": "^0.14.0",
"predis/predis": "^1.1",
"sc0vu/web3.php": "dev-master",
"sensio/framework-extra-bundle": "^5.1",
"sg/datatablesbundle": "v1.0.4",
"simplethings/entity-audit-bundle": "^1.0",
"snc/redis-bundle": "^2.0",
"sonata-project/admin-bundle": "^3.49",
"sonata-project/doctrine-orm-admin-bundle": "^3.4",
"sonata-project/easy-extends-bundle": "^2.5",
"sonata-project/user-bundle": "^4.1",
"symfony/asset": "^4.0",
"symfony/console": "^4.0",
"symfony/debug-pack": "*",
"symfony/expression-language": "^4.0",
"symfony/flex": "v1.1",
"symfony/form": "^4.0",
"symfony/framework-bundle": "^4.0",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "^1.0",
"symfony/process": "^4.0",
"symfony/security": "^4.0",
"symfony/security-bundle": "^4.0",
"symfony/security-csrf": "^v4.0",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "^4.0",
"symfony/validator": "^4.0",
"symfony/web-link": "^4.0",
"symfony/webpack-encore-pack": "^1.0",
"symfony/yaml": "^4.0",
"twilio/sdk": "^5.0",
"web3p/ethereum-tx": "^0.3.4",
"willdurand/js-translation-bundle": "2.6.6"
},
"require-dev": {
"ext-json": "*",
"behat/symfony2-extension": "^2.1.5",
"doctrine/data-fixtures": "^1.3",
"hautelook/alice-bundle": "^2.0",
"phpmd/phpmd": "^2.6",
"phpstan/phpstan": "^0.10.6",
"squizlabs/php_codesniffer": "^3.3",
"symfony/browser-kit": "^4.0",
"symfony/css-selector": "^4.0",
"symfony/dotenv": "^4.0",
"symfony/maker-bundle": "^1.0",
"symfony/phpunit-bridge": "~4.3.0",
"symfony/profiler-pack": "*",
"zitec/behat-extension": "dev-master#dev"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": ["tests/functional", "test/unit", "tests/api"]
}
},
"replace": {
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"cache:warmup": "symfony-cmd",
"assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"id": "04C3GOB2A6BKEGTJ93E6RLD8R5",
"allow-contrib": true
}
}
}
My composer version is 1.10.22
composer update --vvv freezes after these lines:
Downloading http://repo.packagist.org/p/athletic/athletic%247c468034c468fcf26e08cb4c4e42c29c6058991f243753f391bf4be1a93476f1.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/provider-athletic$athletic.json into cache
Downloading http://repo.packagist.org/p/laminas/laminas-stdlib%243063fe25485f2f11f7dcdae0d6592d8c4740bd0e4c6fbf5fac7141542cc10d34.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/provider-laminas$laminas-stdlib.json into cache
Downloading http://repo.packagist.org/p/zendframework/zend-hydrator%24929a25c4d947fc57e2c18901b036ca54a167be6e1ac3b7a7ebc22757a91784a3.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/provider-zendframework$zend-hydrator.json into cache
Downloading http://repo.packagist.org/p/laminas/laminas-hydrator%24a55a80ba78a25b92b6156070846ea5bcd90dfa7fc7c51c707f62695d865e56ab.json
Writing /root/.composer/cache/repo/https---repo.packagist.org/provider-laminas$laminas-hydrator.json into cache
Does anyone have any clue what might be causing this or what else I could try? Lots of please and many thanks!
Had same issue with v1.1.8 of symfony/flex updated it to v1.17.2 and problem was solved.
To update it just run:
composer update symfony/flex

Error while upgrading symfony 4.3 to 4.4 (Call to a member function generate() on null)

I'm trying to update my symfony project from 4.3 to 4.4.
In my composer.json file, I changed all "symfony/" dependencies to point from 4.3. to 4.4.*. I updated all dependencies by executing form terminal:
composer.phar update --with-all-dependencies
After the update, everything looks fine. There are a couple of warnings but I don't think that's the problem. Here is the result in the terminal:
Loading composer repositories with package information
Restricting packages listed in "symfony/symfony" to "4.4.*"
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Package doctrine/reflection is abandoned, you should avoid using it. Use roave/better-reflection instead.
Package paypal/paypalhttp is abandoned, you should avoid using it. No replacement was suggested.
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
103 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Synchronizing package.json with PHP packages
Don't forget to run npm install --force or yarn install --force to refresh your JavaScript dependencies!
Run composer recipes at any time to see the status of your Symfony recipes.
Executing script cache:clear [OK]
Executing script assets:install public [OK]
The problem comes when I load any page in the browser, it shows this error for all the pages
Call to a member function generate() on null
in vendor/symfony/twig-bridge/Extension/RoutingExtension.php (line 71)
The error looks like this
I found that the error gets executed when the application access any controller and tries to show the view by calling the twig file with this line:
return $this->render('mytemplate',[]);
I thought the problem was created by a twig conflict and tried to return a random html directly from the controller to avoid calling the twig file, however the error persists:
public function testController(): Response
{
//the error happens when it executes the return
return new Response(
'<html><body>TEST</body></html>'
);
}
My composer.json file looks like this:
{
"type": "project",
"license": "proprietary",
"require": {
"php": "^7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"beelab/paypal-bundle": "v1.5.0",
"paypal/paypal-checkout-sdk": "1.0.1",
"curl/curl": "2.2.0",
"doctrine/doctrine-bundle": "2.3",
"doctrine/doctrine-migrations-bundle": "3.0.2",
"doctrine/orm": "^2.5.11",
"friendsofsymfony/rest-bundle": "2.6.0",
"php-http/guzzle6-adapter": "^2.0",
"phpoffice/phpspreadsheet": "^1.11",
"sensio/framework-extra-bundle": "v5.5.1",
"sonata-project/admin-bundle": "3.93",
"sonata-project/doctrine-orm-admin-bundle": "3.31",
"stof/doctrine-extensions-bundle": "v1.3.0",
"stripe/stripe-php": "v7.14.2",
"symfony/apache-pack": "^1.0",
"symfony/asset": "4.4.*",
"symfony/console": "4.4.*",
"symfony/dotenv": "4.4.*",
"symfony/expression-language": "4.4.*",
"symfony/flex": "v1.12",
"symfony/form": "4.4.*",
"symfony/framework-bundle": "4.4.*",
"symfony/http-client": "4.4.*",
"symfony/intl": "4.4.*",
"symfony/monolog-bundle": "v3.5.0",
"symfony/process": "4.4.*",
"symfony/security-bundle": "4.4.*",
"symfony/serializer-pack": "v1.0.2",
"symfony/swiftmailer-bundle": "v3.4.0",
"symfony/templating": "4.4.*",
"symfony/translation": "4.4.*",
"symfony/twig-bundle": "4.4.*",
"symfony/twig-bridge": "4.4.*",
"symfony/validator": "4.4.*",
"symfony/web-link": "4.4.*",
"symfony/webpack-encore-bundle": "v1.7.2",
"symfony/yaml": "4.4.*",
"symfony/doctrine-bridge": "4.4.*",
"symfony/profiler-pack": "v1.0.5",
"symfony/web-profiler-bundle": "4.4.*"
},
"require-dev": {
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.11",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/web-server-bundle": "4.4.*"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/",
"Sim\\": "lib/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"paragonie/random_compat": "2.*",
"symfony/polyfill-ctype": "*",
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": false,
"require": "4.4.*"
}
}
}

Imports are highlighted like the packages do not exist (Symfony 4)

I'm working on a Symfony 4 project with PhpStorm 2018.1
It has become common for me to see the use declarations highlighted as if they haven't been installed with composer.
The class belongs to a package which is not directly required in your
composer.json. Please add the package into your composer.json.
The following are installed and show in my composer.json file:
stof/doctrine-extensions-bundle
symfony/orm-pack
Am I missing something here or is this a PhpStorm issue?
composer.json
{
"type": "project",
"license": "proprietary",
"platform": {
"php": "7.1"
},
"require": {
"php": "^7.1",
"ext-iconv": "*",
"sensio/framework-extra-bundle": "^5.1",
"stof/doctrine-extensions-bundle": "^1.3",
"symfony/asset": "^4.1",
"symfony/console": "^4.1",
"symfony/expression-language": "^4.1",
"symfony/flex": "^1.0",
"symfony/form": "^4.1",
"symfony/framework-bundle": "^4.1",
"symfony/lts": "^4#dev",
"symfony/maker-bundle": "^1.5",
"symfony/monolog-bundle": "^3.3",
"symfony/orm-pack": "^1.0",
"symfony/process": "^4.1",
"symfony/profiler-pack": "^1.0",
"symfony/security-bundle": "^4.1",
"symfony/security-guard": "^4.1",
"symfony/serializer-pack": "*",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/twig-bundle": "^4.1",
"symfony/validator": "^4.1",
"symfony/var-dumper": "^4.1",
"symfony/web-link": "^4.1",
"symfony/webpack-encore-pack": "^1.0",
"symfony/yaml": "^4.1"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"symfony/debug-pack": "*",
"symfony/dotenv": "^4.1",
"symfony/test-pack": "^1.0",
"symfony/web-server-bundle": "^4.1"
},
"config": {
"preferred-install": {
"*": "dist"
},
"sort-packages": true
},
"autoload": {
"psr-4": {
"App\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"App\\Tests\\": "tests/"
}
},
"replace": {
"symfony/polyfill-iconv": "*",
"symfony/polyfill-php71": "*",
"symfony/polyfill-php70": "*",
"symfony/polyfill-php56": "*"
},
"scripts": {
"auto-scripts": {
"cache:clear": "symfony-cmd",
"assets:install %PUBLIC_DIR%": "symfony-cmd"
},
"post-install-cmd": [
"#auto-scripts"
],
"post-update-cmd": [
"#auto-scripts"
]
},
"conflict": {
"symfony/symfony": "*"
},
"extra": {
"symfony": {
"allow-contrib": true
}
}
}
What this message is telling you is that the highlighted classes are only available because the packages containing them have been installed as dependencies of some other packages you require (in this case it's probably because of the symfony/orm-pack package). Generally, relying on such transitive dependencies is not something I would do. Though for the Symfony pack that's something acceptable IMO.
If you are still concerned about this message, you can get rid of it by unpacking symfony/orm-pack (see also http://fabien.potencier.org/symfony4-unpack-the-packs.html):
$ composer unpack symfony/orm-pack
Your import path is correct, your composer.json looks good also.
Try to delete the vendor directory then try to launch composer install.
Try to install Symfony Plugin in your PHPStorm.
EDIT
Do you have the line below in your config/bundles.php ?
Doctrine\Bundle\DoctrineBundle\DoctrineBundle::class => ['all' => true],

Resources