The document discusses various topics related to PHP forms and static code analysis. It begins with an agenda that includes Ext:form, custom form elements, prototypes, tips and tricks, and PHP static code linting. Ext:form is introduced as a form framework that allows creating not just forms, but also custom elements. Custom elements can be configured and registered for the backend, frontend, and language files. Prototypes are discussed as a way to define different form element configurations, validators, and templates per prototype. The document concludes by introducing PHPStan as a tool for static code analysis to find bugs without writing tests.
20. Ext:form - Prototype
• Konfigurationen „leben“ in Prototypen
• “standard“ ist der default
• unterschiedliche Formular-Elemente pro Prototyp
• unterschiedliche vordefinierte Formular-Element
Konfigurationen / Validatoren / etc. pro Prototyp
20
24. Ext:form - Tipps & Tricks
24
Pro
• Sehr einfache Pflege von Formularen
• Formulare sind versionierbar im
Projekt (z.B. Git)
• Formular-Definitionen „deploybar“
• Komplexe Anforderungen können
abgebildet werden (z.B. PHP-API, etc.)
Contra
• Formulare sind nicht versioniert
innerhalb TYPO3 (kein sys_history,
kein workspace, etc.)
• Keine Sichtbarkeit bei Bearbeitung
• Keine Edit-Permissions pro Formular
28. 28
Current Checks
‣ Existence of classes and interfaces in
instanceof, catch, typehints, other language
constructs and even annotations. PHP does
not do this and just stays silent instead.
‣ Existence of variables while respecting
scopes of branches and loops.
‣ Existence and visibility of called methods
and functions.
‣ Existence and visibility of accessed
properties and constants.
‣ Correct types assigned to properties.
29. 29
Current Checks
‣ Correct number and types of parameters
passed to constructors, methods and functions.
‣ Correct types returned from methods and
functions.
‣ Correct number of parameters passed to
sprintf/printf calls based on format strings.
‣ Useless casts like (string) 'foo'.
‣ Unused constructor parameters - they can
either be deleted or the author forgot to use
them in the class code.
‣ That only objects are passed to the clone
keyword.
30. • Use composer!!!!!1!!111!!!111
• $ composer require --dev phpstan/phpstan
TYPO3? Object Manager? Repository->findOneByX()?
• $ composer require --dev saschaegerer/phpstan-typo3
RUN
• $ vendor/bin/phpstan analyse -c phpstan.neon -l max
30
How to install