Install composer package cweagans/composer-patches

Now you search for the bug in the code and fix it directly. When finished and everything is working open local history in PhpStorm for this file (right click > Local History > Show History). Select the change you just made and choose "Create Patch" in context menu. Save it to a folder like "patches" in your project.

Add the path to your patch file in composer.json and do a composer update.

"extra": {
	"patches": {
        "package/tofix": {
            "Short description what you did": "patches/yourpatch.patch"