Improve type hinting

This commit is contained in:
Daniel Rudolf 2015-11-25 04:07:46 +01:00
parent 2982f5deb9
commit 840d41bca5
5 changed files with 24 additions and 24 deletions

View File

@ -1031,7 +1031,7 @@ class Pico
* *
* @see Pico::readPages() * @see Pico::readPages()
* @see Pico::sortPages() * @see Pico::sortPages()
* @return array|null the data of all pages * @return array[]|null the data of all pages
*/ */
public function getPages() public function getPages()
{ {

View File

@ -67,7 +67,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* *
* @see DummyPlugin::onPluginsLoaded() * @see DummyPlugin::onPluginsLoaded()
*/ */
public function onPluginsLoaded(&$plugins) public function onPluginsLoaded(array &$plugins)
{ {
if (!empty($plugins)) { if (!empty($plugins)) {
foreach ($plugins as $plugin) { foreach ($plugins as $plugin) {
@ -110,7 +110,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* @param mixed[] &$realConfig array of config variables * @param mixed[] &$realConfig array of config variables
* @return void * @return void
*/ */
public function onConfigLoaded(&$realConfig) public function onConfigLoaded(array &$realConfig)
{ {
global $config; global $config;
@ -167,7 +167,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* @param mixed[] &$realConfig array of config variables * @param mixed[] &$realConfig array of config variables
* @return void * @return void
*/ */
protected function loadRootDirConfig(&$realConfig) protected function loadRootDirConfig(array &$realConfig)
{ {
if (file_exists($this->getRootDir() . 'config.php')) { if (file_exists($this->getRootDir() . 'config.php')) {
// config.php in Pico::$rootDir is deprecated // config.php in Pico::$rootDir is deprecated
@ -284,7 +284,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* *
* @see DummyPlugin::onMetaHeaders() * @see DummyPlugin::onMetaHeaders()
*/ */
public function onMetaHeaders(&$headers) public function onMetaHeaders(array &$headers)
{ {
$this->triggerEvent('before_read_file_meta', array(&$headers)); $this->triggerEvent('before_read_file_meta', array(&$headers));
} }
@ -294,7 +294,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* *
* @see DummyPlugin::onMetaParsed() * @see DummyPlugin::onMetaParsed()
*/ */
public function onMetaParsed(&$meta) public function onMetaParsed(array &$meta)
{ {
$this->triggerEvent('file_meta', array(&$meta)); $this->triggerEvent('file_meta', array(&$meta));
} }
@ -328,7 +328,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* *
* @see DummyPlugin::onSinglePageLoaded() * @see DummyPlugin::onSinglePageLoaded()
*/ */
public function onSinglePageLoaded(&$pageData) public function onSinglePageLoaded(array &$pageData)
{ {
$this->triggerEvent('get_page_data', array(&$pageData, $pageData['meta'])); $this->triggerEvent('get_page_data', array(&$pageData, $pageData['meta']));
} }
@ -344,7 +344,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* *
* @see DummyPlugin::onPagesLoaded() * @see DummyPlugin::onPagesLoaded()
*/ */
public function onPagesLoaded(&$pages, &$currentPage, &$previousPage, &$nextPage) public function onPagesLoaded(array &$pages, array &$currentPage = null, array &$previousPage = null, array &$nextPage = null)
{ {
// remove keys of pages array // remove keys of pages array
$plainPages = array(); $plainPages = array();
@ -391,7 +391,7 @@ class PicoDeprecated extends AbstractPicoPlugin
* *
* @see DummyPlugin::onPageRendering() * @see DummyPlugin::onPageRendering()
*/ */
public function onPageRendering(&$twig, &$twigVariables, &$templateName) public function onPageRendering(Twig_Environment &$twig, array &$twigVariables, &$templateName)
{ {
// template name contains file extension since Pico 1.0 // template name contains file extension since Pico 1.0
$fileExtension = ''; $fileExtension = '';

View File

@ -30,7 +30,7 @@ class PicoParsePagesContent extends AbstractPicoPlugin
* *
* @see DummyPlugin::onSinglePageLoaded() * @see DummyPlugin::onSinglePageLoaded()
*/ */
public function onSinglePageLoaded(&$pageData) public function onSinglePageLoaded(array &$pageData)
{ {
if (!isset($pageData['content'])) { if (!isset($pageData['content'])) {
$pageData['content'] = $this->prepareFileContent($pageData['raw_content'], $pageData['meta']); $pageData['content'] = $this->prepareFileContent($pageData['raw_content'], $pageData['meta']);

View File

@ -40,7 +40,7 @@ class PicoExcerpt extends AbstractPicoPlugin
* *
* @see DummyPlugin::onConfigLoaded() * @see DummyPlugin::onConfigLoaded()
*/ */
public function onConfigLoaded(&$config) public function onConfigLoaded(array &$config)
{ {
if (!isset($config['excerpt_length'])) { if (!isset($config['excerpt_length'])) {
$config['excerpt_length'] = 50; $config['excerpt_length'] = 50;
@ -53,7 +53,7 @@ class PicoExcerpt extends AbstractPicoPlugin
* @see PicoExcerpt::createExcerpt() * @see PicoExcerpt::createExcerpt()
* @see DummyPlugin::onSinglePageLoaded() * @see DummyPlugin::onSinglePageLoaded()
*/ */
public function onSinglePageLoaded(&$pageData) public function onSinglePageLoaded(array &$pageData)
{ {
if (!isset($pageData['excerpt'])) { if (!isset($pageData['excerpt'])) {
$pageData['excerpt'] = $this->createExcerpt( $pageData['excerpt'] = $this->createExcerpt(

View File

@ -40,7 +40,7 @@ class DummyPlugin extends AbstractPicoPlugin
* @param object[] &$plugins loaded plugin instances * @param object[] &$plugins loaded plugin instances
* @return void * @return void
*/ */
public function onPluginsLoaded(&$plugins) public function onPluginsLoaded(array &$plugins)
{ {
// your code // your code
} }
@ -52,7 +52,7 @@ class DummyPlugin extends AbstractPicoPlugin
* @param mixed[] &$config array of config variables * @param mixed[] &$config array of config variables
* @return void * @return void
*/ */
public function onConfigLoaded(&$config) public function onConfigLoaded(array &$config)
{ {
// your code // your code
} }
@ -141,7 +141,7 @@ class DummyPlugin extends AbstractPicoPlugin
* array key is later used to access the found value * array key is later used to access the found value
* @return void * @return void
*/ */
public function onMetaHeaders(&$headers) public function onMetaHeaders(array &$headers)
{ {
// your code // your code
} }
@ -155,7 +155,7 @@ class DummyPlugin extends AbstractPicoPlugin
* @param string[] &$headers known meta header fields * @param string[] &$headers known meta header fields
* @return void * @return void
*/ */
public function onMetaParsing(&$rawContent, &$headers) public function onMetaParsing(&$rawContent, array &$headers)
{ {
// your code // your code
} }
@ -167,7 +167,7 @@ class DummyPlugin extends AbstractPicoPlugin
* @param string[] &$meta parsed meta data * @param string[] &$meta parsed meta data
* @return void * @return void
*/ */
public function onMetaParsed(&$meta) public function onMetaParsed(array &$meta)
{ {
// your code // your code
} }
@ -249,7 +249,7 @@ class DummyPlugin extends AbstractPicoPlugin
* @param array &$pageData data of the loaded page * @param array &$pageData data of the loaded page
* @return void * @return void
*/ */
public function onSinglePageLoaded(&$pageData) public function onSinglePageLoaded(array &$pageData)
{ {
// your code // your code
} }
@ -264,13 +264,13 @@ class DummyPlugin extends AbstractPicoPlugin
* @see Pico::getCurrentPage() * @see Pico::getCurrentPage()
* @see Pico::getPreviousPage() * @see Pico::getPreviousPage()
* @see Pico::getNextPage() * @see Pico::getNextPage()
* @param array &$pages data of all known pages * @param array[] &$pages data of all known pages
* @param array &$currentPage data of the page being served * @param array|null &$currentPage data of the page being served
* @param array &$previousPage data of the previous page * @param array|null &$previousPage data of the previous page
* @param array &$nextPage data of the next page * @param array|null &$nextPage data of the next page
* @return void * @return void
*/ */
public function onPagesLoaded(&$pages, &$currentPage, &$previousPage, &$nextPage) public function onPagesLoaded(array &$pages, array &$currentPage = null, array &$previousPage = null, array &$nextPage = null)
{ {
// your code // your code
} }
@ -295,7 +295,7 @@ class DummyPlugin extends AbstractPicoPlugin
* @param string &$templateName file name of the template * @param string &$templateName file name of the template
* @return void * @return void
*/ */
public function onPageRendering(&$twig, &$twigVariables, &$templateName) public function onPageRendering(Twig_Environment &$twig, array &$twigVariables, &$templateName)
{ {
// your code // your code
} }