-
-
Notifications
You must be signed in to change notification settings - Fork 158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unlock phpstan level 5 #1924
Unlock phpstan level 5 #1924
Changes from 12 commits
cecc5da
1b376cb
8a9c0da
b32fbb8
013cbab
40272d1
135e0d0
baf6417
b49947d
d990f9a
1eb47e9
63da7dd
3c5beba
daf0e04
a07ffbf
e3b80e0
f18f3e5
ef6603e
c7a20c4
af4cf5d
77e2a4d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
use Contao\CoreBundle\ContaoCoreBundle; | ||
use Contao\CoreBundle\Exception\NoRootPageFoundException; | ||
use Contao\CoreBundle\Framework\ContaoFramework; | ||
use Contao\Model; | ||
use Contao\Model\Collection; | ||
use Contao\PageModel; | ||
use Contao\System; | ||
|
@@ -458,7 +457,7 @@ static function (Route $a, Route $b) use ($languages, $routes) { | |
} | ||
|
||
/** | ||
* @return array<Model> | ||
* @return array<PageModel> | ||
*/ | ||
private function findPages(array $candidates): array | ||
{ | ||
|
@@ -491,11 +490,12 @@ private function findPages(array $candidates): array | |
return []; | ||
} | ||
|
||
/** @var array<PageModel> */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a tough one. We would imo need to add generics to the Everything would look a bit like this I guess: https://phpstan.org/r/15377a79-1be1-4f2d-999f-f1ae9dbe37f0 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you want to try? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Challenge accepted. Are you ok with all those tags? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I am. We are already using them in the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had a deep dive into the topic. Most of the things could theoretically be solved by having a Unfortunately, in reality this doesn't work as expected because we're unfortunately using It would possibly work to create our own extension, but well... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Feel free to modify https://github.com/contao/phpstan 😎 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If I only knew how. 😄 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have created a follow-up issue here: #1940 |
||
return $pages->getModels(); | ||
} | ||
|
||
/** | ||
* @return array<Model> | ||
* @return array<PageModel> | ||
*/ | ||
private function findRootPages(string $httpHost): array | ||
{ | ||
|
@@ -523,12 +523,14 @@ private function findRootPages(string $httpHost): array | |
$pages = $pageModel->findBy(["(tl_page.type='root' AND (tl_page.dns=? OR tl_page.dns=''))"], $httpHost); | ||
|
||
if ($pages instanceof Collection) { | ||
/** @var array<PageModel> $rootPages */ | ||
$rootPages = $pages->getModels(); | ||
} | ||
|
||
$pages = $pageModel->findBy(["tl_page.alias='index' OR tl_page.alias='/'"], null); | ||
|
||
if ($pages instanceof Collection) { | ||
/** @var array<PageModel> $indexPages */ | ||
$indexPages = $pages->getModels(); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(This was introduced with #1917 and therefore must not be backported.)