Skip to content

[TASK] Split PHPStan CI jobs#2050

Open
Starkmann wants to merge 19 commits into
mainfrom
feature/1827-split-phpstan-jobs
Open

[TASK] Split PHPStan CI jobs#2050
Starkmann wants to merge 19 commits into
mainfrom
feature/1827-split-phpstan-jobs

Conversation

@Starkmann
Copy link
Copy Markdown
Contributor

Resolves: #1827

…mposer command to native phpstan command

Related: #1827
@Starkmann Starkmann force-pushed the feature/1827-split-phpstan-jobs branch from a0a3866 to 01e9270 Compare March 28, 2026 11:42
@oliverklee oliverklee moved this to In Progress in Best Practices code sprint Mar 28, 2026
@oliverklee oliverklee changed the title Split phpstan jobs [TASK] Split PHPStan CI jobs Mar 28, 2026
@coveralls
Copy link
Copy Markdown

coveralls commented Mar 28, 2026

Coverage Report for CI Build 26807031978

Coverage remained the same at 92.089%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 316
Covered Lines: 291
Line Coverage: 92.09%
Coverage Strength: 3.79 hits per line

💛 - Coveralls

Comment thread Build/phpstan/TYPO3_13.4/phpstan.neon Outdated
Comment thread Build/phpstan/TYPO3_13.4/phpstan.neon
@oliverklee oliverklee moved this from In Progress to In Review in Best Practices code sprint Jun 1, 2026
@oliverklee oliverklee requested a review from a team June 1, 2026 14:28
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml
Comment thread Build/Scripts/runTests.sh
@github-project-automation github-project-automation Bot moved this from In Review to In Progress in Best Practices code sprint Jun 1, 2026
@Starkmann Starkmann requested a review from oliverklee June 1, 2026 17:20
@oliverklee oliverklee moved this from In Progress to In Review in Best Practices code sprint Jun 4, 2026
Copy link
Copy Markdown
Contributor

@oliverklee oliverklee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run this for TYPO3 13LTS, checking the code with PHPStan works fine.

When I run it with TYPO3 12LTS, I get errors, though:


klee@gonzales ~/src/typo3/ext/tea (feature/1827-split-phpstan-jobs)$ ./Build/Scripts/runTests.sh -t 12.4 -s phpstan
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   Classes/Domain/Repository/TeaRepository.php                                                                                                                                       
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  24     Method TTN\Tea\Domain\Repository\TeaRepository::findByOwnerUid() return type with generic interface TYPO3\CMS\Extbase\Persistence\QueryResultInterface does not specify its       
         types: TKey, TValue                                                                                                                                                               
         🪪  missingType.generics                                                                                                                                                          
  36     Method TTN\Tea\Domain\Repository\TeaRepository::findAllFromAllPages() return type with generic interface TYPO3\CMS\Extbase\Persistence\QueryResultInterface does not specify its  
         types: TKey, TValue                                                                                                                                                               
         🪪  missingType.generics                                                                                                                                                          
 ------ ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------ 
  Line   Tests/Functional/Controller/BackendModuleControllerTest.php                                                                   
 ------ ------------------------------------------------------------------------------------------------------------------------------ 
         Ignored error pattern #^Call to method hmac\(\) on an unknown class TYPO3\\CMS\\Core\\Crypto\\HashService\.$# in path         
         /home/klee/src/typo3/ext/tea/Tests/Functional/Controller/BackendModuleControllerTest.php was not matched in reported errors.  
         🪪  ignore.unmatched (non-ignorable)                                                                                          
         Ignored error pattern #^Class TYPO3\\CMS\\Core\\Crypto\\HashService not found\.$# in path                                     
         /home/klee/src/typo3/ext/tea/Tests/Functional/Controller/BackendModuleControllerTest.php was not matched in reported errors.  
         🪪  ignore.unmatched (non-ignorable)                                                                                          
 ------ ------------------------------------------------------------------------------------------------------------------------------ 

                                                                                                                        
 [ERROR] Found 4 errors                                                                                                 
                                                                                                                        

Comment thread .github/workflows/ci.yml
- name: Cache dependencies installed with composer
uses: actions/cache@v5
with:
key: "php-${{ matrix.php-version }}-typo3-${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-${{ hashFiles('**/composer.json') }}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to have the Max dependencies in the CI matrix so the cache keys are correct.

Comment thread .github/workflows/ci.yml
restore-keys: "php-${{ matrix.php-version }}-typo3-${{ matrix.typo3-version }}-${{ matrix.composer-dependencies }}-composer-\n"
- name: Install composer dependencies
run: |
./Build/Scripts/runTests.sh -p ${{ matrix.php-version }} -t ${{matrix.typo3-version}} -s composerUpdateMax
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

… and use ${{ matrix.composer-dependencies }} here. (We should copy this from the other jobs so they are identical and easier to maintain.)

Comment thread Build/Scripts/runTests.sh
COMMAND=(php -dxdebug.mode=off .Build/bin/phpstan analyse -c ${PHPSTAN_CONFIG_FILE} --no-progress --no-interaction --memory-limit 4G "$@")
${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name phpstan-${SUFFIX} -e COMPOSER_CACHE_DIR=.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} "${COMMAND[@]}"
}
phpstanGenerateBaseline() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a blank line above this line so the scripts are separated.

Comment thread Build/Scripts/runTests.sh
;;
phpstan)
phpstan
phpstan "$@"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to pass the parameters here and in the other function?

Comment thread composer.json
"check:php:cs-fixer": "php-cs-fixer fix --config ./Build/php-cs-fixer/config.php -v --dry-run --diff",
"check:php:lint": "parallel-lint *.php Build Classes Configuration Tests",
"check:php:rector": "rector process --dry-run --config=./Build/rector/config.php",
"check:php:stan": "phpstan --no-progress -v --configuration=Build/phpstan/phpstan.neon",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to update the documentation that mentions this script.

@github-project-automation github-project-automation Bot moved this from In Review to In Progress in Best Practices code sprint Jun 4, 2026
@oliverklee
Copy link
Copy Markdown
Contributor

When I run it with TYPO3 12LTS, I get errors, though:

Scratch that - I had forgotten to install the 12LTS packages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Split the PHPStan jobs

4 participants