Skip to content

Commit 3a9aeaf

Browse files
committed
Typed properties
1 parent 8e772d7 commit 3a9aeaf

File tree

9 files changed

+41
-41
lines changed

9 files changed

+41
-41
lines changed

src/PHPFUI/InstaDoc/ChildClasses.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ChildClasses
1010
/**
1111
* @var array indexed by fqn of class containing array of fqn of children
1212
*/
13-
private static $children = [];
13+
private static array $children = [];
1414

1515
/**
1616
* Generate child class information from all classes in NamespaceTree

src/PHPFUI/InstaDoc/Controller.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,29 +61,29 @@ class Controller
6161
Controller::PAGE,
6262
];
6363

64-
private $accessTabs = ['Public', 'Protected', 'Private', 'Static'];
64+
private array $accessTabs = ['Public', 'Protected', 'Private', 'Static'];
6565

66-
private $fileManager;
66+
private \PHPFUI\InstaDoc\FileManager $fileManager;
6767

68-
private $generating = '';
68+
private string $generating = '';
6969

70-
private $gitFileOffset = '';
70+
private string $gitFileOffset = '';
7171

72-
private $gitRoot = '';
72+
private string $gitRoot = '';
7373

74-
private $homePageMarkdown = [];
74+
private array $homePageMarkdown = [];
7575

76-
private $homeUrl = '#';
76+
private string $homeUrl = '#';
7777

78-
private $menu = null;
78+
private ?\PHPFUI\AccordionMenu $menu = null;
7979

80-
private $page;
80+
private \PHPFUI\InstaDoc\PageInterface $page;
8181

82-
private $parameters = [];
82+
private array $parameters = [];
8383

84-
private $siteTitle = 'PHPFUI/InstaDoc';
84+
private string $siteTitle = 'PHPFUI/InstaDoc';
8585

86-
public function __construct(FileManager $fileManager)
86+
public function __construct(\PHPFUI\InstaDoc\FileManager $fileManager)
8787
{
8888
$this->fileManager = $fileManager;
8989
$this->gitRoot = $fileManager->getComposerPath();
@@ -406,7 +406,7 @@ public function getNamespaceURL(string $namespace) : string
406406
/**
407407
* Gets a blank page and sets the page title. Override to change the generated page layout.
408408
*/
409-
public function getPage() : PageInterface
409+
public function getPage() : \PHPFUI\InstaDoc\PageInterface
410410
{
411411
$page = new Page($this);
412412

src/PHPFUI/InstaDoc/FileManager.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
class FileManager
66
{
7-
private $composerJsonPath = '';
7+
private string $composerJsonPath = '';
88

9-
private $configFile = '..';
9+
private string $configFile = '..';
1010

11-
private $extension = '.serial';
11+
private string $extension = '.serial';
1212

13-
private $fileName = '';
13+
private string $fileName = '';
1414

15-
private $excludedNamespaces = [];
15+
private array $excludedNamespaces = [];
1616

17-
private $includedNamespaces = [];
17+
private array $includedNamespaces = [];
1818

1919
/**
2020
* Make a FileManager. Pass a composer JSON path to use

src/PHPFUI/InstaDoc/MarkDownParser.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
class MarkDownParser
66
{
7-
private $parser;
7+
private \cebe\markdown\GithubMarkdown $parser;
88

9-
private $page;
9+
private \PHPFUI\Interfaces\Page $page;
1010

1111
public function __construct(\PHPFUI\Interfaces\Page $page)
1212
{

src/PHPFUI/InstaDoc/NamespaceTree.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,29 @@ class NamespaceTree
1111
/**
1212
* @var array indexed by namespace part containing a NamespaceTree
1313
*/
14-
private $children = [];
14+
private array $children = [];
1515

1616
/**
1717
* @var array indexed by fully qualified class name containing the file name
1818
*/
19-
private $classes = [];
19+
private array $classes = [];
2020

2121
private static $controller;
2222

2323
/**
2424
* @var bool true if this namespace is in the local git repo
2525
*/
26-
private $localGit = false;
26+
private bool $localGit = false;
2727

2828
/**
2929
* @var array of unique markdown files indexed by file name
3030
*/
31-
private $md = [];
31+
private array $md = [];
3232

3333
/**
3434
* @var string of the namespace part
3535
*/
36-
private $namespace = '';
36+
private string $namespace = '';
3737

3838
/**
3939
* @var NamespaceTree our parent

src/PHPFUI/InstaDoc/Page.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
class Page extends \PHPFUI\Page implements \PHPFUI\InstaDoc\PageInterface
66
{
7-
private $controller;
7+
private \PHPFUI\InstaDoc\Controller $controller;
88

9-
private $generating = '';
9+
private string $generating = '';
1010

11-
private $homeUrl = '#';
11+
private string $homeUrl = '#';
1212

13-
private $mainColumn;
13+
private \PHPFUI\Cell $mainColumn;
1414

15-
private $menu;
15+
private \PHPFUI\Menu $menu;
1616

17-
public function __construct(Controller $controller)
17+
public function __construct(\PHPFUI\InstaDoc\Controller $controller)
1818
{
1919
parent::__construct();
2020
$this->controller = $controller;

src/PHPFUI/InstaDoc/Section.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
*/
1010
class Section
1111
{
12-
protected $controller;
12+
protected \PHPFUI\InstaDoc\Controller $controller;
1313

14-
public function __construct(Controller $controller)
14+
public function __construct(\PHPFUI\InstaDoc\Controller $controller)
1515
{
1616
$this->controller = $controller;
1717
}

src/PHPFUI/InstaDoc/Section/CodeCommon.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
class CodeCommon extends \PHPFUI\InstaDoc\Section
66
{
7-
protected $factory;
7+
protected \phpDocumentor\Reflection\DocBlockFactory $factory;
88

9-
protected $parsedown;
9+
protected \PHPFUI\InstaDoc\MarkDownParser $parsedown;
1010

1111
protected $reflection;
1212

@@ -54,7 +54,7 @@ protected function formatComments(?\phpDocumentor\Reflection\DocBlock $docBlock,
5454
foreach ($tags as $tag)
5555
{
5656
$name = $tag->getName();
57-
$description = \method_exists($tag, 'getDescription') ? \trim($tag->getDescription()) : '';
57+
$description = \method_exists($tag, 'getDescription') ? \trim($tag->getDescription() ?? '') : '';
5858
$body = '';
5959
// punt on useless tags
6060
if (\in_array($name, ['method', 'inheritdoc']))
@@ -352,7 +352,7 @@ protected function getParameterComments(?\phpDocumentor\Reflection\DocBlock $doc
352352
foreach ($docBlock->getTags() as $tag)
353353
{
354354
$name = $tag->getName();
355-
$description = \method_exists($tag, 'getDescription') ? \trim($tag->getDescription()) : '';
355+
$description = \method_exists($tag, 'getDescription') ? \trim($tag->getDescription() ?? '') : '';
356356

357357
if ('param' == $name && $description)
358358
{

src/PHPFUI/InstaDoc/Section/Doc.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
class Doc extends \PHPFUI\InstaDoc\Section\CodeCommon
66
{
7-
private $class;
7+
private string $class;
88

99
public function __construct(\PHPFUI\InstaDoc\Controller $controller)
1010
{
@@ -456,7 +456,7 @@ protected function objectCompare($lhs, $rhs) : int
456456
return \strcasecmp($lhs->name, $rhs->name);
457457
}
458458

459-
protected function objectSort(array &$objects) : void
459+
protected function objectSort(array & $objects) : void
460460
{
461461
\usort($objects, [$this, 'objectCompare']);
462462
}

0 commit comments

Comments
 (0)