Fix lots of scrutinizer warnings, remove Travis
This commit is contained in:
@ -43,7 +43,7 @@ class Content extends ContentAbstract
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getContent()
|
||||
public function getContent(): string
|
||||
{
|
||||
if ($this->attributes === null) {
|
||||
$this->parseAttributes();
|
||||
@ -55,7 +55,7 @@ class Content extends ContentAbstract
|
||||
/**
|
||||
* @param string $content
|
||||
*/
|
||||
public function setContent($content)
|
||||
public function setContent(string $content): void
|
||||
{
|
||||
$this->manuallySetContent = true;
|
||||
$this->content = $content;
|
||||
@ -64,7 +64,7 @@ class Content extends ContentAbstract
|
||||
/**
|
||||
* @return Content
|
||||
*/
|
||||
public function getPrevious()
|
||||
public function getPrevious(): ?Content
|
||||
{
|
||||
return $this->previous;
|
||||
}
|
||||
@ -72,7 +72,7 @@ class Content extends ContentAbstract
|
||||
/**
|
||||
* @param Content $previous
|
||||
*/
|
||||
public function setPrevious($previous)
|
||||
public function setPrevious(Content $previous)
|
||||
{
|
||||
$this->previous = $previous;
|
||||
}
|
||||
@ -80,7 +80,7 @@ class Content extends ContentAbstract
|
||||
/**
|
||||
* @return Content
|
||||
*/
|
||||
public function getNext()
|
||||
public function getNext(): ?Content
|
||||
{
|
||||
return $this->next;
|
||||
}
|
||||
@ -88,7 +88,7 @@ class Content extends ContentAbstract
|
||||
/**
|
||||
* @param Content $next
|
||||
*/
|
||||
public function setNext($next)
|
||||
public function setNext(Content $next)
|
||||
{
|
||||
$this->next = $next;
|
||||
}
|
||||
@ -102,7 +102,7 @@ class Content extends ContentAbstract
|
||||
return $this->name == 'index' || $this->name == '_index';
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
public function getTitle(): string
|
||||
{
|
||||
if ($title = $this->getAttribute('title')) {
|
||||
return $title;
|
||||
|
@ -8,7 +8,7 @@ abstract class ContentAbstract extends Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getContent()
|
||||
public function getContent(): string
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
@ -16,7 +16,7 @@ abstract class ContentAbstract extends Entry
|
||||
/**
|
||||
* @param string $content
|
||||
*/
|
||||
public function setContent($content)
|
||||
public function setContent(string $content): void
|
||||
{
|
||||
$this->content = $content;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
use ArrayIterator;
|
||||
use RuntimeException;
|
||||
use Todaymade\Daux\Config;
|
||||
|
||||
class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
|
||||
{
|
||||
@ -103,20 +104,20 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
public function addChild(Entry $entry)
|
||||
public function addChild(Entry $entry): void
|
||||
{
|
||||
$this->children[$entry->getUri()] = $entry;
|
||||
}
|
||||
|
||||
public function removeChild(Entry $entry)
|
||||
public function removeChild(Entry $entry): void
|
||||
{
|
||||
unset($this->children[$entry->getUri()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Todaymade\Daux\Config
|
||||
* @return Config
|
||||
*/
|
||||
public function getConfig()
|
||||
public function getConfig(): Config
|
||||
{
|
||||
if (!$this->parent) {
|
||||
throw new \RuntimeException('Could not retrieve configuration. Are you sure that your tree has a Root ?');
|
||||
@ -138,7 +139,7 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
|
||||
/**
|
||||
* @return Content|null
|
||||
*/
|
||||
public function getIndexPage()
|
||||
public function getIndexPage(): ?Content
|
||||
{
|
||||
$index_key = $this->getConfig()['index_key'];
|
||||
|
||||
@ -157,7 +158,7 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
|
||||
* Seek the first available page from descendants
|
||||
* @return Content|null
|
||||
*/
|
||||
public function seekFirstPage()
|
||||
public function seekFirstPage(): ?Content
|
||||
{
|
||||
if ($this instanceof self) {
|
||||
$index_key = $this->getConfig()['index_key'];
|
||||
@ -182,7 +183,7 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
|
||||
/**
|
||||
* @return Content|null
|
||||
*/
|
||||
public function getFirstPage()
|
||||
public function getFirstPage(): ?Content
|
||||
{
|
||||
if ($this->first_page) {
|
||||
return $this->first_page;
|
||||
@ -217,7 +218,7 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
|
||||
/**
|
||||
* @param Content $first_page
|
||||
*/
|
||||
public function setFirstPage($first_page)
|
||||
public function setFirstPage(Content $first_page)
|
||||
{
|
||||
$this->first_page = $first_page;
|
||||
}
|
||||
@ -228,7 +229,7 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasContent()
|
||||
public function hasContent(): bool
|
||||
{
|
||||
foreach ($this->getEntries() as $node) {
|
||||
if ($node instanceof Content) {
|
||||
@ -262,7 +263,7 @@ class Directory extends Entry implements \ArrayAccess, \IteratorAggregate
|
||||
* @param mixed $offset An offset to check for.
|
||||
* @return bool true on success or false on failure.
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
return array_key_exists($offset, $this->children);
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ abstract class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getTitle()
|
||||
public function getTitle(): string
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
@ -89,7 +89,7 @@ abstract class Entry
|
||||
/**
|
||||
* @param string $title
|
||||
*/
|
||||
public function setTitle($title)
|
||||
public function setTitle(string $title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
@ -97,7 +97,7 @@ abstract class Entry
|
||||
/**
|
||||
* @return Directory
|
||||
*/
|
||||
public function getParent()
|
||||
public function getParent(): ?Directory
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
@ -134,7 +134,7 @@ abstract class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getPath()
|
||||
public function getPath(): string
|
||||
{
|
||||
return $this->path;
|
||||
}
|
||||
@ -144,7 +144,7 @@ abstract class Entry
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRelativePath()
|
||||
public function getRelativePath(): string
|
||||
{
|
||||
$root = $this;
|
||||
while ($root->getParent() != null) {
|
||||
@ -157,7 +157,7 @@ abstract class Entry
|
||||
/**
|
||||
* @return SplFileInfo
|
||||
*/
|
||||
public function getFileinfo()
|
||||
public function getFileinfo(): SplFileInfo
|
||||
{
|
||||
return $this->info;
|
||||
}
|
||||
@ -165,7 +165,7 @@ abstract class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
public function getUrl(): string
|
||||
{
|
||||
$url = '';
|
||||
|
||||
|
@ -24,7 +24,7 @@ class Root extends Directory
|
||||
/**
|
||||
* @return Config
|
||||
*/
|
||||
public function getConfig()
|
||||
public function getConfig(): Config
|
||||
{
|
||||
return $this->config;
|
||||
}
|
||||
@ -32,12 +32,12 @@ class Root extends Directory
|
||||
/**
|
||||
* @param Config $config
|
||||
*/
|
||||
public function setConfig($config)
|
||||
public function setConfig(Config $config)
|
||||
{
|
||||
$this->config = $config;
|
||||
}
|
||||
|
||||
public function isHotPath(Entry $node = null) {
|
||||
public function isHotPath(Entry $node = null): bool {
|
||||
if ($node == null) {
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user