diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2018-01-14 22:36:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-14 22:36:59 +0100 |
commit | bdd99b096f6091d71148e6529ef27997de9dc294 (patch) | |
tree | 6b6c369f78e63655d0f39eaa58e0b5149da5b77c /lib/private/App | |
parent | 419de27b6ded8959d6f9d519d2a142b189d4ae08 (diff) | |
parent | c739ca3c50c19862162b6ff4644b03539c3df268 (diff) | |
download | nextcloud-server-bdd99b096f6091d71148e6529ef27997de9dc294.tar.gz nextcloud-server-bdd99b096f6091d71148e6529ef27997de9dc294.zip |
Merge pull request #7833 from nextcloud/fix-code-checker
Fix casting in app code checker
Diffstat (limited to 'lib/private/App')
-rw-r--r-- | lib/private/App/CodeChecker/CodeChecker.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/private/App/CodeChecker/CodeChecker.php b/lib/private/App/CodeChecker/CodeChecker.php index a6368ab683f..456a78aa122 100644 --- a/lib/private/App/CodeChecker/CodeChecker.php +++ b/lib/private/App/CodeChecker/CodeChecker.php @@ -63,8 +63,9 @@ class CodeChecker extends BasicEmitter { /** * @param string $appId * @return array + * @throws \RuntimeException if app with $appId is unknown */ - public function analyse($appId) { + public function analyse(string $appId): array { $appPath = \OC_App::getAppPath($appId); if ($appPath === false) { throw new \RuntimeException("No app with given id <$appId> known."); @@ -78,7 +79,7 @@ class CodeChecker extends BasicEmitter { * @param string $folder * @return array */ - public function analyseFolder($appId, $folder) { + public function analyseFolder(string $appId, string $folder): array { $errors = []; $excludedDirectories = ['vendor', '3rdparty', '.git', 'l10n', 'tests', 'test']; @@ -106,7 +107,7 @@ class CodeChecker extends BasicEmitter { foreach ($iterator as $file) { /** @var SplFileInfo $file */ $this->emit('CodeChecker', 'analyseFileBegin', [$file->getPathname()]); - $fileErrors = $this->analyseFile($file); + $fileErrors = $this->analyseFile($file->__toString()); $this->emit('CodeChecker', 'analyseFileFinished', [$file->getPathname(), $fileErrors]); $errors = array_merge($fileErrors, $errors); } @@ -119,7 +120,7 @@ class CodeChecker extends BasicEmitter { * @param string $file * @return array */ - public function analyseFile($file) { + public function analyseFile(string $file): array { $code = file_get_contents($file); $statements = $this->parser->parse($code); |