Skip to content

Commit

Permalink
fix: phpdoc errors reported by phpstan
Browse files Browse the repository at this point in the history
  • Loading branch information
williamdes committed Dec 8, 2019
1 parent a1596a5 commit 4176e94
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/KBDocumentation.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function getAnchor(): ?string
* Used for json_encode function
* This can seem useless, do not remove it.
*
* @return array
* @return array<string,string>
*/
public function jsonSerialize(): array
{
Expand Down
2 changes: 1 addition & 1 deletion src/KBEntry.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ public function addDocumentation(string $url, ?string $anchor = null ): KBDocume
* Used for json_encode function
* This can seem useless, do not remove it.
*
* @return array
* @return array<string,array<KBDocumentation>|bool|string>>
*/
public function jsonSerialize(): array
{
Expand Down
22 changes: 14 additions & 8 deletions src/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ class Search
*/
public static $loaded = false;

public const ANY = -1;
public const MYSQL = 1;
public const MARIADB = 2;
public const DS = DIRECTORY_SEPARATOR;
public static $DATA_DIR = __DIR__.self::DS."..".self::DS."dist".self::DS;
public const ANY = -1;
public const MYSQL = 1;
public const MARIADB = 2;
public const DS = DIRECTORY_SEPARATOR;

/**
* The directory where the data is located
*
* @var string
*/
public static $DATA_DIR = __DIR__ . self::DS . ".." . self::DS . "dist" . self::DS;

/**
* Load data from disk
Expand Down Expand Up @@ -127,7 +133,7 @@ public static function getVariableType(string $name): string
/**
* Return the list of static variables
*
* @return array
* @return array<int,string>
*/
public static function getStaticVariables(): array
{
Expand All @@ -137,7 +143,7 @@ public static function getStaticVariables(): array
/**
* Return the list of dynamic variables
*
* @return array
* @return array<int,string>
*/
public static function getDynamicVariables(): array
{
Expand All @@ -148,7 +154,7 @@ public static function getDynamicVariables(): array
* Return the list of variables having dynamic = $dynamic
*
* @param bool $dynamic dynamic=true/dynamic=false
* @return array
* @return array<int,string>
*/
public static function getVariablesWithDynamic(bool $dynamic): array
{
Expand Down
14 changes: 7 additions & 7 deletions src/SlimData.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ class SlimData extends stdClass implements JsonSerializable
/**
* Types of documentation
*
* @var array<string, string|int>
* @var array<string,int>
*/
private $types = array("MYSQL" => 1, "MARIADB" => 2);

/**
* Types of variables
*
* @var array<string, string|int>
* @var array<string,int>
*/
private $varTypes = array(
"string" => 1,
Expand All @@ -56,9 +56,9 @@ class SlimData extends stdClass implements JsonSerializable
/**
* Create a slimData object
*
* @param float|null $version The version
* @param array<string,string>|null $types The types of documentations
* @param array<string,string>|null $varTypes The types of variables
* @param float|null $version The version
* @param array<string,int>|null $types The types of documentations
* @param array<string,int>|null $varTypes The types of variables
*/
public function __construct(
?float $version = null,
Expand Down Expand Up @@ -97,7 +97,7 @@ public function addVariable(string $name, ?string $type, ?bool $dynamic): KBEntr
* Used for json_encode function
* This can seem useless, do not remove it.
*
* @return array
* @return array<string,array|float|stdClass>
*/
public function jsonSerialize(): array
{
Expand All @@ -113,7 +113,7 @@ public function jsonSerialize(): array

if ($var->getType() !== null) {
if (isset($this->varTypes[$var->getType()]) === false) {
$this->varTypes[$var->getType()] = "".(count($this->varTypes) + 1);
$this->varTypes[$var->getType()] = count($this->varTypes) + 1;
}

$variable->t = $this->varTypes[$var->getType()];
Expand Down

0 comments on commit 4176e94

Please sign in to comment.