Commit 6f136584 authored by Alexander Schnitzler's avatar Alexander Schnitzler Committed by Daniel Goerz
Browse files

[TASK] Ignore phpstan errors to achieve level 0 compatibility

This patch ignores several errors found by phpstan which are
not easy to solve as of now or which are not solvable at all.

- Unsafe usage of new static

  Those errors can be solved in different ways. Making classes
  final, making constructors final or using new self. Which
  solution is used has to be decided by people who are familiar
  which the affected files.

- Call to an undefined method in AbstractWidgetViewHelper and
  AbstractViewHelper

  Those issues aren't solvable as those methods exist if users
  choose fluid ^3.

- Access to undefined constant TYPO3\CMS\Core\Type\Enumeration
  ::__default

  This issue can't be solved as the Enumeration class does a
  lot of magic stuff which isn't compatible with static code
  analysis.

Releases: master
Resolves: #90402
Change-Id: Ie4a1623d42cb37d30082275ca1a09a733301d06e
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63276


Reviewed-by: Mathias Brodala's avatarMathias Brodala <mbrodala@pagemachine.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
Reviewed-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Daniel Goerz's avatarDaniel Goerz <daniel.goerz@posteo.de>
Tested-by: Susanne Moog's avatarSusanne Moog <look@susi.dev>
parent e837e5c7
......@@ -23,8 +23,38 @@ parameters:
message: '#Parameter \$event of method [\w\\]+::\w+\(\) has invalid typehint type Composer\\Script\\Event\.#'
path: %currentWorkingDirectory%/typo3/sysext/*/Classes/Composer/*
-
message: '#Access to undefined constant PDO::PGSQL_.+#'
path: %currentWorkingDirectory%/typo3/sysext/core/Classes/Database/Driver/PDOPgSql/Driver.php
message: "#^Access to undefined constant PDO\\:\\:SQLSRV_ENCODING_BINARY\\.$#"
count: 1
path: typo3/sysext/core/Classes/Database/Driver/PDOSqlsrv/Statement.php
-
message: '#Access to undefined constant PDO::SQLSRV_.+#'
path: %currentWorkingDirectory%/typo3/sysext/core/Classes/Database/Driver/PDOSqlsrv/Statement.php
message: "#^Access to undefined constant TYPO3\\\\CMS\\\\Core\\\\Type\\\\Enumeration\\:\\:__default\\.$#"
count: 1
path: typo3/sysext/core/Classes/Type/Enumeration.php
-
message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Fluid\\\\Core\\\\Widget\\\\AbstractWidgetViewHelper\\:\\:getArguments\\(\\)\\.$#"
count: 1
path: typo3/sysext/fluid/Classes/Core/Widget/AbstractWidgetViewHelper.php
-
message: "#^Call to an undefined static method TYPO3Fluid\\\\Fluid\\\\Core\\\\ViewHelper\\\\AbstractViewHelper\\:\\:onClose\\(\\)\\.$#"
count: 1
path: typo3/sysext/fluid/Classes/Core/Widget/AbstractWidgetViewHelper.php
-
message: "#^Call to an undefined method TYPO3\\\\CMS\\\\Fluid\\\\Core\\\\Widget\\\\AbstractWidgetViewHelper\\:\\:getChildren\\(\\)\\.$#"
count: 1
path: typo3/sysext/fluid/Classes/Core/Widget/AbstractWidgetViewHelper.php
-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: typo3/sysext/core/Classes/Collection/AbstractRecordCollection.php
-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: typo3/sysext/core/Classes/Type/Enumeration.php
-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: typo3/sysext/form/Classes/Mvc/Property/Exception/TypeConverterException.php
-
message: "#^Unsafe usage of new static\\(\\)\\.$#"
count: 1
path: typo3/sysext/workspaces/Classes/Domain/Record/WorkspaceRecord.php
......@@ -341,6 +341,8 @@ abstract class AbstractRecordCollection implements RecordCollectionInterface, Pe
*/
public static function create(array $collectionRecord, $fillItems = false)
{
// [phpstan] Unsafe usage of new static()
// todo: Either mark this class or its constructor final or use new self instead.
$collection = new static();
$collection->fromArray($collectionRecord);
if ($fillItems) {
......
......@@ -28,6 +28,8 @@ class TypeConverterException extends \TYPO3\CMS\Extbase\Property\Exception\TypeC
public static function fromError(Error $error): TypeConverterException
{
// [phpstan] Unsafe usage of new static()
// todo: Either mark this class or its constructor final or use new self instead.
$exception = new static($error->getMessage(), $error->getCode());
$exception->error = $error;
......
......@@ -76,6 +76,8 @@ class WorkspaceRecord extends AbstractRecord
} elseif (empty($record)) {
$record = static::fetch('sys_workspace', $uid);
}
// [phpstan] Unsafe usage of new static()
// todo: Either mark this class or its constructor final or use new self instead.
return new static($record);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment