SlideShare a Scribd company logo
Modern Static Code
Analysis in PHP
25 Feb 2016, Mannheim
@kalessil
Introducing myself
• The author of Php Inspections (EA Extended)
o A plugin for PhpStorm adding strong code semantics analysis
• A contributor of Symfony 1.5 and Symfony 2
o With SCA focus of course
• A contributor of PHP CS Fixer
o SCA and contributed fixers
• Background is PHP/Java Expert level in Enterprise
Modern Static Code
Analysis in PHP
25 Feb 2016, Mannheim
@kalessil
PHP
• I love the community and hate language itself (not only me)
• Infrastructure around PHP is great (Composer, ZF, Symfony, Yii,
Hosting and etc.)
• Php has low entry level for new developers (hits code quality)
• Php has 2 really important characteristics (hits apps life-cycle)
o It’s fast to go on a market when you develop apps in PHP
o It’s painful to maintain survived applications
Modern software
• Getting more complex with each year
o Increases maintenance costs and complexity
o Requires more intelligent tools
• Continuous Integration and Delivery
o Increases costs of failures at delivery phase
o Raises additional stability requirements to development processes
• Agile development processes
o Affects code quality and introducing un-finished code/features
o Requires more intelligent tools
Peer2Peer review still works
But…
Really!
Let’s dig dipper…
• Code Style (formatting, naming, spaghetti code)
o Can be covered by existing (“old”) tools, so easily solvable
• Lack of API knowledge
o Remember low entry level of PHP
o You have to educate people (or tools can do it just during development)
• Obviously inefficient code constructs
o Remember low entry level of PHP
o Remember Agile processes
o You have to reject this (or tools can do it just during development)
• Lack of team experience
o That’s team work (but tools still can educate during development)
So how to simplify own life?
Or let machines work for us
Generations of SCA tools
• 1st generation
o Eclipse and other first IDEs
o PHP CodeSniffer
• 2nd generation
o JetBrains IDEs + SCA plugins
o SensioLabs Insight, Scritinizer, SonarCube
o Exacat, PHP CS Fixer
• 3rd generation
o We’ll see them soon, expert systems specialized on code defects
o SCA tools based on PHP 7 real PSI tree (presented in JB IDEs currently)
Semantic Analyzers
• Php Inspections (EA Extended)
o Targeting transition of 2nd and 3rd generation tools
o Expert-level code reviews
o “In-stream" analysis, when developers are not disturbed
o Productivity booster (automated code adjustments)
o CI usage available
o Requires no configurations at start, just install the plugin
• Exakat
o Targeting transition of 2nd and 3rd generation tools
o CI/local usage available
o Expert-level code reviews
Code Style
• Php CodeSniffer (a 1st generation tool)
o CI/local usage available
o Reports code style violations
o Customizable and extendable
• PHP CS Fixer (a 2nd generation tool)
o CI/local usage available
o Fixes code style violations
o Customizable and extendable
SaaS alternatives
SensioLabs Insight
• Framework/CSM centric
• Good technical debt estimation
• 2nd generation tool
Scrutinizer
• Plays nicely with Open Source
• A little bit noisy
• Based on 1st generation tools ("old” tools)
In between:
• Based on 1st generation toolst
o But exists “Sonar way” rules
o Only reports issues
o Requires initial configuration, or not really usable
• IDEs integration
• Multi-language projects supported
o But unfortunately not all
• Integrated metrics and code style presets
Live demonstration
Thank you!

More Related Content

PPTX
Journey with XP a case study in embedded domain by Pradeep Kumar NR
PPTX
Componentize! by Lancer Kind XP Conference 2016
PPTX
Api NodeJS con PureScript
PDF
Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails App...
PDF
Hack in the Box GSEC 2016 - Reverse Engineering Swift Applications
KEY
Using Aspects for Language Portability (SCAM 2010)
PPTX
Oop project briefing sem 1 2015 2016 (1)
PDF
Eclipse Day India 2015 - Unleashing the Java 8 Tooling in Eclipse
Journey with XP a case study in embedded domain by Pradeep Kumar NR
Componentize! by Lancer Kind XP Conference 2016
Api NodeJS con PureScript
Software Design Trilogy Part III - Domain Driven Design for Ruby on Rails App...
Hack in the Box GSEC 2016 - Reverse Engineering Swift Applications
Using Aspects for Language Portability (SCAM 2010)
Oop project briefing sem 1 2015 2016 (1)
Eclipse Day India 2015 - Unleashing the Java 8 Tooling in Eclipse

What's hot (20)

PDF
Effective programming in Java - Kronospan Job Fair 2016
PPT
Asynchronous PHP. Myth? Reality!
PDF
Java and effective programming. Is it possible? - IAESTE Case Week 2016
PDF
Systematic Evaluation of the Unsoundness of Call Graph Algorithms for Java
KEY
Language Engineering in the Cloud
PDF
Writing readable Clojure code
KEY
Test-driven language development
PDF
Sonarqube + Docker
PDF
Continuous Inspection of Code Quality: SonarQube
PDF
Functional programming ruby mty
PDF
The Spoofax Language Workbench (SPLASH 2010)
PPTX
Java Comments | Java course
PDF
Eclipse Testing Day 2010. Xored Q7
PDF
Performance profiling and testing of symfony application 2
PPT
laravel Elegant artisan by santosh pawar
PPTX
Static Analysis with Sonarlint
PDF
Solving cross cutting concerns in PHP - PHPSerbia-2017
PDF
Test automation design patterns
PDF
RoboCon 2018: How did we get here? Where do we go next?
PDF
Deliberate Practice, New Learning Styles (2015)
Effective programming in Java - Kronospan Job Fair 2016
Asynchronous PHP. Myth? Reality!
Java and effective programming. Is it possible? - IAESTE Case Week 2016
Systematic Evaluation of the Unsoundness of Call Graph Algorithms for Java
Language Engineering in the Cloud
Writing readable Clojure code
Test-driven language development
Sonarqube + Docker
Continuous Inspection of Code Quality: SonarQube
Functional programming ruby mty
The Spoofax Language Workbench (SPLASH 2010)
Java Comments | Java course
Eclipse Testing Day 2010. Xored Q7
Performance profiling and testing of symfony application 2
laravel Elegant artisan by santosh pawar
Static Analysis with Sonarlint
Solving cross cutting concerns in PHP - PHPSerbia-2017
Test automation design patterns
RoboCon 2018: How did we get here? Where do we go next?
Deliberate Practice, New Learning Styles (2015)
Ad

Viewers also liked (20)

PDF
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
PDF
Static Analysis of PHP Code – IPC Berlin 2016
PDF
Dynamic PHP web-application analysis
PPTX
XSSの評価基準とRIPSプラグイン的なものを作った
PDF
BSides Algiers - PHP Static Code Analysis - Abdeldjalil Belakhdar
PDF
Web UI performance tuning
PDF
PHP Static Code Review
KEY
Php Code Audits (PHP UK 2010)
PDF
Functions - complex first class citizen
DOC
Coding standards php
PDF
Coding Best practices (PHP)
PPTX
Modular & Event driven UI Architecture
PDF
PHP CODING STANDARDS
PDF
RIPS - static code analyzer for vulnerabilities in PHP
PPTX
Coding Standard And Code Review
PDF
JavaScript and UI Architecture Best Practices
PPTX
ニューラルネットワークによる音声の分類
PDF
Secure Programming With Static Analysis
PDF
Refactoring Legacy Code
PPT
Night of the Long Knives
PHPcon Poland - Static Analysis of PHP Code – How the Heck did I write so man...
Static Analysis of PHP Code – IPC Berlin 2016
Dynamic PHP web-application analysis
XSSの評価基準とRIPSプラグイン的なものを作った
BSides Algiers - PHP Static Code Analysis - Abdeldjalil Belakhdar
Web UI performance tuning
PHP Static Code Review
Php Code Audits (PHP UK 2010)
Functions - complex first class citizen
Coding standards php
Coding Best practices (PHP)
Modular & Event driven UI Architecture
PHP CODING STANDARDS
RIPS - static code analyzer for vulnerabilities in PHP
Coding Standard And Code Review
JavaScript and UI Architecture Best Practices
ニューラルネットワークによる音声の分類
Secure Programming With Static Analysis
Refactoring Legacy Code
Night of the Long Knives
Ad

Similar to Modern Static Code Analysis in PHP (20)

PDF
The why and how of moving to php 8
PPTX
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
PPTX
Listen and look at your PHP code
PDF
Continous Delivery Toronto Presentation
PPTX
essential code quality tools and frontend web performance tools every modern ...
PDF
Intake_35_OpenSource_Developer track
PDF
open source applications developers
PPTX
Symphony Software Foundation API Working Group Proposal
PDF
The why and how of moving to php 7
PPT
Online voting system ppt by anoop
PDF
Continuous Integration In Php
PPTX
#SPSNYC 2018 Migrate your custom components to the #SharePoint Framework #SPFX
PPTX
Build software like a bag of marbles, not a castle of LEGO®
PDF
Introducing Continuous Delivery in the Enterprise
PDF
PHP 4? OMG! A small vademecum for obsolete software migration.
PDF
Continuous Updating with VersionEye at code.talks 2014
PPTX
“One man” development process model
PDF
Practical Continuous Deployment - Atlassian - London AUG 18 Feb 2014
PPTX
Web development post io2016
PDF
Why Plone Will Die
The why and how of moving to php 8
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
Listen and look at your PHP code
Continous Delivery Toronto Presentation
essential code quality tools and frontend web performance tools every modern ...
Intake_35_OpenSource_Developer track
open source applications developers
Symphony Software Foundation API Working Group Proposal
The why and how of moving to php 7
Online voting system ppt by anoop
Continuous Integration In Php
#SPSNYC 2018 Migrate your custom components to the #SharePoint Framework #SPFX
Build software like a bag of marbles, not a castle of LEGO®
Introducing Continuous Delivery in the Enterprise
PHP 4? OMG! A small vademecum for obsolete software migration.
Continuous Updating with VersionEye at code.talks 2014
“One man” development process model
Practical Continuous Deployment - Atlassian - London AUG 18 Feb 2014
Web development post io2016
Why Plone Will Die

Recently uploaded (20)

PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPT
Mechanical Engineering MATERIALS Selection
PDF
composite construction of structures.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
Well-logging-methods_new................
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PPTX
Sustainable Sites - Green Building Construction
PPTX
web development for engineering and engineering
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Mechanical Engineering MATERIALS Selection
composite construction of structures.pdf
CH1 Production IntroductoryConcepts.pptx
Well-logging-methods_new................
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Model Code of Practice - Construction Work - 21102022 .pdf
Foundation to blockchain - A guide to Blockchain Tech
Operating System & Kernel Study Guide-1 - converted.pdf
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Sustainable Sites - Green Building Construction
web development for engineering and engineering

Modern Static Code Analysis in PHP

  • 1. Modern Static Code Analysis in PHP 25 Feb 2016, Mannheim @kalessil
  • 2. Introducing myself • The author of Php Inspections (EA Extended) o A plugin for PhpStorm adding strong code semantics analysis • A contributor of Symfony 1.5 and Symfony 2 o With SCA focus of course • A contributor of PHP CS Fixer o SCA and contributed fixers • Background is PHP/Java Expert level in Enterprise
  • 3. Modern Static Code Analysis in PHP 25 Feb 2016, Mannheim @kalessil
  • 4. PHP • I love the community and hate language itself (not only me) • Infrastructure around PHP is great (Composer, ZF, Symfony, Yii, Hosting and etc.) • Php has low entry level for new developers (hits code quality) • Php has 2 really important characteristics (hits apps life-cycle) o It’s fast to go on a market when you develop apps in PHP o It’s painful to maintain survived applications
  • 5. Modern software • Getting more complex with each year o Increases maintenance costs and complexity o Requires more intelligent tools • Continuous Integration and Delivery o Increases costs of failures at delivery phase o Raises additional stability requirements to development processes • Agile development processes o Affects code quality and introducing un-finished code/features o Requires more intelligent tools
  • 9. Let’s dig dipper… • Code Style (formatting, naming, spaghetti code) o Can be covered by existing (“old”) tools, so easily solvable • Lack of API knowledge o Remember low entry level of PHP o You have to educate people (or tools can do it just during development) • Obviously inefficient code constructs o Remember low entry level of PHP o Remember Agile processes o You have to reject this (or tools can do it just during development) • Lack of team experience o That’s team work (but tools still can educate during development)
  • 10. So how to simplify own life?
  • 11. Or let machines work for us
  • 12. Generations of SCA tools • 1st generation o Eclipse and other first IDEs o PHP CodeSniffer • 2nd generation o JetBrains IDEs + SCA plugins o SensioLabs Insight, Scritinizer, SonarCube o Exacat, PHP CS Fixer • 3rd generation o We’ll see them soon, expert systems specialized on code defects o SCA tools based on PHP 7 real PSI tree (presented in JB IDEs currently)
  • 13. Semantic Analyzers • Php Inspections (EA Extended) o Targeting transition of 2nd and 3rd generation tools o Expert-level code reviews o “In-stream" analysis, when developers are not disturbed o Productivity booster (automated code adjustments) o CI usage available o Requires no configurations at start, just install the plugin • Exakat o Targeting transition of 2nd and 3rd generation tools o CI/local usage available o Expert-level code reviews
  • 14. Code Style • Php CodeSniffer (a 1st generation tool) o CI/local usage available o Reports code style violations o Customizable and extendable • PHP CS Fixer (a 2nd generation tool) o CI/local usage available o Fixes code style violations o Customizable and extendable
  • 15. SaaS alternatives SensioLabs Insight • Framework/CSM centric • Good technical debt estimation • 2nd generation tool Scrutinizer • Plays nicely with Open Source • A little bit noisy • Based on 1st generation tools ("old” tools)
  • 16. In between: • Based on 1st generation toolst o But exists “Sonar way” rules o Only reports issues o Requires initial configuration, or not really usable • IDEs integration • Multi-language projects supported o But unfortunately not all • Integrated metrics and code style presets