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 ebbb385

Browse files
committed
Adding PHPStan
1 parent 0e8c4fc commit ebbb385

File tree

10 files changed

+27
-17
lines changed

10 files changed

+27
-17
lines changed

‎composer.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"phpfui/html-unit-tester": "^1.0",
3030
"roave/security-advisories": "dev-latest",
3131
"phpfui/phpunit-syntax-coverage": "^1.0",
32-
"friendsofphp/php-cs-fixer": "^3.0"
32+
"friendsofphp/php-cs-fixer": "^3.0",
33+
"phpstan/phpstan": "^1.8"
3334
}
3435
}

‎phpstan.neon.dist‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
parameters:
2+
level: 4
3+
errorFormat: raw
4+
editorUrl: '%%file%% %%line%% %%column%%: %%error%%'
5+
paths:
6+
- src
7+
excludePaths:
8+
- src/PHPFUI/InstaDoc/Tests/*

‎src/PHPFUI/InstaDoc/Controller.php‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ class Controller
7575

7676
private string $homeUrl = '#';
7777

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

8080
private \PHPFUI\InstaDoc\PageInterface $page;
8181

@@ -150,7 +150,7 @@ public function display(array $classPagesToShow = Controller::VALID_CLASS_PAGES,
150150
}
151151
$section = new Section($this);
152152

153-
$div = new \PHPFUI\GridX('div');
153+
$div = new \PHPFUI\GridX();
154154
$div->add($section->getBreadCrumbs($fullClassName));
155155

156156
$cell = new \PHPFUI\Cell();
@@ -541,6 +541,8 @@ public function getUrl(array $parameters) : string
541541
public function setAccessTabs(array $tabs) : Controller
542542
{
543543
$this->accessTabs = $tabs;
544+
545+
return $this;
544546
}
545547

546548
/**

‎src/PHPFUI/InstaDoc/FileManager.php‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,20 +126,19 @@ public function getComposerPath() : string
126126
/**
127127
* Load the namespace index.
128128
*
129-
* @return true if file exists, false if generated
129+
* @return bool true if file exists, false if generated
130130
*/
131131
public function load(string $fileName = '') : bool
132132
{
133-
$returnValue = true;
134-
135133
if (! \PHPFUI\InstaDoc\NamespaceTree::load($this->getSerializedName($fileName)))
136134
{
137135
$this->rescan();
138136
$this->save();
139-
$returnValue = false;
137+
138+
return false;
140139
}
141140

142-
return $returnValue;
141+
return true;
143142
}
144143

145144
/**

‎src/PHPFUI/InstaDoc/MarkDownParser.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function text(string $markdown) : string
4343
$highlighted = $hl->highlight('php', $child->text());
4444
$block->setAttribute('class', 'hljs ' . $highlighted->language);
4545
$block->parentNode()->setAttribute('class', 'hljs ' . $highlighted->language);
46-
$child->plainText = \htmlspecialchars_decode($highlighted->value);
46+
$child->plaintext = \htmlspecialchars_decode($highlighted->value);
4747
}
4848
$div->add("{$dom}");
4949

‎src/PHPFUI/InstaDoc/Page.php‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ class Page extends \PHPFUI\Page implements \PHPFUI\InstaDoc\PageInterface
1212

1313
private \PHPFUI\Cell $mainColumn;
1414

15-
private \PHPFUI\Menu $menu;
16-
1715
public function __construct(\PHPFUI\InstaDoc\Controller $controller)
1816
{
1917
parent::__construct();
@@ -33,8 +31,6 @@ public function addBody($item) : PageInterface
3331

3432
public function create(\PHPFUI\Menu $menu) : void
3533
{
36-
$this->menu = $menu;
37-
3834
$link = new \PHPFUI\Link($this->homeUrl, $this->getPageName(), false);
3935

4036
$titleBar = new \PHPFUI\TitleBar($link);

‎src/PHPFUI/InstaDoc/PageInterface.php‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
namespace PHPFUI\InstaDoc;
44

5-
interface PageInterface
5+
interface PageInterfaceextends \PHPFUI\Interfaces\Page
66
{
77
public function __construct(Controller $controller);
88

@@ -15,4 +15,6 @@ public function create(\PHPFUI\Menu $menu) : void;
1515
public function setGenerating(string $generating) : PageInterface;
1616

1717
public function setHomeUrl(string $url) : PageInterface;
18+
19+
public static function setDebug(int $level = 0) : void;
1820
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public function __construct(\PHPFUI\InstaDoc\Controller $controller)
1111
parent::__construct($controller);
1212
}
1313

14-
public function generate(\PHPFUI\Instadoc\PageInterface $page, string $fullClassPath) : \PHPFUI\Container
14+
public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClassPath) : \PHPFUI\Container
1515
{
1616
$container = new \PHPFUI\Container();
1717

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public function __construct(\PHPFUI\InstaDoc\Controller $controller)
99
parent::__construct($controller);
1010
}
1111

12-
public function generate(\PHPFUI\Instadoc\PageInterface $page, string $fullClassPath) : \PHPFUI\Container
12+
public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClassPath) : \PHPFUI\Container
1313
{
1414
$container = new \PHPFUI\Container();
1515

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

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

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

1414
$offset = $this->controller->getGitFileOffset();
@@ -51,6 +51,8 @@ public function generate(\PHPFUI\InstaDoc\PageInterface $page, string $fullClass
5151
return $container;
5252
}
5353

54+
$count = (int)$count;
55+
$limit = (int)$limit;
5456
$lastPage = (int)(($count - 1) / $limit) + 1;
5557

5658
$log->setOffset($gitPage * $limit);

0 commit comments

Comments
(0)

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