Kevin Pfeifer 2 years ago
parent
commit
fe70ef7d10
3 changed files with 42 additions and 1 deletions
  1. 40 0
      phpstan-baseline.neon
  2. 1 1
      src/ORM/Behavior/TreeBehavior.php
  3. 1 0
      src/TestSuite/TestCase.php

+ 40 - 0
phpstan-baseline.neon

@@ -51,6 +51,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
@@ -66,6 +71,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
@@ -81,6 +91,16 @@ 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: "#^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
@@ -106,6 +126,16 @@ parameters:
 			path: src/TestSuite/TestCase.php
 
 		-
+			message: "#^Offset 0 does not exist on array\\{\\}\\|array\\{0\\: int, 1\\: int, 2\\: int, 3\\: string, mime\\: string, channels\\?\\: int, bits\\?\\: int\\}\\.$#"
+			count: 1
+			path: src/Validation/Validation.php
+
+		-
+			message: "#^Offset 1 does not exist on array\\{\\}\\|array\\{0\\: int, 1\\: int, 2\\: int, 3\\: string, mime\\: string, channels\\?\\: int, bits\\?\\: int\\}\\.$#"
+			count: 1
+			path: src/Validation/Validation.php
+
+		-
 			message: "#^Unsafe usage of new static\\(\\)\\.$#"
 			count: 1
 			path: src/View/Form/ContextFactory.php
@@ -114,3 +144,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
src/ORM/Behavior/TreeBehavior.php

@@ -526,7 +526,7 @@ class TreeBehavior extends Behavior
 
                 $nested = $results->listNested();
                 assert($nested instanceof TreeIterator);
-                assert(!is_array($valuePath));
+                assert(is_callable($valuePath) || is_string($valuePath));
 
                 return $nested->printer($valuePath, $keyPath, $spacer);
             }

+ 1 - 0
src/TestSuite/TestCase.php

@@ -127,6 +127,7 @@ abstract class TestCase extends BaseTestCase
         set_error_handler(
             function (int $code, string $description, string $file, int $line) {
                 $trace = Debugger::trace(['start' => 1, 'format' => 'points']);
+                assert(is_array($trace));
                 $this->_capturedError = new PhpError($code, $description, $file, $line, $trace);
 
                 return true;