ソースを参照

Set PHPStan to level 8 now using baseline.

mscherer 3 年 前
コミット
851cbeedfe
3 ファイル変更74 行追加1 行削除
  1. 3 0
      README.md
  2. 70 0
      phpstan-baseline.neon
  3. 1 1
      phpstan.neon.dist

+ 3 - 0
README.md

@@ -10,6 +10,9 @@
     <a href="https://codecov.io/gh/cakephp/cakephp/branch/4.x" target="_blank">
         <img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/cakephp/cakephp?style=flat-square">
     </a>
+    <a href="https://phpstan.org/" target="_blank">
+        <img alt="PHPStan" src="https://img.shields.io/badge/PHPStan-level%208-brightgreen.svg?style=flat">
+    </a>
     <a href="https://squizlabs.github.io/PHP_CodeSniffer/analysis/cakephp/cakephp/" target="_blank">
         <img alt="Code Consistency" src="https://squizlabs.github.io/PHP_CodeSniffer/analysis/cakephp/cakephp/grade.svg">
     </a>

+ 70 - 0
phpstan-baseline.neon

@@ -21,6 +21,11 @@ parameters:
 			path: src/Database/Expression/QueryExpression.php
 
 		-
+			message: "#^Offset 'type' does not exist on array\\<string, mixed\\>\\|null\\.$#"
+			count: 1
+			path: src/Database/Schema/SqliteSchemaDialect.php
+
+		-
 			message: "#^Template type T of method Cake\\\\Datasource\\\\QueryInterface\\:\\:all\\(\\) is not referenced in a parameter\\.$#"
 			count: 1
 			path: src/Datasource/QueryInterface.php
@@ -31,6 +36,11 @@ parameters:
 			path: src/Error/Renderer/ConsoleExceptionRenderer.php
 
 		-
+			message: "#^Method Cake\\\\Event\\\\EventManager\\:\\:dispatch\\(\\) should return Cake\\\\Event\\\\EventInterface\\<TSubject of object\\> but returns Cake\\\\Event\\\\Event\\<object\\>\\|Cake\\\\Event\\\\EventInterface\\<TSubject of object\\>\\.$#"
+			count: 2
+			path: src/Event/EventManager.php
+
+		-
 			message: "#^Unsafe usage of new static\\(\\)\\.$#"
 			count: 1
 			path: src/Event/EventManager.php
@@ -46,6 +56,11 @@ parameters:
 			path: src/Http/Client/Auth/Digest.php
 
 		-
+			message: "#^Call to an undefined method Cake\\\\Chronos\\\\Chronos\\|DateTimeInterface\\:\\:setTimezone\\(\\)\\.$#"
+			count: 2
+			path: src/Http/Cookie/Cookie.php
+
+		-
 			message: "#^Unsafe usage of new static\\(\\)\\.$#"
 			count: 1
 			path: src/Http/Cookie/Cookie.php
@@ -61,6 +76,41 @@ parameters:
 			path: src/Http/Session.php
 
 		-
+			message: "#^Call to an undefined method Cake\\\\I18n\\\\Date\\|Cake\\\\I18n\\\\DateTime\\:\\:setTimezone\\(\\)\\.$#"
+			count: 1
+			path: src/I18n/RelativeTimeFormatter.php
+
+		-
+			message: "#^Access to an undefined static property static\\(Cake\\\\Mailer\\\\Mailer\\)\\:\\:\\$_registry\\.$#"
+			count: 1
+			path: src/Mailer/Mailer.php
+
+		-
+			message: "#^Access to an undefined property Cake\\\\Mailer\\\\Renderer\\:\\:\\$name\\.$#"
+			count: 1
+			path: src/Mailer/Renderer.php
+
+		-
+			message: "#^Access to an undefined property Cake\\\\Mailer\\\\Renderer\\:\\:\\$plugin\\.$#"
+			count: 1
+			path: src/Mailer/Renderer.php
+
+		-
+			message: "#^Access to an undefined property Cake\\\\Mailer\\\\Renderer\\:\\:\\$request\\.$#"
+			count: 1
+			path: src/Mailer/Renderer.php
+
+		-
+			message: "#^Access to an undefined property Cake\\\\Mailer\\\\Renderer\\:\\:\\$response\\.$#"
+			count: 1
+			path: src/Mailer/Renderer.php
+
+		-
+			message: "#^Method Cake\\\\ORM\\\\Behavior\\\\TreeBehavior\\:\\:_scope\\(\\) should return T of Cake\\\\ORM\\\\Query\\\\DeleteQuery\\|Cake\\\\ORM\\\\Query\\\\SelectQuery\\|Cake\\\\ORM\\\\Query\\\\UpdateQuery but returns Cake\\\\ORM\\\\Query\\\\DeleteQuery\\|Cake\\\\ORM\\\\Query\\\\SelectQuery\\|Cake\\\\ORM\\\\Query\\\\UpdateQuery\\.$#"
+			count: 1
+			path: src/ORM/Behavior/TreeBehavior.php
+
+		-
 			message: "#^Unsafe usage of new static\\(\\)\\.$#"
 			count: 2
 			path: src/ORM/EagerLoader.php
@@ -81,6 +131,16 @@ parameters:
 			path: src/Routing/RouteBuilder.php
 
 		-
+			message: "#^Access to an undefined property Cake\\\\View\\\\Cell\\:\\:\\$name\\.$#"
+			count: 1
+			path: src/View/Cell.php
+
+		-
+			message: "#^Access to an undefined property Cake\\\\View\\\\Cell\\:\\:\\$plugin\\.$#"
+			count: 1
+			path: src/View/Cell.php
+
+		-
 			message: "#^Unsafe usage of new static\\(\\)\\.$#"
 			count: 1
 			path: src/View/Form/ContextFactory.php
@@ -89,3 +149,13 @@ parameters:
 			message: "#^Constructor of class Cake\\\\View\\\\Form\\\\NullContext has an unused parameter \\$context\\.$#"
 			count: 1
 			path: src/View/Form/NullContext.php
+
+		-
+			message: "#^Call to an undefined method Cake\\\\Chronos\\\\Chronos\\|DateTimeInterface\\:\\:setTimezone\\(\\)\\.$#"
+			count: 1
+			path: src/View/Helper/TimeHelper.php
+
+		-
+			message: "#^Call to an undefined method Cake\\\\Chronos\\\\Chronos\\|Cake\\\\Chronos\\\\ChronosDate\\|DateTime\\|DateTimeImmutable\\:\\:setTimezone\\(\\)\\.$#"
+			count: 1
+			path: src/View/Widget/DateTimeWidget.php

+ 1 - 1
phpstan.neon.dist

@@ -2,7 +2,7 @@ includes:
 	- phpstan-baseline.neon
 
 parameters:
-	level: 6
+	level: 8
 	checkMissingIterableValueType: false
 	checkGenericClassInNonGenericObjectType: false
 	treatPhpDocTypesAsCertain: false