There's a plugin for IntelliJ IDEs called "PHP Inspections (EA Extended)" [0] that detects some of these compatibility and security problems.
[0]: https://plugins.jetbrains.com/plugin/7622-php-inspections-ea...
[0]: https://plugins.jetbrains.com/plugin/7622-php-inspections-ea...
I was thinking that they could do analysis on code snippets that are copy-pasted into the editor. It should be straight-forward to compare the contents to a finger-print database and issue a warning when they find a match to online code examples that are marked as vulnerable.