This is what I get whenever I try to migrate but just yesterday it was running until I get an error. I think I updated something thats why the version dont match with laravel
Can anyone help me?
`PS C:xampphtdocsmamjbproject> php artisan migrate
Migrating: 2024_01_16_100459_remove_default_value_from_detail_column_in_products_table
PHP Fatal error: Declaration of IlluminateDatabasePDOConcernsConnectsToDatabase::connect(array $params) must be compatible with DoctrineDBALDriver::connect(array $params): DoctrineDBALDriverConnection in C:xampphtdocsmamjbprojectvendorlaravelframeworksrcIlluminateDatabasePDOConcernsConnectsToDatabase.php on line 19
SymfonyComponentErrorHandlerErrorFatalError
Declaration of IlluminateDatabasePDOConcernsConnectsToDatabase::connect(array $params) must be compatible with DoctrineDBALDriver::connect(array $params): DoctrineDBALDriverConnection
at C:xampphtdocsmamjbprojectvendorlaravelframeworksrcIlluminateDatabasePDOConcernsConnectsToDatabase.php:19
15▕ * @return IlluminateDatabasePDOConnection
16▕ *
17▕ * @throws InvalidArgumentException
18▕ */
➜ 19▕ public function connect(array $params)
20▕ {
21▕ if (! isset($params[‘pdo’]) || ! $params[‘pdo’] instanceof PDO) {
22▕ throw new InvalidArgumentException(‘Laravel requires the "pdo" property to be set and be a PDO instance.’);
23▕ }
WhoopsExceptionErrorException
Declaration of IlluminateDatabasePDOConcernsConnectsToDatabase::connect(array $params) must be compatible with DoctrineDBALDriver::connect(array $params): DoctrineDBALDriverConnection
at C:xampphtdocsmamjbprojectvendorlaravelframeworksrcIlluminateDatabasePDOConcernsConnectsToDatabase.php:19
15▕ * @return IlluminateDatabasePDOConnection
16▕ *
17▕ * @throws InvalidArgumentException
18▕ */
➜ 19▕ public function connect(array $params)
20▕ {
21▕ if (! isset($params[‘pdo’]) || ! $params[‘pdo’] instanceof PDO) {
22▕ throw new InvalidArgumentException(‘Laravel requires the "pdo" property to be set and be a PDO instance.’);
23▕ }
1 C:xampphtdocsmamjbprojectvendorfilpwhoopssrcWhoopsRun.php:510
WhoopsRun::handleError("Declaration of IlluminateDatabasePDOConcernsConnectsToDatabase::connect(array $params) must be compatible with DoctrineDBALDriver::connect(array $params): DoctrineDBALDriverConnection", "C:xampphtdocsmamjbprojectvendorlaravelframeworksrcIlluminateDatabasePDOConcernsConnectsToDatabase.php")
2 [internal]:0
WhoopsRun::handleShutdown()`
PS. I was trying to make simple crud inventory system
I tried to update composer, update the Doctrine DBAL package, clear config cache, and try migrating again and again.
2
Answers
Update the doctorine dbal from your composer.json
update it to v3 it will be solved.
Use the required version for that and update your dependencies
composer require doctrine/dbal:<desired_version>