فهرست منبع

replace TypeError by InvalidArgumentException

Fabian Peter Hammerle 8 سال پیش
والد
کامیت
2b30882cdc
2فایلهای تغییر یافته به همراه3 افزوده شده و 3 حذف شده
  1. 1 1
      Subject.php
  2. 2 2
      tests/SubjectTest.php

+ 1 - 1
Subject.php

@@ -71,7 +71,7 @@ class Subject extends \yii\db\ActiveRecord
                 // @see \yii\web\IdentityInterface::getId()
                 $this->identity_id = $identity->getId();
             } else {
-                throw new \TypeError(sprintf(
+                throw new \InvalidArgumentException(sprintf(
                     "expected instance of %s,\n%s given",
                     $cls,
                     get_class($identity)

+ 2 - 2
tests/SubjectTest.php

@@ -103,13 +103,13 @@ class SubjectTest extends TestCase
     public function testSetIdentityInvalidType()
     {
         $s = new Subject;
-        $this->setExpectedException(\TypeError::class);
+        $this->setExpectedException(\InvalidArgumentException::class);
         $s->identity = new DummyUser;
     }
 
     public function testConstructInvalidType()
     {
-        $this->setExpectedException(\TypeError::class);
+        $this->setExpectedException(\InvalidArgumentException::class);
         new Subject(new DummyUser);
     }