Behatch / contexts

Behat extension with most custom helper steps
Other
394 stars 203 forks source link

Prefer reflection method getType as getClass deprected as of PHP 8.0 #297

Open webdevel opened 3 years ago

webdevel commented 3 years ago

Please consider releasing this quick patch supporting PHP upgrade. Thank you.

ReflectionParameter::getClass

Warning This function has been DEPRECATED as of PHP 8.0.0. Relying on this function is highly discouraged.

https://www.php.net/manual/en/reflectionparameter.getclass.php https://www.php.net/manual/en/reflectionparameter.gettype.php

silverbackdan commented 3 years ago

Thanks for this, unfortunately your fork still results in my tests failing. I may try a PR as well to resolve this.

silverbackdan commented 3 years ago

Just created a new PR @webdevel - hopefully it would also work for you, but I imagine this fix already did the job for you. At least in my tests it has stopped the getClass method from ever being called if getType is available and has extracted this logic into a new method. https://github.com/Behatch/contexts/pull/298