-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[TASK] Add static code analyser
PHPStan
as code quality check (#262)
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 ```terminal Build/Scripts/runTests.sh -s phpstan ``` Generate baseline with ```terminal Build/Scripts/runTests.sh -s phpstanBaseline ```
- Loading branch information
Showing
9 changed files
with
65 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
message: "#^Access to an undefined property T3docs\\\\Examples\\\\Xclass\\\\NewRecordController\\:\\:\\$content\\.$#" | ||
count: 1 | ||
path: ../../Classes/Xclass/NewRecordController.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the TYPO3 CMS project. | ||
* | ||
* It is free software; you can redistribute it and/or modify it under | ||
* the terms of the GNU General Public License, either version 2 | ||
* of the License, or any later version. | ||
* | ||
* For the full copyright and license information, please read the | ||
* LICENSE.txt file that was distributed with this source code. | ||
* | ||
* The TYPO3 project - inspiring people to share! | ||
*/ | ||
|
||
defined('LF') ?: define('LF', chr(10)); | ||
defined('CR') ?: define('CR', chr(13)); | ||
defined('CRLF') ?: define('CRLF', CR . LF); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
includes: | ||
- phpstan-baseline.neon | ||
|
||
parameters: | ||
phpVersion: 80200 | ||
level: 1 | ||
|
||
bootstrapFiles: | ||
- phpstan-typo3-constants.php | ||
|
||
paths: | ||
- ../../Classes | ||
- ../../Configuration | ||
|
||
inferPrivatePropertyTypeFromConstructor: true | ||
treatPhpDocTypesAsCertain: false | ||
|
||
# Use local cache dir instead of /tmp | ||
tmpDir: ../../.Build/cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,10 @@ | |
* This class XCLASSes NewRecordController to modify the layout of the New Record Wizard | ||
* | ||
* @author Francois Suter <[email protected]> | ||
* | ||
* @todo This example is broken and should be removed or fixed. Parent controller changes, most likely already for | ||
* TYPO3 v12. Property `$this->content` does no longer exists, and therefore the example does not demonstrate | ||
* anything working or useful - and will throw E_DEPRECATION with PHP 8.3 and corresponding error level. | ||
*/ | ||
class NewRecordController extends \TYPO3\CMS\Backend\Controller\NewRecordController | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters