diff --git a/composer.json b/composer.json index a4ad81524..93db2bf37 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,12 @@ }, "autoload": { "psr-4": { - "CodeInspector\\": "lib" + "CodeInspector\\": "src/CodeInspector", + } + }, + "autoload-dev": { + "psr-4": { + "CodeInspector\\Tests": "tests" } } } diff --git a/tests/TypeTest.php b/tests/TypeTest.php new file mode 100644 index 000000000..05bd4f980 --- /dev/null +++ b/tests/TypeTest.php @@ -0,0 +1,55 @@ +foo(); + } + }'; + + $parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); + $stmts = $parser->parse($code); + + $file_checker = new \CodeInspector\FileChecker('somefile.php', $stmts); + $file_checker->check(); + } + + public function testNullableMethodWithGuard() + { + $code = 'foo(); + } + } + }'; + + $parser = (new ParserFactory)->create(ParserFactory::PREFER_PHP7); + $stmts = $parser->parse($code); + + $file_checker = new \CodeInspector\FileChecker('somefile.php', $stmts); + $file_checker->check(); + } +}