diff --git a/system/Assets.php b/system/Assets.php index 813ab582..56866d1b 100644 --- a/system/Assets.php +++ b/system/Assets.php @@ -51,7 +51,7 @@ class Assets protected $refresh = 86400; /** - * @var octal + * @var int */ protected $chmode = 0755; diff --git a/system/Cache/CacheFactory.php b/system/Cache/CacheFactory.php index cba0b65f..98c4aed6 100644 --- a/system/Cache/CacheFactory.php +++ b/system/Cache/CacheFactory.php @@ -19,6 +19,7 @@ class CacheFactory * @param string $type * @param Config $config * @return CacheInterface + * @throws \Exception */ public static function create($type, Config $config) { diff --git a/system/DI.php b/system/DI.php index de61c374..a534006a 100644 --- a/system/DI.php +++ b/system/DI.php @@ -73,6 +73,7 @@ public function offsetExists($offset) /** * @param mixed $offset * @return mixed + * @throws \Exception */ public function offsetGet($offset) { diff --git a/system/ErrorHandler.php b/system/ErrorHandler.php index 8a5dc5ee..a2d92c24 100644 --- a/system/ErrorHandler.php +++ b/system/ErrorHandler.php @@ -11,6 +11,9 @@ namespace Herbie; +/** + * @see http://stackoverflow.com/questions/2561235/best-possible-php-error-class + */ class ErrorHandler { /** @@ -42,6 +45,7 @@ public function unregister() * @param string $message * @param string $file * @param int $line + * @return bool * @throws \ErrorException */ public function handleError($code, $message, $file, $line) @@ -114,7 +118,7 @@ public function isFatalError($error) } /** - * @return void + * @param int $code */ protected function sendHttpHeader($code = 500) { diff --git a/system/Helper/PageHelper.php b/system/Helper/PageHelper.php index c9274024..7880e7b1 100644 --- a/system/Helper/PageHelper.php +++ b/system/Helper/PageHelper.php @@ -69,7 +69,7 @@ public static function updateSegments($filepath, array $segments) protected static function pregMatch($content) { // @see https://github.com/kzykhys/YamlFrontMatter/blob/master/src/KzykHys/FrontMatter/FrontMatter.php - $matched = preg_match('/^-{3}\r?\n(.*)\r?\n-{3}\r?\n(.*)/s', $content, $matches); + preg_match('/^-{3}\r?\n(.*)\r?\n-{3}\r?\n(.*)/s', $content, $matches); return $matches; } } diff --git a/system/Helper/StringHelper.php b/system/Helper/StringHelper.php index 70310b05..ecc2ede5 100644 --- a/system/Helper/StringHelper.php +++ b/system/Helper/StringHelper.php @@ -30,6 +30,8 @@ public static function urlify($str, $delimiter='-') { } /** + * @param string $string + * @return string * @see https://github.com/alixaxel/phunction/blob/master/phunction/Text.php#L297 */ public static function unaccent($string) diff --git a/system/Http/Request.php b/system/Http/Request.php index a0aa8fb7..78831a3e 100755 --- a/system/Http/Request.php +++ b/system/Http/Request.php @@ -380,8 +380,6 @@ protected function preparePathInfo() return '/'; } - $pathInfo = '/'; - // Remove the query string from REQUEST_URI if ($pos = strpos($requestUri, '?')) { $requestUri = substr($requestUri, 0, $pos); diff --git a/system/Loader/PageLoader.php b/system/Loader/PageLoader.php index 21f883fe..76d4c0a1 100644 --- a/system/Loader/PageLoader.php +++ b/system/Loader/PageLoader.php @@ -11,8 +11,8 @@ namespace Herbie\Loader; +use Herbie\Alias; use Herbie\Exception\ResourceNotFoundException; -use Herbie\Page; use Herbie\Yaml; /** @@ -24,9 +24,9 @@ class PageLoader protected $page; /** - * @param \Herbie\Alias $alias + * @param Alias $alias */ - public function __construct(\Herbie\Alias $alias) + public function __construct(Alias $alias) { $this->alias = $alias; } @@ -143,6 +143,7 @@ protected function parseContent($content) /** * @param string $alias * @return string + * @throws ResourceNotFoundException */ protected function readFile($alias) { diff --git a/system/Menu/CollectionTrait.php b/system/Menu/CollectionTrait.php index f1a1ac66..584ed373 100644 --- a/system/Menu/CollectionTrait.php +++ b/system/Menu/CollectionTrait.php @@ -53,7 +53,7 @@ public function getItem($route) } /** - * @return \ArrayIterator|Traversable + * @return \ArrayIterator|\Traversable */ public function getIterator() { @@ -97,7 +97,8 @@ public function find($value, $key) /** * Run a filter over each of the items. * - * @param callable|null $callback + * @param callable|null $key + * @param mixed $value * @return static */ public function filter($key = null, $value = null) diff --git a/system/Menu/Page/Builder.php b/system/Menu/Page/Builder.php index 23c5b8e0..8371071a 100644 --- a/system/Menu/Page/Builder.php +++ b/system/Menu/Page/Builder.php @@ -12,9 +12,9 @@ namespace Herbie\Menu\Page; use Herbie\Cache\CacheInterface; +use Herbie\Iterator\RecursiveDirectoryIterator; use Herbie\Loader\FrontMatterLoader; use Herbie\Menu\Page\Iterator\SortableIterator; -use Herbie\Menu\RecursiveFilterIterator; class Builder { @@ -139,7 +139,7 @@ private function storeCollection($collection) protected function getIterator($path) { // recursive iterators - $directoryIterator = new \Herbie\Iterator\RecursiveDirectoryIterator($path); + $directoryIterator = new RecursiveDirectoryIterator($path); $callback = [new FileFilterCallback($this->extensions), 'call']; $filterIterator = new \RecursiveCallbackFilterIterator($directoryIterator, $callback); $mode = \RecursiveIteratorIterator::SELF_FIRST; diff --git a/system/Menu/Page/FileFilterCallback.php b/system/Menu/Page/FileFilterCallback.php index b655ceda..0a5ddc87 100644 --- a/system/Menu/Page/FileFilterCallback.php +++ b/system/Menu/Page/FileFilterCallback.php @@ -29,9 +29,9 @@ public function __construct($extensions) /** * - * @param SplFileInfo $file + * @param \SplFileInfo $file * @param string $path - * @param RecursiveDirectoryIterator $iterator + * @param \RecursiveDirectoryIterator $iterator * @return boolean */ public function call(\SplFileInfo $file, $path, \RecursiveDirectoryIterator $iterator) diff --git a/system/Menu/Page/Iterator/TreeIterator.php b/system/Menu/Page/Iterator/TreeIterator.php index efe68be1..c39f1075 100644 --- a/system/Menu/Page/Iterator/TreeIterator.php +++ b/system/Menu/Page/Iterator/TreeIterator.php @@ -51,7 +51,7 @@ public function hasChildren() } /** - * @return Herbie\Menu\Page\Node + * @return \Herbie\Menu\Page\Node */ public function current() { diff --git a/system/Menu/Page/Node.php b/system/Menu/Page/Node.php index a3e917a8..e483f419 100644 --- a/system/Menu/Page/Node.php +++ b/system/Menu/Page/Node.php @@ -23,7 +23,7 @@ public function __toString() /** * @param Collection $menuCollection - * @return PageMenuNode + * @return Node */ public static function buildTree($menuCollection) { diff --git a/system/Menu/Page/Renderer/HtmlTree.php b/system/Menu/Page/Renderer/HtmlTree.php index 8dccc239..0488c4dd 100644 --- a/system/Menu/Page/Renderer/HtmlTree.php +++ b/system/Menu/Page/Renderer/HtmlTree.php @@ -90,6 +90,7 @@ public function endChildren() } /** + * @param string $route * @return string */ public function render($route = '') diff --git a/system/Menu/Post/Builder.php b/system/Menu/Post/Builder.php index 00c86de0..4902bb22 100644 --- a/system/Menu/Post/Builder.php +++ b/system/Menu/Post/Builder.php @@ -11,7 +11,6 @@ namespace Herbie\Menu\Post; -use Herbie\Application; use Herbie\Cache\CacheInterface; use Herbie\Config; use Herbie\Loader\FrontMatterLoader; diff --git a/system/Menu/Post/Collection.php b/system/Menu/Post/Collection.php index e949ecf0..4ec0efcd 100644 --- a/system/Menu/Post/Collection.php +++ b/system/Menu/Post/Collection.php @@ -191,6 +191,7 @@ public function filterItems() $category = null; $tag = null; $author = null; + $filteredByLabel = null; // filter by year and month if (preg_match('/^.*([0-9]{4})\/([0-9]{2})$/', $pathInfo, $matches)) { diff --git a/system/Page.php b/system/Page.php index a603b9ed..399189d6 100644 --- a/system/Page.php +++ b/system/Page.php @@ -27,7 +27,7 @@ class Page protected $segments = []; /** - * @var PageLoader + * @var Loader\PageLoader */ private $pageLoader; @@ -123,7 +123,7 @@ public function toArray() } /** - * @param PageLoader $loader + * @param Loader\PageLoader $loader */ public function setLoader(Loader\PageLoader $loader) { diff --git a/system/Pagination.php b/system/Pagination.php index 14f1397d..bf7c3b9f 100644 --- a/system/Pagination.php +++ b/system/Pagination.php @@ -25,7 +25,7 @@ public function __construct($items, $limit = 10, $name = 'page') if ($items instanceof Collection) { $this->items = $items->flatten(); } - $this->limit = $this->setLimit($limit); + $this->setLimit($limit); $this->name = $name; } diff --git a/system/Translator.php b/system/Translator.php index dd23b8d0..cfc61f54 100644 --- a/system/Translator.php +++ b/system/Translator.php @@ -94,7 +94,7 @@ private function loadMessages() /** * @param string $category - * @param string|array $paths + * @param string $path */ public function addPath($category, $path) { diff --git a/system/Url/UrlMatcher.php b/system/Url/UrlMatcher.php index 7ed503c2..1e7d46f4 100644 --- a/system/Url/UrlMatcher.php +++ b/system/Url/UrlMatcher.php @@ -22,7 +22,7 @@ class UrlMatcher { /** - * @var PageMenuCollection Collection of all pages. + * @var Page\Collection Collection of all pages. */ protected $pages; @@ -33,7 +33,7 @@ class UrlMatcher /** * Constructor - * @param Page\Collection $collection Collection of all pages + * @param Page\Collection $pages Collection of all pages * @param Post\Collection $posts Collection of all posts */ public function __construct(Page\Collection $pages, Post\Collection $posts)