From 4f7fccd93eda65b4e9af097484b3661872c0e35c Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Wed, 8 Apr 2026 08:34:44 +0200 Subject: [PATCH] Scripts: add instanceof syntax for import linter --- Scripts/class-import.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Scripts/class-import.sh b/Scripts/class-import.sh index d8365f6892..4069114a22 100755 --- a/Scripts/class-import.sh +++ b/Scripts/class-import.sh @@ -34,7 +34,10 @@ fi for FILE in $(find src -name "*.php"); do for IMPORT in $(grep -iE 'use [a-z0-9_\\]+\\[^;\\]+;' ${FILE} | awk '{ print $2 }' | tr -d ';'); do CLASS=${IMPORT##*\\} - if [ "$(grep -c -e "new ${CLASS}" -e "${CLASS}::" -e "extends ${CLASS}" ${FILE})" = "0" ]; then + if [ "$(grep -c -e "instanceof ${CLASS}" \ + -e "new ${CLASS}" \ + -e "${CLASS}::" \ + -e "extends ${CLASS}" ${FILE})" = "0" ]; then echo "${FILE}: warning: stale import \`${IMPORT}'" fi done