Announcement

Collapse
No announcement yet.

PHPStan 1.0 Released As Leading PHP Static Analyzer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PHPStan 1.0 Released As Leading PHP Static Analyzer

    Phoronix: PHPStan 1.0 Released As Leading PHP Static Analyzer

    PHPStan 1.0 was released today as the first stable release for this leading open-source PHP static analysis tool...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    Have you evaluated `phan/phan` or `vimeo/psalm` ? If so, why do you prefer PHPstan over them?

    Comment


    • #3
      Originally posted by tsuru View Post
      Have you evaluated `phan/phan` or `vimeo/psalm` ? If so, why do you prefer PHPstan over them?
      never heard of them but do they have things like rector built on top of them?

      For drupal especially, drupal-rector is a major feature for updating code to latest changes of underlying libraries etc.

      Comment


      • #4
        It would be great if it supported Language Server Protocol (LSP) and support in code editors such as VS Code.

        Would also be great if there was a GitHub Action for it so it could be ran automatically on all commits and pull requests.

        Comment


        • #5
          How does PHAR work these days?
          I tried it some years ago and I thought it was really cool, but it felt buggy and immature.

          Comment


          • #6
            Michael You still haven't reviewed my PR which would provide better PHPStan results for PTS, should I just close it?

            This add phpDoc to some of the code in pts-core/objects, the types where determined by running debug-self-test through phpweaver for a few secounds and then manually verityfing the result. phpDoc c...

            Comment


            • #7
              Originally posted by uid313 View Post
              Would also be great if there was a GitHub Action for it so it could be ran automatically on all commits and pull requests.
              Setting that up is pretty trivial:
              Code:
              name: PHPStan
              
              on:
              push:
              branches:
              - master
              pull_request:
              branches:
              - master
              
              jobs:
              tests:
              runs-on: ubuntu-latest
              strategy:
              matrix:
              php: [ '7.4' ]
              steps:
              - name: Checkout
              uses: actions/checkout@v2
              
              - name: Setup PHP
              uses: shivammathur/setup-php@v2
              with:
              php-version: '7.4'
              tools: composer:v2
              
              - name: Install dependencies
              run: composer install
              
              - name: PHPStan
              run: vendor/bin/phpstan analyze --no-progress

              Comment


              • #8
                Originally posted by tsuru View Post
                Have you evaluated `phan/phan` or `vimeo/psalm` ? If so, why do you prefer PHPstan over them?
                I was disapointed by phan/phan it had lots of false positives, requires php extensions and overall just didn't work as well as the others.

                `vimeo/psalm` is grate, it can automatically correct some types of errors in the code, I find it can be a bit more pedantic then PHPStan and less organized, but once I get a project running well with PHPStan i often apply Psalm to it as well, and I will also use it as a tool for dealing with some of the issues found by PHPStan even before that.

                Originally posted by You- View Post
                never heard of them but do they have things like rector built on top of them?
                Rector doesn't really deal with static analysis, it's just a tool for automatically refactoring code.

                Comment


                • #9
                  Originally posted by AJenbo View Post

                  Setting that up is pretty trivial:
                  Code:
                  name: PHPStan
                  
                  on:
                  push:
                  branches:
                  - master
                  pull_request:
                  branches:
                  - master
                  
                  jobs:
                  tests:
                  runs-on: ubuntu-latest
                  strategy:
                  matrix:
                  php: [ '7.4' ]
                  steps:
                  - name: Checkout
                  uses: actions/checkout@v2
                  
                  - name: Setup PHP
                  uses: shivammathur/setup-php@v2
                  with:
                  php-version: '7.4'
                  tools: composer:v2
                  
                  - name: Install dependencies
                  run: composer install
                  
                  - name: PHPStan
                  run: vendor/bin/phpstan analyze --no-progress
                  Maybe create a pull request for phoronix-test-suite on GitHub.
                  The Phoronix Test Suite open-source, cross-platform automated testing/benchmarking software. - GitHub - phoronix-test-suite/phoronix-test-suite: The Phoronix Test Suite open-source, cross-platform automated testing/benchmarking software.

                  Comment


                  • #10
                    Originally posted by AJenbo View Post
                    Michael You still haven't reviewed my PR which would provide better PHPStan results for PTS, should I just close it?

                    https://github.com/phoronix-test-sui...suite/pull/378
                    I'll need to revisit it now that I know it can be used for such cases... To now I thought that PR was mainly for documentation / reference purposes so sadly hasn't beeen too much of a priority given the lack of any significant number of external contributors to the project. But main concern would remain that the comments will quickly fall out-of-date / lose coverage, or what would be the steps to regenerate such data?
                    Michael Larabel
                    https://www.michaellarabel.com/

                    Comment

                    Working...
                    X