2424class  CallToDeprecatedStaticMethodRule implements  Rule
2525{
2626
27- 	/** @var ReflectionProvider */ 
28- 	private  $ reflectionProvider
27+ 	private  ReflectionProvider $ reflectionProvider
2928
30- 	/** @var RuleLevelHelper */ 
31- 	private  $ ruleLevelHelper
29+ 	private  RuleLevelHelper $ ruleLevelHelper
3230
33- 	/** @var DeprecatedScopeHelper */ 
34- 	private  $ deprecatedScopeHelper
31+ 	private  DeprecatedScopeHelper $ deprecatedScopeHelper
3532
3633	public  function  __construct (ReflectionProvider $ reflectionProviderRuleLevelHelper $ ruleLevelHelperDeprecatedScopeHelper $ deprecatedScopeHelper
3734	{
@@ -65,9 +62,7 @@ public function processNode(Node $node, Scope $scope): array
6562				$ scope
6663				$ nodeclass ,
6764				'' , // We don't care about the error message 
68- 				static  function  (Type $ typeuse  ($ methodNamebool  {
69- 					return  $ typecanCallMethods ()->yes () && $ typehasMethod ($ methodNameyes ();
70- 				}
65+ 				static  fn  (Type $ typebool  => $ typecanCallMethods ()->yes () && $ typehasMethod ($ methodNameyes (),
7166			);
7267
7368			if  ($ classTypeResultgetType () instanceof  ErrorType) {
@@ -96,15 +91,15 @@ static function (Type $type) use ($methodName): bool {
9691						'Call to method %s() of deprecated %s %s. ' ,
9792						$ methodReflectiongetName (),
9893						strtolower ($ methodReflectiongetDeclaringClass ()->getClassTypeDescription ()),
99- 						$ methodReflectiongetDeclaringClass ()->getName ()
94+ 						$ methodReflectiongetDeclaringClass ()->getName (), 
10095					))->identifier (sprintf ('staticMethod.deprecated%s ' , $ methodReflectiongetDeclaringClass ()->getClassTypeDescription ()))->build ();
10196				} else  {
10297					$ errorsmessage (sprintf (
10398						"Call to method %s() of deprecated %s %s: \n%s " ,
10499						$ methodReflectiongetName (),
105100						strtolower ($ methodReflectiongetDeclaringClass ()->getClassTypeDescription ()),
106101						$ methodReflectiongetDeclaringClass ()->getName (),
107- 						$ classDescription
102+ 						$ classDescription, 
108103					))->identifier (sprintf ('staticMethod.deprecated%s ' , $ methodReflectiongetDeclaringClass ()->getClassTypeDescription ()))->build ();
109104				}
110105			}
@@ -119,15 +114,15 @@ static function (Type $type) use ($methodName): bool {
119114					'Call to deprecated method %s() of %s %s. ' ,
120115					$ methodReflectiongetName (),
121116					strtolower ($ methodReflectiongetDeclaringClass ()->getClassTypeDescription ()),
122- 					$ methodReflectiongetDeclaringClass ()->getName ()
117+ 					$ methodReflectiongetDeclaringClass ()->getName (), 
123118				))->identifier ('staticMethod.deprecated ' )->build ();
124119			} else  {
125120				$ errorsmessage (sprintf (
126121					"Call to deprecated method %s() of %s %s: \n%s " ,
127122					$ methodReflectiongetName (),
128123					strtolower ($ methodReflectiongetDeclaringClass ()->getClassTypeDescription ()),
129124					$ methodReflectiongetDeclaringClass ()->getName (),
130- 					$ description
125+ 					$ description, 
131126				))->identifier ('staticMethod.deprecated ' )->build ();
132127			}
133128		}
0 commit comments