Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Static Analysis & Strict Types

Static Analysis & Strict Types

Dive deep into your code bases and add strict typing to leverage static analysis tools that can help find bugs in your code before it’s even run! We’ll explore Phan and PhpStan, both fantastic static analysis tools that can give detailed introspection into our applications. Static Analyzers can help find overly complicated logic and other common issues in our code bases as well as ensure our data types are standardized across our application processing.

Joe Ferguson

May 23, 2019
Tweet

More Decks by Joe Ferguson

Other Decks in Technology

Transcript

  1. Who Am I? Joe Ferguson Senior Full Stack Developer @

    Preteckt Twitter: @JoePFerguson OSMI Board Member The Joindin Foundation & Joindin Leadership Team
  2. Agenda Review a basic PHP package Discuss Static Analysis and

    demo tools Demo tools on a real world application Add some new(ish) PHP 7.x features to improve analysis results
  3. Running Phan ./vendor/bin/phan PhanTypeMismatchDeclaredReturn Doc-block of add contains declared return

    type float which is incompatible with the return type int declared in the signature
  4. Resources The Workshop: The Road to 7.3 https://www.phparch.com/magazine/2019/01/ devops-depths/ Phan

    https://github.com/phan/phan PHPStan https://github.com/phpstan/phpstan