From b1150859a60711957230c7fba39c27d248d3216d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech>
Date: Thu, 23 Nov 2023 13:30:39 +0100
Subject: [PATCH] [BUGFIX] Use correct `Configuration` ignore in namespace
 integrity check

The php namespace integrity check uses a symfony
finder to determine which files should be checked.
The used pattern to ignore extension configuration
folder `Configuration` excluded every file,  which
has `Configuration` in the path or filename.

This change avoids using the nifty magic `exclude()`
finder method and replace it with a more reliable
`notPath()` configuration.

Resolves: #102483
Releases: main, 12.4, 11.5
Change-Id: Ic0ae6eaae736b86412f8a430f11ea5b0a8e9dca9
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/81925
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 Build/Scripts/checkNamespaceIntegrity.php | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/Build/Scripts/checkNamespaceIntegrity.php b/Build/Scripts/checkNamespaceIntegrity.php
index 0cea25112165..03612987db7b 100755
--- a/Build/Scripts/checkNamespaceIntegrity.php
+++ b/Build/Scripts/checkNamespaceIntegrity.php
@@ -129,7 +129,7 @@ class CheckNamespaceIntegrity
         } elseif (str_starts_with($relativeFilename, 'Tests/')) {
             $namespace = $this->getExtensionTestsNamespaces($systemExtensionKey, $relativeFilename);
         }
-        $ignorePartValues= ['Classes', 'Tests'];
+        $ignorePartValues = ['Classes', 'Tests'];
         if ($namespace !== '') {
             $parts = explode('/', $relativeFilename);
             if (in_array($parts[0], $ignorePartValues, true)) {
@@ -173,7 +173,7 @@ class CheckNamespaceIntegrity
         string $systemExtensionKey,
         string $fullComposerJsonFilePath,
         string $relativeFileName,
-        bool $autoloadDev=false
+        bool $autoloadDev = false
     ): string {
         $autoloadKey = 'autoload';
         if ($autoloadDev) {
@@ -223,6 +223,8 @@ class CheckNamespaceIntegrity
             )
             ->notPath([
                 'typo3/sysext/core/Tests/Acceptance/Support/_generated',
+                // exclude some files not providing classes, so no namespace information is available
+                'typo3/sysext/*/Configuration',
             ])
             // @todo remove fixture extensions exclude and handle properly after fixture extensions has been streamlined
             ->notPath([
@@ -233,6 +235,9 @@ class CheckNamespaceIntegrity
                 'Core/Fixtures/test_extension',
                 'Fixtures/testclasses',
             ])
+            ->notName('ext_emconf.php')
+            // this test extension tests missing autoload infos, so of course it will break the integrity check
+            ->exclude('Core/Fixtures/test_extension')
             ->name('*.php')
             ->sortByName();
     }
-- 
GitLab