Skip to main content
Filter by
Sorted by
Tagged with
1 vote
0 answers
122 views

My data provider is sending arrays. The first element is always a string, the second one an array of Token. public static function dataProvider(): Generator { yield ['15', [new Token(15, Lexer::...
Alexandre Tranchant's user avatar
0 votes
2 answers
530 views

I am using PHPStan for static analysis on a PHP application, I have this set quite high which can be problematic at times and i'm getting the following error. public function generate(GetFileData $...
Zabs's user avatar
  • 14.2k
1 vote
1 answer
473 views

I have a method in an abstract parent class. The behaviour basically depends on wether the child class inherits an interface or not. How can I make phpstan recognize this conditional (in this case &...
Zoomyboy's user avatar
4 votes
2 answers
371 views

I am currently in the process of migrating a large, super-legacy codebase to PHP 8.x, and I am utilizing PHPStan to identify potential issues. However, I have encountered a challenge related to the ...
elixon's user avatar
  • 1,332
0 votes
1 answer
336 views

I am using PHPStan within a Laravel 10 app and have set this to quite a high level (good practice I guess) - I have run into a few errors and i'm trying to figure out the best way to resolve them. ---...
Zabs's user avatar
  • 14.2k
1 vote
1 answer
965 views

I have a web application which is running on CakePHP 4.4.4 I have recently started using PHPStan with the codebase running at level 1. This level is specified in our configuration file, phpstan.neon ...
Andy's user avatar
  • 5,438
3 votes
4 answers
4k views

We recently started using PHPStan 1.10 at level 6 in a Laravel 10 PHP 8.2 project. It reports a few remaining issues in the following model that I would like to fix. class ArticlePrice extends Model { ...
Sitethief's user avatar
  • 780
0 votes
1 answer
166 views

I have this code: class CsvWriter { private $handle; public function openToFile($filePath): void { $this->handle = fopen($filePath, 'wb+'); if (false === $this->...
Calamity Jane's user avatar
0 votes
1 answer
245 views

On laravel 10 site I added with wendelladriel/laravel-validated-dto package app/DTO/ItemsFilterDTO.php class with methods : <?php namespace App\DTO; use WendellAdriel\ValidatedDTO\Casting\...
Petro Gromovo's user avatar
-1 votes
1 answer
400 views

On laravel 10 site running phpstan on method /** * Retrieve user getItemss related to getItems by $itemId * * param int $itemId - getItems id * * @return JsonResponse with ...
Petro Gromovo's user avatar
1 vote
1 answer
643 views

I have an CodeIgniter 4 application, and I am using PHPStan to help me with static analysis. My problem is that PHPStan complain that he can not find the CodeIgniter 4 functions. I check the PHPStan ...
D.B.'s user avatar
  • 131
0 votes
0 answers
27 views

I am asking if there is a way to sort by a second-order table without triggering the static analysis. I have several related tables and I'm trying to sort the results by a related column. For my ...
mankowitz's user avatar
  • 2,115
-2 votes
2 answers
374 views

After I set in phpstan.neon parameter : level: 7 I got errors : 30 Method App\Rules\ItemModelRules::getValidationRulesArray() has parameter $skipFieldsArray with no value type specified in ...
Petro Gromovo's user avatar
1 vote
1 answer
2k views

I think I am misunderstanding something about phpstan. I have the following method in my interface: /** * @phpstan-template T of Searchable * * @param string $...
Wolfone's user avatar
  • 1,446
1 vote
1 answer
612 views

I'm running PHPStan and PHPMD in my GitHub Actions workflow. Locally, both tools return a list of issues, but in GitHub Actions, no issues are reported. I've made sure the path is right in github ...
ryo-kozin's user avatar
1 vote
1 answer
236 views

We have a box version of GitLab, where we want to use PHPStan and show test results in CI. For a better user experience, I want to convert the PHPStan JUnit report via sed command. But there are two ...
Stanislav Belichenko's user avatar
1 vote
1 answer
740 views

PHPStan can recognise we check if array key exists: <?php declare(strict_types = 1); /** @return array<mixed> */ function returnMixedArray(): array { return []; } /** * @return array{ ...
Kamil Dzielinski's user avatar
-2 votes
1 answer
1k views

i´m getting this error when i´m doing scann in my proyect: Class App\Jobs\ProcessCalculoGrupo uses unknown trait App\Fabricas\SidraExtraccionTrait. 💡 Learn more at https://phpstan.org/user-...
scorpions77's user avatar
0 votes
0 answers
661 views

I´m trying to solve errors in my proyect with larastan. One error that this library, returned it´s: Access to an undefined property App\Cargador\Prevalidaciones\PrevalidarCodificacionUTF8::$tarea ...
scorpions77's user avatar
0 votes
1 answer
553 views

I'm using phpstan 1.10.41 and get this error ------ --------------------------------------------------------------------- Line lib/src/fpdf17/fpdf.php ----...
Sbraaa's user avatar
  • 55
1 vote
1 answer
2k views

I run PhpStorm 2023.1 on Windows 11. On the Windows machine, I have an Ubuntu WSL enabled, so that I can develop a PHP project, which works fine. Now I wanted to enable PHPStan support yet I get the ...
k0pernikus's user avatar
  • 67.6k
1 vote
0 answers
163 views

how can I describe the exceptions thrown from callable in phpDoc? For example I have: /** * @param callable(int): bool */ function (callable $foo, int $number): ?bool { try { return $foo(...
Александр Рязанов's user avatar
0 votes
1 answer
149 views

I want to determine whether a MethodCall node is inside a certain class constructor. More specifically, I want to know if a method is being called within an exception constructor. This is the ...
TravisCarden's user avatar
0 votes
1 answer
364 views

I want to determine whether a given method argument is a string. I thought I had a pretty good solution (below), but it turns out not to handle some important edge cases--namely concatenated strings, ...
TravisCarden's user avatar
2 votes
1 answer
3k views

I try to run phpstan(nunomaduro/larastan 2.6.3) under docker (based on php:8.1.6-apache) in laravel 10.8 app and got memory lack error. I added memory limit in console command, but error anyway : root@...
mstdmstd's user avatar
  • 3,309
1 vote
1 answer
1k views

I´m trying to solve problems in my proyect. I have this message: Access to an undefined property Illuminate\Database\Eloquent\Model::$bloqueante. ...
scorpions77's user avatar
0 votes
1 answer
389 views

I tried the following code with level 9 PHPStan: <?php declare(strict_types = 1); class Foo { /** @param array<array<mixed>> $bar */ public function foo ($bar) : void { ...
user_51's user avatar
1 vote
0 answers
1k views

Is there a way to use class constants to define array shapes in phpstan? The purpose is to enable the definition to be used by PHP code, otherwise we have to repeat the definition (once for phpstan ...
caponica's user avatar
  • 3,988
1 vote
0 answers
147 views

We use our own OAuth authentication. Now I get the following problem: Call to an undefined method Laravel\Socialite\Two\ProviderInterface::addUserRequestParam(). with PHPstan with this code: /** ...
michael.brilz's user avatar
1 vote
0 answers
358 views

Is there any way to pass parameters in doc from callable to function baz $params? I need give parameters in array associated by its names. interface Bar { /** * @template TResult of mixed ...
Jan Hanáček's user avatar
1 vote
1 answer
4k views

I have phpstan in my proyect to analyze all my code. I´m working with laravel and php 8.2. My problem it´s that when i execute phpStan return any errors and i have one in my function that i´m calling ...
scorpions77's user avatar
1 vote
1 answer
766 views

I'm using PHP Stan on lvl 0 to analyse my code. I could fix everything except those 2 errors. I checked everything but the files are fine, also checked every use and the file itself. In the same ...
th3_sh0w3r's user avatar
1 vote
1 answer
842 views

I have a project (PHP 8.2.6, Yii2, PHPStan). After running phpstan command, I got a list of errors that should be fixed for successful checking. Example of errors: Access to an undefined property yii\...
Fitstd's user avatar
  • 199
0 votes
1 answer
1k views

I am having this PHPStan error on our vendor files Command and Logger: ------ --------------------------------------------- Line ../www-vendor/symfony/console/Command/Command.php ------ ---------...
Mark Joshua Fajardo's user avatar
0 votes
0 answers
110 views

I am trying to run the Enlightn package on my Laravel application using the following command: php artisan enlightn It is executing properly; however, it significantly slows down my application and ...
Pratiksha Parghi's user avatar
0 votes
2 answers
119 views

There are phpstan configuration files in the phpword sources https://github.com/PHPOffice/PHPWord/tree/0.18.2 , but composer does not include these on phpword installation, thus there are none of ...
Alexandr Shavykin's user avatar
6 votes
5 answers
5k views

After upgrading to Laravel 10 I'm having hard times with Larastan errors. The following code which was perfectly fine until 1 hour ago: return $this->articleRepository->getDefaultArticles($...
Fabio Sasso's user avatar
3 votes
1 answer
2k views

when I run PHPstan at level 8, I get for example with this code: /** * @return Collection<int, Account> */ public function getCustomersAttribute(): Collection { return $...
michael.brilz's user avatar
0 votes
1 answer
274 views

I have a Bedrock-based WordPress project that is Dockerized (WordPress core is pulled as a Composer dependency on local project). Among the dependencies, there is PHPStan, which works correctly ...
LeTraceurSnork's user avatar
3 votes
0 answers
245 views

I am using Laravel 10 + larastan to inspect my code, at level 9 (maximum). I have this error : Access to an undefined property App\Models\User::$full_name. The code is : $model->created_by = Auth::...
Dom's user avatar
  • 3,506
0 votes
1 answer
382 views

Line base\Kader\Kader.php (in context of class Kader\Debugging) ------ ------------------------------------------------------------------------------ 107 Method Kader\...
Graham Reynolds's user avatar
0 votes
1 answer
165 views

I have a class with two methods: toArray and collect where collect will return collection of array from method toArray responses. Is there any way in PHP Stan how to annotate return type for collect ...
Dawenear's user avatar
0 votes
2 answers
110 views

This might be a long shot, but maybe someone can help or have ideas. In Mautic, we are doing a lot of refactoring at the moment to upgrade the code base to be PHP 8.x one of the issues I am facing ...
Mohammad Abu Musa's user avatar
3 votes
1 answer
989 views

I'm trying to remove some code duplication that has proven to be prone to human errors. I created a working sample code at https://3v4l.org/QFA6m#v8.2.7 and a demo of PHPStan failing where expected, ...
Jan Klan's user avatar
  • 1,034
0 votes
1 answer
1k views

PHPStan has found hundreds of errors in the Laravel project. Mostly, Access to an undefined property Illuminate\Database\Eloquent\Model::$id. for constructs like $project_id = $checkpoint->project-&...
Nikita P's user avatar
0 votes
1 answer
1k views

Phpstan analysis fails when I run it as part of the Gitlab pipeline, it passes locally. I'm talking about the analysis and not the running of the command itself. I do not get 'command not found' or '...
Johnson55's user avatar
0 votes
1 answer
774 views

I've read the documentation from PhpStan and Psalm, and i couldn't find the rules where it checks the Cyclomatic Complexity like Phpmd does here Also, is it possible to cusomise rules within levels ...
Mali C.'s user avatar
  • 21
0 votes
3 answers
163 views

I'm struggling with the return code of a validation rule to pass the "Larastan" test. The code for this rule is: public function rules(): array { return [ 'name' => [ ...
Dom's user avatar
  • 3,506
1 vote
0 answers
204 views

I'm trying to have super clean laravel code using larastan. For the moment it is flawless up to level 7 (out of 9 possible). And I get stuck by going to 8 on this code: $user = User::where('email', $...
Dom's user avatar
  • 3,506
4 votes
1 answer
6k views

I'm using PHPStan for static analysis in my PHP 8.4.2 project, and I'm encountering an issue with a class method that returns multiple types or null. Here's my method with type hints and PHPDoc ...
Scudo's user avatar
  • 51