From 4b42a14c46ccd9bb0a07521123eb12a1bce1c0e3 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 27 Dec 2015 12:11:24 +0100 Subject: [PATCH 1/2] Project factory accepts File implementations only --- src/File.php | 38 ++++++++++++++++++++++++++++++++++++++ src/ProjectFactory.php | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/File.php diff --git a/src/File.php b/src/File.php new file mode 100644 index 0000000..7cf7cf2 --- /dev/null +++ b/src/File.php @@ -0,0 +1,38 @@ + + * @license http://www.opensource.org/licenses/mit-license.php MIT + * @link http://phpdoc.org + */ + +namespace phpDocumentor\Reflection; + + +interface File +{ + /** + * Returns the content of the file as a string. + * + * @return string + */ + public function getContents(); + + /** + * Returns md5 hash of the file. + * + * @return string + */ + public function md5(); + + /** + * Returns an relative path to the file. + * + * @return string + */ + public function path(); +} diff --git a/src/ProjectFactory.php b/src/ProjectFactory.php index f2c091d..5602f84 100644 --- a/src/ProjectFactory.php +++ b/src/ProjectFactory.php @@ -20,7 +20,7 @@ interface ProjectFactory * Creates a project from the set of files. * * @param string $name - * @param string[] $files + * @param File[] $files * @return Project */ public function create($name, array $files); From f304ed5803eb8215b3fd88334bd41d1a8c87d253 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Sun, 27 Dec 2015 12:13:20 +0100 Subject: [PATCH 2/2] add missing docblock --- src/File.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/File.php b/src/File.php index 7cf7cf2..0187594 100644 --- a/src/File.php +++ b/src/File.php @@ -12,7 +12,9 @@ namespace phpDocumentor\Reflection; - +/** + * Interface for files processed by the ProjectFactory + */ interface File { /**