documentation-developer
documentation-developer copied to clipboard
[POC] Added PHPStan to verify code samples
This PR adds PHPstan to verify code samples.
This is done only for ActivityLog for now, to see if it's useful.
The code is broken on purpose in https://github.com/ibexa/documentation-developer/commit/42998c6887c5a3e07313ff81b324ac2ea3cdc2d1
It requires two things from us:
- All code samples must be stored in
code_samplesand included from the doc - we cannot use```phpblocks, because they won't be validated - Examples must be complete (they cannot reference classes that do not exist or are left as an exercise to the reader)
which I think we can live with
2. Examples must be complete (they cannot reference classes that do not exist or are left as an exercise to the reader)
This can be circumvented by using stubs, which are basically small PHP code declarations. They also overwrite any existing declarations (that is their primary use), which is useful if you cannot modify 3rd party code, but still want to have PHPStan compliant annotations.