TYPO3-Documentation / t3docs-examples

This extension packages a number of code examples from the Core Documentation.
GNU General Public License v2.0
23 stars 17 forks source link

[TASK] Add static code analyser `PHPStan` as code quality check #262

Closed linawolf closed 4 months ago

linawolf commented 4 months ago

The TYPO3 Core and the Best Practice Team recommends to have a static code analyzer in the defense line, and preferes PHPStan due to experience with that tool.

This change now adds the static code analyser PHPStan with a first configurattion and a lower level as a start. Levels can be raised step by step in follow-ups.

Note: XClass Classes/Xclass/NewRecordController.php example does not work anymore, most likely since v12. Added a comment to emphasize this, and that it should be reworked or removed.

PHPStan can be run with

Build/Scripts/runTests.sh -s phpstan

Generate baseline with

Build/Scripts/runTests.sh -s phpstanBaseline

Depends on #261

linawolf commented 4 months ago

As you can read in the description this Depends on https://github.com/TYPO3-Documentation/t3docs-examples/pull/261

brotkrueml commented 4 months ago

Then please, set it as draft.

linawolf commented 4 months ago

This branch is based on the one from #261 but contains a totally separated commit (https://github.com/TYPO3-Documentation/t3docs-examples/pull/262/commits/05fe7aca71765077bde6d1bdf78e3c7116e3fe9f) which can, if someone wants be reviewed independently. The descitsion is however up to the reviewer.

brotkrueml commented 4 months ago

This branch is based on the one from #261 but contains a totally separated commit (05fe7ac) which can, if someone wants be reviewed independently. The descitsion is however up to the reviewer.

Okay, then I am out. I am just looking at the "Files changed" and not on separate commits.

linawolf commented 4 months ago

It is absolutely your right to decide like this