InvalidArgumentException: "\string$filter" 不是 $objectManager->get() 的有效 Fqsen

InvalidArgumentException: "\string$filter" is not a valid Fqsen with $objectManager->get()

运行 使用 TYPO3 10.2 的 TYPO3 爬虫的单元测试

TYPO3_PATH_WEB=$PWD/.Build/Web typo3DatabaseName=crawler typo3DatabaseHost=127.0.0.1 typo3DatabaseUsername=root typo3DatabasePassword=root .Build/bin/phpunit -c .Build/vendor/nimut/testing-framework/res/Configuration/FunctionalTests.xml Tests/Functional --filter canCreateQueueEntriesUsingConfigurationRecord

我收到以下错误,请参见下文。

如果我改变https://github.com/AOEpeople/crawler/blob/typo3v9/Classes/Api/CrawlerApi.php#L76 GeneralUtility::makeInstance() 有效,但 $objectManager->get() 无效。

我知道可以完全删除该行,只是想了解这里的问题所在。我没有发现任何逻辑。

要亲自尝试,您可以将 composer.json 中的 require-dev 部分调整为

    "require-dev": {
        "nimut/testing-framework": "^4.1 || dev-master",
        "nimut/typo3-complete": "^9.5 || ^10.2",
        "phpstan/phpstan": "^0.11.19",
        "rector/rector": "^0.6",
        "symplify/easy-coding-standard": "^7.0"
    },

错误

There was 1 error:

1) AOE\Crawler\Tests\Functional\Api\CrawlerApiTest::canCreateQueueEntriesUsingConfigurationRecord
InvalidArgumentException: "\string$filter" is not a valid Fqsen!.

/path/to/extension/crawler/.Build/vendor/phpdocumentor/reflection-common/src/Fqsen.php:48
/path/to/extension/crawler/.Build/vendor/phpdocumentor/type-resolver/src/FqsenResolver.php:70
/path/to/extension/crawler/.Build/vendor/phpdocumentor/type-resolver/src/FqsenResolver.php:32
/path/to/extension/crawler/.Build/vendor/phpdocumentor/type-resolver/src/TypeResolver.php:264
/path/to/extension/crawler/.Build/vendor/phpdocumentor/type-resolver/src/TypeResolver.php:118
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Reflection/ClassSchema.php:401
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Reflection/ClassSchema.php:185
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Reflection/ReflectionService.php:112
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Reflection/ReflectionService.php:99
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/Container/Container.php:158
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/Container/Container.php:110
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/ObjectManager.php:126
/path/to/extension/crawler/Classes/Api/CrawlerApi.php:76
/path/to/extension/crawler/.Build/Web/typo3/sysext/core/Classes/Utility/GeneralUtility.php:3461
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/Container/Container.php:193
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/Container/Container.php:166
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/Container/Container.php:110
/path/to/extension/crawler/.Build/Web/typo3/sysext/extbase/Classes/Object/ObjectManager.php:126
/path/to/extension/crawler/Tests/Functional/Api/CrawlerApiTest.php:116

问题最有可能出现在 CrawelerControllerObjectManager 分析应该创建的 class 和所有依赖的 classes.

在这种情况下,文档块中存在格式错误: https://github.com/AOEpeople/crawler/blob/typo3v9/Classes/Controller/CrawlerController.php#L940

/**
 * Return array of records from crawler queue for input page ID
 *
 * @param integer $id Page ID for which to look up log entries.
 * @param string$filter Filter: "all" => all entries, "pending" => all that is not yet run, "finished" => all complete ones
 * @param boolean $doFlush If TRUE, then entries selected at DELETED(!) instead of selected!
 * @param boolean $doFullFlush
 * @param integer $itemsPerPage Limit the amount of entries per page default is 10
 * @return array
 */
public function getLogEntriesForPageId($id, $filter = '', $doFlush = false, $doFullFlush = false, $itemsPerPage = 10)

string$filter

之间少了一个space