From 16d46f701c6d276f71f869e3a504b0c278b73f5b Mon Sep 17 00:00:00 2001 From: Chris Smith <chris@cs278.org> Date: Tue, 17 Nov 2020 23:07:18 +0000 Subject: [PATCH] Prevent class redeclaration errors --- src/ComposerPlugin.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ComposerPlugin.php b/src/ComposerPlugin.php index 3acb623..1048abc 100644 --- a/src/ComposerPlugin.php +++ b/src/ComposerPlugin.php @@ -2,8 +2,10 @@ namespace Cs278\ComposerAudit; -if (\PHP_VERSION_ID >= 70100) { - require __DIR__.'/ComposerPlugin.real.php'; -} else { - require __DIR__.'/ComposerPlugin.fake.php'; +if (!class_exists(__NAMESPACE__.'\\ComposerPlugin', false)) { + if (\PHP_VERSION_ID >= 70100) { + require __DIR__.'/ComposerPlugin.real.php'; + } else { + require __DIR__.'/ComposerPlugin.fake.php'; + } }