hendr1x
hendr1x

Reputation: 1501

No DocBlock was found

I can't make this error go away. I've tried:

My code:

<?php
/**
 * Number manipulation class
 *
 * This class handles any methods that are used
 * to manipulate numbers
 *
 * @version 1.0
 * @package core
 * @category class
 * @author MY NAME HERE
 * @license MIT http://opensource.org/licenses/MIT
 */
namespace limber\core;

class Num
{
    /**
     * Random number generator
     *
     * @param $length int The length of the number required
     * @return $num int A random number
     * @author Unknown
     */
    public static function random($length = 8)
    {
        $characters = "0123456789abcdefghijklmnopqrstuvwxyz";
        $num = "";
        for ($p = 0; $p < $length; $p++) {
            $num .= $characters[mt_rand(0, strlen($characters))];
        }
        return $num;
    }
}

Upvotes: 0

Views: 218

Answers (1)

ashnazg
ashnazg

Reputation: 6688

From phpdDocumentor's perspective, it sees a file-level docblock, followed by a namespace declaration that does not have its own docblock, then a class that does not have its own docblock. The warning message you get is likely concerning the class not having a docblock.

Try moving your outer docblock to appear right above your class, as it looks like that was the point of its contents. Add a new docblock at the start of the file, to represent the file itself. Add another docblock right above the namespace declaration, to represent the namespacing. I think this will clear that warning from your runtime output.

Upvotes: 1

Related Questions