File tree Expand file tree Collapse file tree 2 files changed +82
-0
lines changed Expand file tree Collapse file tree 2 files changed +82
-0
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,37 @@ public function testBug12224(): void
216216		]);
217217	}
218218
219+ 	public  function  testAllMethodsArePure (): void 
220+ 	{
221+ 		$ this treatPhpDocTypesAsCertain  = true ;
222+ 		$ this analyse ([__DIR__  . '/data/all-methods-are-pure.php ' ], [
223+ 			[
224+ 				'Method AllMethodsArePure\Foo::test() is marked as pure but returns void. ' ,
225+ 				10 ,
226+ 			],
227+ 			[
228+ 				'Method AllMethodsArePure\Foo::pure() is marked as pure but returns void. ' ,
229+ 				17 ,
230+ 			],
231+ 			[
232+ 				'Method AllMethodsArePure\Foo::impure() is marked as impure but does not have any side effects. ' ,
233+ 				24 ,
234+ 			],
235+ 			[
236+ 				'Method AllMethodsArePure\Bar::test() is marked as impure but does not have any side effects. ' ,
237+ 				34 ,
238+ 			],
239+ 			[
240+ 				'Method AllMethodsArePure\Bar::pure() is marked as pure but returns void. ' ,
241+ 				41 ,
242+ 			],
243+ 			[
244+ 				'Method AllMethodsArePure\Bar::impure() is marked as impure but does not have any side effects. ' ,
245+ 				48 ,
246+ 			],
247+ 		]);
248+ 	}
249+ 
219250	public  function  testBug12382 (): void 
220251	{
221252		$ this treatPhpDocTypesAsCertain  = true ;
Original file line number Diff line number Diff line change 1+ <?php 
2+ 
3+ namespace  AllMethodsArePure ;
4+ 
5+ /** 
6+  * @phpstan-all-methods-pure 
7+  */ 
8+ final  class  Foo
9+ {
10+ 	function  test (): void 
11+ 	{
12+ 	}
13+ 
14+ 	/** 
15+ 	 * @phpstan-pure 
16+ 	 */ 
17+ 	function  pure (): void 
18+ 	{
19+ 	}
20+ 
21+ 	/** 
22+ 	 * @phpstan-impure 
23+ 	 */ 
24+ 	function  impure (): void 
25+ 	{
26+ 	}
27+ }
28+ 
29+ /** 
30+  * @phpstan-all-methods-impure 
31+  */ 
32+ final  class  Bar
33+ {
34+ 	function  test (): void 
35+ 	{
36+ 	}
37+ 
38+ 	/** 
39+ 	 * @phpstan-pure 
40+ 	 */ 
41+ 	function  pure (): void 
42+ 	{
43+ 	}
44+ 
45+ 	/** 
46+ 	 * @phpstan-impure 
47+ 	 */ 
48+ 	function  impure (): void 
49+ 	{
50+ 	}
51+ }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments