MinkExtension
MinkExtension copied to clipboard
Better DX error handling when misuse of SymfonyExtension config
Issue
As a dummy symfony user, when I don't use the MinkExtension
correctly with the following config
# behat.yml.dist
...
extensions:
Behat\MinkExtension: ~ # <---- empty invalid config
we have the following PHP fatal error :
PHP Fatal error: Uncaught TypeError: array_key_exists():
Argument #2 ($array) must be of type array, null given in MinkExtension.php:120
Reproduce
composer create-project symfony/symfony-demo mink-reproduce-bug
cd ./mink-reproduce-bug
composer require --dev behat/behat friends-of-behat/symfony-extension friends-of-behat/mink-extension
echo " Behat\MinkExtension: ~" >> behat.yml.dist
vendor/bin/behat
Solution
Checking that the config is an array, so we get this error instead :