File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,31 @@ public function testCreatingObjectFromSpecialExceptionName()
5353 $ this ->assertNoSniffError ($ report , 12 );
5454 }
5555
56+ public function testReportFullyQualifiedInFileWithNamespace ()
57+ {
58+ $ report = $ this ->checkFile (
59+ __DIR__ . '/data/shouldBeInUseStatement.php '
60+ );
61+ $ this ->assertSniffError (
62+ $ report ,
63+ 13 ,
64+ ReferenceUsedNamesOnlySniff::CODE_REFERENCE_VIA_FULLY_QUALIFIED_NAME ,
65+ '\Some\CommonException '
66+ );
67+ $ this ->assertSniffError (
68+ $ report ,
69+ 14 ,
70+ ReferenceUsedNamesOnlySniff::CODE_REFERENCE_VIA_FULLY_QUALIFIED_NAME ,
71+ '\Exception '
72+ );
73+ $ this ->assertSniffError (
74+ $ report ,
75+ 15 ,
76+ ReferenceUsedNamesOnlySniff::CODE_REFERENCE_VIA_FULLY_QUALIFIED_NAME ,
77+ '\Nette\Object '
78+ );
79+ }
80+
5681 public function testDoNotAllowFullyQualifiedExtends ()
5782 {
5883 $ report = $ this ->checkFile (
Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ public function bar()
1010 new Lorem ();
1111 $ constant = \Some \ConstantClass::CONSTANT ;
1212 new \Foo \SomeError ();
13+ new \Some \CommonException ();
14+ new \Exception ();
15+ new \Nette \Object ();
1316 }
1417
1518}
You can’t perform that action at this time.
0 commit comments