Skip to content

Commit

Permalink
Merge pull request #1 from getherbie/master
Browse files Browse the repository at this point in the history
Fixed several code inspection issues
  • Loading branch information
Netzweberei committed Feb 29, 2016
2 parents 96bce37 + b395f2b commit 2b2f89f
Show file tree
Hide file tree
Showing 20 changed files with 32 additions and 23 deletions.
2 changes: 1 addition & 1 deletion system/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Assets
protected $refresh = 86400;

/**
* @var octal
* @var int
*/
protected $chmode = 0755;

Expand Down
1 change: 1 addition & 0 deletions system/Cache/CacheFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class CacheFactory
* @param string $type
* @param Config $config
* @return CacheInterface
* @throws \Exception
*/
public static function create($type, Config $config)
{
Expand Down
1 change: 1 addition & 0 deletions system/DI.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function offsetExists($offset)
/**
* @param mixed $offset
* @return mixed
* @throws \Exception
*/
public function offsetGet($offset)
{
Expand Down
6 changes: 5 additions & 1 deletion system/ErrorHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

namespace Herbie;

/**
* @see http://stackoverflow.com/questions/2561235/best-possible-php-error-class
*/
class ErrorHandler
{
/**
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -114,7 +118,7 @@ public function isFatalError($error)
}

/**
* @return void
* @param int $code
*/
protected function sendHttpHeader($code = 500)
{
Expand Down
2 changes: 1 addition & 1 deletion system/Helper/PageHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
2 changes: 2 additions & 0 deletions system/Helper/StringHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions system/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 4 additions & 3 deletions system/Loader/PageLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Herbie\Loader;

use Herbie\Alias;
use Herbie\Exception\ResourceNotFoundException;
use Herbie\Page;
use Herbie\Yaml;

/**
Expand All @@ -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;
}
Expand Down Expand Up @@ -143,6 +143,7 @@ protected function parseContent($content)
/**
* @param string $alias
* @return string
* @throws ResourceNotFoundException
*/
protected function readFile($alias)
{
Expand Down
5 changes: 3 additions & 2 deletions system/Menu/CollectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function getItem($route)
}

/**
* @return \ArrayIterator|Traversable
* @return \ArrayIterator|\Traversable
*/
public function getIterator()
{
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions system/Menu/Page/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions system/Menu/Page/FileFilterCallback.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion system/Menu/Page/Iterator/TreeIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function hasChildren()
}

/**
* @return Herbie\Menu\Page\Node
* @return \Herbie\Menu\Page\Node
*/
public function current()
{
Expand Down
2 changes: 1 addition & 1 deletion system/Menu/Page/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __toString()

/**
* @param Collection $menuCollection
* @return PageMenuNode
* @return Node
*/
public static function buildTree($menuCollection)
{
Expand Down
1 change: 1 addition & 0 deletions system/Menu/Page/Renderer/HtmlTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public function endChildren()
}

/**
* @param string $route
* @return string
*/
public function render($route = '')
Expand Down
1 change: 0 additions & 1 deletion system/Menu/Post/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

namespace Herbie\Menu\Post;

use Herbie\Application;
use Herbie\Cache\CacheInterface;
use Herbie\Config;
use Herbie\Loader\FrontMatterLoader;
Expand Down
1 change: 1 addition & 0 deletions system/Menu/Post/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
4 changes: 2 additions & 2 deletions system/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Page
protected $segments = [];

/**
* @var PageLoader
* @var Loader\PageLoader
*/
private $pageLoader;

Expand Down Expand Up @@ -123,7 +123,7 @@ public function toArray()
}

/**
* @param PageLoader $loader
* @param Loader\PageLoader $loader
*/
public function setLoader(Loader\PageLoader $loader)
{
Expand Down
2 changes: 1 addition & 1 deletion system/Pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion system/Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ private function loadMessages()

/**
* @param string $category
* @param string|array $paths
* @param string $path
*/
public function addPath($category, $path)
{
Expand Down
4 changes: 2 additions & 2 deletions system/Url/UrlMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
class UrlMatcher
{
/**
* @var PageMenuCollection Collection of all pages.
* @var Page\Collection Collection of all pages.
*/
protected $pages;

Expand All @@ -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)
Expand Down

0 comments on commit 2b2f89f

Please sign in to comment.