Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f675ef9

Browse files
committed
phpstan level 5
1 parent ebbb385 commit f675ef9

File tree

9 files changed

+26
-17
lines changed

9 files changed

+26
-17
lines changed

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PHPFUI\InstaDoc Library [![Tests](https://github.com/phpfui/InstaDoc/actions/workflows/tests.yml/badge.svg)](https://github.com/phpfui/InstaDoc/actions?query=workflow%3Atests) [![Latest Packagist release](https://img.shields.io/packagist/v/phpfui/InstaDoc.svg)](https://packagist.org/packages/phpfui/InstaDoc)
1+
# PHPFUI\InstaDoc Library [![Tests](https://github.com/phpfui/InstaDoc/actions/workflows/tests.yml/badge.svg)](https://github.com/phpfui/InstaDoc/actions?query=workflow%3Atests) [![Latest Packagist release](https://img.shields.io/packagist/v/phpfui/InstaDoc.svg)](https://packagist.org/packages/phpfui/InstaDoc)![](https://img.shields.io/badge/PHPStan-level%205-brightgreen.svg?style=flat)
22

33
## A quick and easy way to add documentation to your PHP project
44

‎phpstan.neon.dist‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
level: 4
2+
level: 5
33
errorFormat: raw
44
editorUrl: '%%file%% %%line%% %%column%%: %%error%%'
55
paths:

‎src/PHPFUI/InstaDoc/NamespaceTree.php‎

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

55
class NamespaceTree
66
{
7-
private static $activeClass;
7+
private static string$activeClass;
88

9-
private static $activeNamespace;
9+
private static string$activeNamespace;
1010

1111
/**
1212
* @var array indexed by namespace part containing a NamespaceTree
@@ -38,9 +38,9 @@ class NamespaceTree
3838
/**
3939
* @var NamespaceTree our parent
4040
*/
41-
private $parent = null;
41+
private ?NamespaceTree$parent = null;
4242

43-
private static $root = null;
43+
private static ?NamespaceTree$root = null;
4444

4545
// only we can make us to ensure the tree is good
4646
private function __construct()
@@ -346,6 +346,7 @@ public static function sort(?NamespaceTree $tree = null) : void
346346
}
347347
}
348348

349+
/** @phpstan-ignore-next-line */
349350
private function getMenuTree(NamespaceTree $tree, \PHPFUI\Menu $menu) : \PHPFUI\Menu
350351
{
351352
$currentMenu = new \PHPFUI\Menu();

‎src/PHPFUI/InstaDoc/Page.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,9 @@ private function addConfigModal(\PHPFUI\HTML5Element $modalLink) : void
134134
$cssSelector->setToolTip('Sets the style sheet for PHP code');
135135
$fieldSet->add($cssSelector);
136136

137-
$tabStop = new \PHPFUI\Input\Number(Controller::TAB_SIZE, 'Tab Stop Spaces', $this->controller->getParameter(Controller::TAB_SIZE, 2));
138-
$tabStop->setAttribute('min', 0);
139-
$tabStop->setAttribute('max', 10);
137+
$tabStop = new \PHPFUI\Input\Number(Controller::TAB_SIZE, 'Tab Stop Spaces', $this->controller->getParameter(Controller::TAB_SIZE, '2'));
138+
$tabStop->setAttribute('min', '0');
139+
$tabStop->setAttribute('max', '10');
140140
$tabStop->setToolTip('Indent tabbed files with this number of spaces');
141141
$fieldSet->add($tabStop);
142142

‎src/PHPFUI/InstaDoc/Section/CodeCommon.php‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public function __construct(\PHPFUI\InstaDoc\Controller $controller, string $ful
2424

2525
try
2626
{
27+
/** @phpstan-ignore-next-line */
2728
$this->reflection->isInstantiable();
2829
}
2930
catch (\Throwable $e)
@@ -66,7 +67,7 @@ public function getMethodParameters($method, array $parameterComments = []) : st
6667
if (isset($parameterComments[$name]))
6768
{
6869
$tip = new \PHPFUI\ToolTip($tip, $parameterComments[$name]);
69-
$tip->addAttribute('data-allow-html', true);
70+
$tip->addAttribute('data-allow-html');
7071
}
7172
$info .= $this->getColor('variable', $tip);
7273

@@ -176,7 +177,7 @@ public function getValueString($value) : string
176177
break;
177178

178179
default:
179-
$value = $this->getColor('number', $value);
180+
$value = $this->getColor('number', (string)$value);
180181
}
181182

182183
return $value;
@@ -247,6 +248,7 @@ protected function formatComments(?\phpDocumentor\Reflection\DocBlock $docBlock,
247248

248249
if (\method_exists($tag, 'getAuthorName'))
249250
{
251+
/** @phpstan-ignore-next-line */
250252
$body .= \PHPFUI\Link::email($tag->getEmail(), $tag->getAuthorName());
251253
}
252254

@@ -520,6 +522,7 @@ protected function getParameterComments(?\phpDocumentor\Reflection\DocBlock $doc
520522

521523
if ('param' == $name && $description)
522524
{
525+
/** @phpstan-ignore-next-line */
523526
$var = $tag->getVariableName();
524527
$comments[$var] = $this->parsedown->html($description);
525528
}

‎src/PHPFUI/InstaDoc/Section/Doc.php‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClass
2323

2424
try
2525
{
26+
/** @phpstan-ignore-next-line */
2627
$this->reflection->isInstantiable();
2728
}
2829
catch (\Throwable $e)
@@ -194,6 +195,8 @@ public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClass
194195

195196
$parent = $this->reflection->getParentClass();
196197

198+
$allMenuItem = null;
199+
197200
if ($parentNames)
198201
{
199202
$parts = \array_merge(['All', 'self'], $parentNames);
@@ -438,6 +441,7 @@ protected function getProperty(\ReflectionProperty $property) : string
438441

439442
if ($type)
440443
{
444+
/** @phpstan-ignore-next-line */
441445
$info .= $this->getColor('type', $this->getClassName($type->getName())) . '';
442446
}
443447
$info .= $this->getName($property, $this->getColor('variable', '$' . $property->getName()));

‎src/PHPFUI/InstaDoc/Section/File.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClass
1414
{
1515
$fullClassPath = $this->controller->getGitFileOffset() . '/' . $fullClassPath;
1616
}
17-
$ts = $this->controller->getParameter(\PHPFUI\InstaDoc\Controller::TAB_SIZE, 2);
17+
$ts = $this->controller->getParameter(\PHPFUI\InstaDoc\Controller::TAB_SIZE, '2');
1818

1919
$page->addCSS("code{tab-size:{$ts};-moz-tab-size:{$ts}}");
2020
$php = @\file_get_contents($fullClassPath);

‎src/PHPFUI/InstaDoc/Section/Git.php‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClass
88
{
99
$container = new \PHPFUI\Container();
1010

11-
$gitPage = (int)$this->controller->getParameter(\PHPFUI\InstaDoc\Controller::GIT_ONPAGE, 0);
12-
$limit = $this->controller->getParameter(\PHPFUI\InstaDoc\Controller::GIT_LIMIT, 20);
11+
$gitPage = (int)$this->controller->getParameter(\PHPFUI\InstaDoc\Controller::GIT_ONPAGE, '0');
12+
$limit = $this->controller->getParameter(\PHPFUI\InstaDoc\Controller::GIT_LIMIT, '20');
1313

1414
$offset = $this->controller->getGitFileOffset();
1515

@@ -40,7 +40,7 @@ public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClass
4040

4141
try
4242
{
43-
$log = $repo->getLog($branch, $fullClassPath, 0, 10);
43+
$log = $repo->getLog([$branch], [$fullClassPath], 0, 10);
4444
$count = $log->count();
4545
}
4646
catch (\Exception $e)
@@ -85,7 +85,7 @@ public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClass
8585

8686
$container->add($table);
8787

88-
$this->controller->setParameter(\PHPFUI\InstaDoc\Controller::GIT_LIMIT, $limit);
88+
$this->controller->setParameter(\PHPFUI\InstaDoc\Controller::GIT_LIMIT, (string)$limit);
8989
$this->controller->setParameter(\PHPFUI\InstaDoc\Controller::GIT_ONPAGE, 'PAGE');
9090

9191
$paginator = new \PHPFUI\Pagination($gitPage, $lastPage, $this->controller->getUrl($this->controller->getParameters()));
@@ -98,6 +98,7 @@ public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClass
9898

9999
private function getReveal(\PHPFUI\InstaDoc\PageInterface $page, \PHPFUI\HTML5Element $opener, string $url) : \PHPFUI\Reveal
100100
{
101+
/** @phpstan-ignore-next-line */
101102
$reveal = new \PHPFUI\Reveal($page, $opener);
102103
$reveal->addClass('large');
103104
$div = new \PHPFUI\HTML5Element('div');

‎src/PHPFUI/InstaDoc/Section/GitDiff.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClass
1010
$container = new \PHPFUI\Container();
1111

1212
$sha1 = $this->controller->getParameter(\PHPFUI\InstaDoc\Controller::GIT_SHA1);
13-
$tabSize = \str_pad('', (int)$this->controller->getParameter(\PHPFUI\InstaDoc\Controller::TAB_SIZE, 2));
13+
$tabSize = \str_pad('', (int)$this->controller->getParameter(\PHPFUI\InstaDoc\Controller::TAB_SIZE, '2'));
1414

1515
try
1616
{

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /