# PHPSTAN settings correctly

**URL:** <https://discourse.cakephp.org/t/phpstan-settings-correctly/11607>\
**Category:** Testing\
**Created:** [November 1, 2023, 6:42pm UTC](https://discourse.cakephp.org/t/phpstan-settings-correctly/11607 "2023-11-01T18:42:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![shadowx.jb](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@shadowx.jb](https://discourse.cakephp.org/u/shadowx.jb)\
**Post date:** [November 1, 2023, 6:42pm UTC](https://discourse.cakephp.org/t/phpstan-settings-correctly/11607/1 "2023-11-01T18:42:19Z")

</div>

Please advise how to set up PHPSTAN correctly?

For example, this gives me errors.

```auto
Function __x not found.

```

```auto
Method App\Controller\Component\ConfigComponent::initialize() has parameter $config with no value type specified in iterable type array. 

```

And other…

Thank You

---

<div class="post-metadata">

**Author:** ![KevinPfeifer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kevinpfeifer/32/3365_2.png) [@KevinPfeifer](https://discourse.cakephp.org/u/KevinPfeifer)\
**Post date:** [November 1, 2023, 6:56pm UTC](https://discourse.cakephp.org/t/phpstan-settings-correctly/11607/2 "2023-11-01T18:56:51Z")

</div>

I showcased this in our recent Cakfest. See [https://www.youtube.com/live/GaCqzBuX5sc?si=WdzQR53qldnR5ar7&t=10548](https://www.youtube.com/live/GaCqzBuX5sc?si=WdzQR53qldnR5ar7&t=10548)

As I mentioned in this I would recommend you start at level 0 and fix all errors on that level.  
Then increment the level by one and check again.  
Repeat this procedure till you can’t fix problems easily any more (which may happen at level 6 or 7)

---

<div class="post-metadata">

**Author:** ![shadowx.jb](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@shadowx.jb](https://discourse.cakephp.org/u/shadowx.jb)\
**Post date:** [November 1, 2023, 7:13pm UTC](https://discourse.cakephp.org/t/phpstan-settings-correctly/11607/3 "2023-11-01T19:13:53Z")

</div>

Thank You! I will try

---

<div class="post-metadata">

**Author:** ![KariZulauf](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@KariZulauf](https://discourse.cakephp.org/u/KariZulauf)\
**Post date:** [November 20, 2023, 12:46pm UTC](https://discourse.cakephp.org/t/phpstan-settings-correctly/11607/4 "2023-11-20T12:46:27Z")

</div>

I also want to know. Any update?

---

<div class="post-metadata">

**Author:** ![KevinPfeifer](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/kevinpfeifer/32/3365_2.png) [@KevinPfeifer](https://discourse.cakephp.org/u/KevinPfeifer)\
**Post date:** [November 20, 2023, 1:11pm UTC](https://discourse.cakephp.org/t/phpstan-settings-correctly/11607/5 "2023-11-20T13:11:16Z")

</div>

What specific problem do you have.  
Usually what is currently present inside

> <https://github.com/cakephp/app/blob/5.x/phpstan.neon#L5-L6>

is enough to make these kinds of `Function __x not found.` disappear

---

<div class="post-metadata">

**Author:** ![KariZulauf](https://avatars.discourse-cdn.com/v4/letter/k/aca169/32.png) [@KariZulauf](https://discourse.cakephp.org/u/KariZulauf)\
**Post date:** [November 21, 2023, 4:45am UTC](https://discourse.cakephp.org/t/phpstan-settings-correctly/11607/6 "2023-11-21T04:45:25Z")

</div>

> [@shadowx.jb](#):
>
> Please advise how to set up PHPSTAN correctly?
> 
> For example, this gives me errors.
> 
> ```auto
> Function __x not found.
> 
> ```
> 
> ```auto
> Method App\Controller\Component\ConfigComponent::initialize() has parameter $config with no value type specified in iterable type array. 
> 
> ```
> 
> > ****
> >
> > I also want to know. Any update? For anyone seeking the universities in a hurry for a research paper. The [https://www.topessaywriting.org/pay-for-research-paper](https://www.topessaywriting.org/pay-for-research-paper) website’s user-friendly interface and transparent payment system make the process stress-free. The team of experienced writers ensures top-notch quality, meeting academic standards with precision. I appreciate the timely delivery and the ability to communicate directly with the assigned writer, fostering a collaborative approach.
> 
> And other…
> 
> Thank You

I also want to know. Any update?

---

<div class="post-metadata">

**Author:** ![shadowx.jb](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@shadowx.jb](https://discourse.cakephp.org/u/shadowx.jb)\
**Post date:** [November 21, 2023, 7:12am UTC](https://discourse.cakephp.org/t/phpstan-settings-correctly/11607/7 "2023-11-21T07:12:20Z")

</div>

My config looks like this

```auto
parameters:
    level: 8
    checkMissingIterableValueType: false
    treatPhpDocTypesAsCertain: false
    checkGenericClassInNonGenericObjectType: false
    paths:
        - config/
        - src/
    excludePaths:
        - src/Console/Installer.php
    bootstrapFiles:
        - config/bootstrap.php
        - config/paths.php
        - vendor/cakephp/cakephp/src/I18n/functions_global.php
        - vendor/cakephp/cakephp/src/Core/functions_global.php
includes:
    - vendor/cakedc/cakephp-phpstan/extension.neon

```
