phpstan | PHP Static Analysis Tool - discover bugs | Code Analyzer library

 by   phpstan PHP Version: 1.10.19 License: MIT

kandi X-RAY | phpstan Summary

kandi X-RAY | phpstan Summary

phpstan is a PHP library typically used in Code Quality, Code Analyzer applications. phpstan has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

PHPStan focuses on finding errors in your code without actually running it. It catches whole classes of bugs even before you write tests for the code. It moves PHP closer to compiled languages in the sense that the correctness of each line of the code can be checked before you run the actual line.

            kandi-support Support

              phpstan has a medium active ecosystem.
              It has 11928 star(s) with 843 fork(s). There are 177 watchers for this library.
              There were 4 major release(s) in the last 6 months.
              There are 887 open issues and 5765 have been closed. On average issues are closed in 97 days. There are 9 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of phpstan is 1.10.19

            kandi-Quality Quality

              phpstan has 0 bugs and 0 code smells.

            kandi-Security Security

              phpstan has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              phpstan code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              phpstan is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              phpstan releases are available to install and integrate.

            Top functions reviewed by kandi - BETA

            kandi has reviewed phpstan and discovered the below as its top functions. This is intended to give you an instant insight into phpstan implemented functionality, and help decide if they suit your requirements.
            • Load PHP wrapper .
            • Configure the DI container .
            • Register bundles .
            • Get exception class name
            • Validates the supplied value .
            • Start a new bar .
            • Render the bar .
            • helper method .
            • Bar bar bar .
            • Set the test variable .
            Get all kandi verified functions for this library.

            phpstan Key Features

            No Key Features are available at this moment for phpstan.

            phpstan Examples and Code Snippets

            No Code Snippets are available at this moment for phpstan.

            Community Discussions


            PHP 5 to PHP 7 transpiler
            Asked 2021-Jun-01 at 13:05

            I have a big project in php 5 and it's well documented. Now, I want to migrate to php 7.2 and I have already checked the compatibility using phpstan and every thing is alright. So, I wonder if there is a tool that could automatically transform the php 5 annotations to php 7 (like functions declarations and variables )?

            Thanks in advance



            Answered 2021-Jun-01 at 10:40

            If you are looking to convert phpdoc param types to typehints, you can use php-cs-fixer that includes this kind of feature : phpdoc_to_param_type

            There is also a fixer for function return types : phpdoc_to_return_type

            Example from the php-cs-fixer documentation :



            Composer installation failed
            Asked 2021-May-21 at 16:29

            While running the Pimcore6.9 along with the symfony4.4 I had spotted some warnings:

            The MimetypeGuesser is depricated since symfony4.3 use MimeTypes instead.



            Answered 2021-May-21 at 16:23

            Your composer.json already lists symfony/symfony as a required package. This contains symfony/mime - as long as you are using Symfony v4.3 or later. The MIME component did not exist before that.



            Matching patterns from a file returns multiple same outputs in bash
            Asked 2021-Mar-27 at 15:31

            I'm trying to extract a list of files defined in my .gitattributes file in bash.

            The .gitattributes file looks like this



            Answered 2021-Mar-27 at 15:31

            As others will likely point out, there are other (simpler, more efficient) ways to do what the OP is looking to do; the objective of this answer is to address the behavior of the OP's current sed code.

            By default sed will pass input through to stdout. Consider:



            phpstan not pass over strip_tags
            Asked 2021-Mar-15 at 15:17

            i have string of html which i want to explode by
            , but sometimes it can be inside of other tags.



            Answered 2021-Mar-15 at 15:17

            There is still an open issue for similar behaviour or PHP Stan - False negative with array_push on property

            Try not using array_push and replace it on line 138 with the following:



            Jenkins-pipeline fail : No such DSL method 'androidLint' found among steps
            Asked 2020-Nov-21 at 17:16

            I get a failure for the stage 'Static analysis' during my jenkins-pipeline.

            Here is my Jenkinsfile :



            Answered 2020-Nov-21 at 17:16

            After investigation, it seems "androidLint" is not supported by "Warnings Next Generation Plugin", and has been replaced by "androidLintParser"

            the correct step with Warning Next Generation plugin is :



            Why can't I require a specific commit from "dev-master" for this package?
            Asked 2020-Nov-16 at 07:07

            I'm trying to install apigen/apigen via Composer (specifically, dev-master). The latest commit requires roave/better-reflection at a certain commit. I ran into issues where Composer was unable to find that particular reference (#c87d856).

            To reproduce the issue, I created a minimal composer.json file that requires only that missing package/version:



            Answered 2020-Nov-16 at 07:07
            $ composer req --dev roave/better-reflection:4.12.x-dev#c87d856



            Why git status shows files under /vendor dir?
            Asked 2020-Sep-20 at 10:28

            Running command



            Answered 2020-Sep-20 at 10:28

            Git is tracking your vendor directory. Try to remove that from from index.

            To stop tracking you need to remove the folder from index.

            git rm -r --cached vendor

            This will not delete anything that is saved in the working directory.



            How to write generics for factories using psalm and phpstan
            Asked 2020-Sep-14 at 15:04

            I'm trying out phpstan and psalm for php and I would like to write a class that can take different type of objects and return the right one based on the factory to call.

            What I'm trying to achieve is that if I pass an object of type A to the Transformer, the compiler knows that a SuperA will be returned.

            While I can go without errors in psalm (though I still get SuperA|SuperB instead of the right object), I got an error on what I'm passing in phpstan.



            Is there a way to do it?



            Answered 2020-Sep-14 at 15:04

            So you want to get SuperA based on A and SuperB based on B.

            I'd connect A+SuperA and B+SuperB together like this:



            How can I have phpstan find my custom extension class?
            Asked 2020-Aug-28 at 16:03

            To implement checks for some magic _get() functions, I'm trying to implement a "class reflection extension". The manual mentions how to write the extension files themselves, and to install them by adding a service part to the neon file.

            I've written an extension, and added it like so:



            Answered 2020-Aug-28 at 16:03

            The extension class needs to be loaded in runtime. You can achieve that in two ways:

            1. Make the class available for the Composer autoloader. It's usually sufficient to configure autoload-dev section of your composer.json.

            2. Create a file called something like phpstan-autoload.php in which you require_once the file with the extension class. And pass the path to the phpstan-autoload.php file as --autoload-file|-a option on the command line when running PHPStan.



            artisan test command is not working, laravel 7.x
            Asked 2020-Aug-01 at 08:49

            i hope you are doing well, so my problem is that i cannot run the artisan test command whenever i run the command php artisan test i get the following error



            Answered 2020-Aug-01 at 08:49

            this was an issue with pestphp versioning, as explained in this here. i just had to replace the version of pestphp and collision from


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install phpstan

            You can download it from GitHub.
            PHP requires the Visual C runtime (CRT). The Microsoft Visual C++ Redistributable for Visual Studio 2019 is suitable for all these PHP versions, see You MUST download the x86 CRT for PHP x86 builds and the x64 CRT for PHP x64 builds. The CRT installer supports the /quiet and /norestart command-line switches, so you can also script it.


            All the documentation lives on the website:.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone phpstan/phpstan

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Code Analyzer Libraries


            by airbnb


            by standard


            by eslint


            by rome


            by python

            Try Top Libraries by phpstan


            by phpstanPHP


            by phpstanPHP


            by phpstanPHP


            by phpstanPHP