File tree Expand file tree Collapse file tree 4 files changed +8
-16
lines changed Expand file tree Collapse file tree 4 files changed +8
-16
lines changed Original file line number Diff line number Diff line change 2828 },
2929 "require-dev" : {
3030 "friendsofphp/php-cs-fixer" : " ^v3.15.1" ,
31- "phpstan/phpstan" : " ^1.10.47 " ,
31+ "phpstan/phpstan" : " ^1.10.48 " ,
3232 "phpstan/phpstan-strict-rules" : " ^1.5.2" ,
3333 "phpstan/phpstan-phpunit" : " ^1.3.15" ,
3434 "phpstan/phpstan-deprecation-rules" : " ^1.1.4" ,
35- "phpunit/phpunit" : " ^10.5.1 " ,
35+ "phpunit/phpunit" : " ^10.5.2 " ,
3636 "symfony/var-dumper" : " ^6.4.0"
3737 },
3838 "autoload" : {
Original file line number Diff line number Diff line change @@ -45,12 +45,8 @@ public static function hasName(string $name): bool
4545 */
4646 public static function hasValue (int |string $ value ): bool
4747 {
48- if (!(new ReflectionEnum (static ::class))->isBacked ()) {
49- return false ;
50- }
51-
5248 foreach (static ::cases () as $ enum ) {
53- if ($ enum ->value === $ value ) { /* @phpstan-ignore-line */
49+ if ($ enum? ->value === $ value ) { /* @phpstan-ignore-line */
5450 return true ;
5551 }
5652 }
@@ -65,12 +61,8 @@ public static function hasValue(int|string $value): bool
6561 */
6662 public static function hasCase (string $ name , int |string $ value ): bool
6763 {
68- if (!(new ReflectionEnum (static ::class))->isBacked ()) {
69- return false ;
70- }
71-
7264 foreach (static ::cases () as $ enum ) {
73- if ($ enum ->name === $ name && $ enum ->value === $ value ) { /* @phpstan-ignore-line */
65+ if ($ enum? ->name === $ name && $ enum? ->value === $ value ) { /* @phpstan-ignore-line */
7466 return true ;
7567 }
7668 }
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ trait Info
1414{
1515 public static function isBacked (): bool
1616 {
17- return (new ReflectionEnum (static ::class))->isBacked ();
17+ return (new ReflectionEnum (static ::class))->isBacked (); /* @phpstan-ignore-line */
1818 }
1919
2020 public static function isNotBacked (): bool
Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ public function testErrorTransformedIntoARuntimeException(): void
8282 $ touch ('/foo ' );
8383 }
8484
85- public function testErrorTransformedIntoAnInvalidArgumentException (): void
85+ public function testErrorTransformedIntoAnErrorException (): void
8686 {
8787 Cloak::throwOnError ();
8888 $ this ->expectException (ErrorException::class);
@@ -96,14 +96,14 @@ public function testSpecificBehaviourOverrideGeneralErrorSetting(): void
9696 $ this ->expectNotToPerformAssertions ();
9797
9898 Cloak::throwOnError ();
99- $ touch = Cloak::userDeprecated (touch (...), Cloak::SILENT );
99+ $ touch = Cloak::warning (touch (...), Cloak::SILENT );
100100 $ touch ('/foo ' );
101101 }
102102
103103 public function testCaptureNothingThrowNoException (): void
104104 {
105105 Cloak::throwOnError ();
106- $ strtoupper = Cloak::notice (strtoupper (...));
106+ $ strtoupper = Cloak::userDeprecated (strtoupper (...));
107107
108108 self ::assertSame ('FOO ' , $ strtoupper ('foo ' ));
109109 }
You can’t perform that action at this time.
0 commit comments