Skip to content

Commit

Permalink
[TASK] Introduce PHPStan for level 1
Browse files Browse the repository at this point in the history
Levels can be raised step by step in follow-ups

We need to get rid of the outdated XClass extension, but don't have a replacement yet, that is why I left it in for now.

run with
Build/Scripts/runTests.sh -s phpstan

Generate baseline with
Build/Scripts/runTests.sh -s phpstanBaseline
  • Loading branch information
linawolf committed May 4, 2024
1 parent 57e13fc commit d35d62c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,9 @@ case ${TEST_SUITE} in
;;
rector)
if [ "${CGLCHECK_DRY_RUN}" -eq 1 ]; then
COMMAND=(php -dxdebug.mode=off .Build/bin/rector -n --clear-cache "$@")
COMMAND=(php -dxdebug.mode=off .Build/bin/rector -n --config=Build/rector/rector.php --clear-cache "$@")
else
COMMAND=(php -dxdebug.mode=off .Build/bin/rector --clear-cache "$@")
COMMAND=(php -dxdebug.mode=off .Build/bin/rector --config=Build/rector/rector.php --clear-cache "$@")
fi
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name rector-${SUFFIX} -e COMPOSER_CACHE_DIR=.Build/.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} "${COMMAND[@]}"
SUITE_EXIT_CODE=$?
Expand Down
8 changes: 4 additions & 4 deletions rector.php → Build/rector/rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@

return RectorConfig::configure()
->withPaths([
__DIR__ . '/.',
__DIR__ . '/../../.',
])
->withImportNames(true, true, false, true)
->withImportNames(importShortClasses: false, removeUnusedImports: true)
->withPhpSets()
->withAutoloadPaths([
__DIR__ . '/.Build/vendor/autoload.php',
__DIR__ . '/../../.Build/vendor/autoload.php',
])
->withSets([
Typo3SetList::CODE_QUALITY,
Expand All @@ -58,6 +58,6 @@
ReturnNeverTypeRector::class => [
// We want to keep the ResponseInterface return type of indexAction() to be compatible
// with the specification, although we just throw an exception for demonstration purpose.
__DIR__ . '/Classes/Controller/ErrorController.php',
__DIR__ . '/../../Classes/Controller/ErrorController.php',
],
]);

0 comments on commit d35d62c

Please sign in to comment.