Skip to content

Commit

Permalink
Expand on using the -b option for single files (#1684)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerManoMann authored Jan 6, 2025
1 parent add1c4d commit dc81ae3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
14 changes: 14 additions & 0 deletions docs/guide/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,20 @@ openapi -b myapp/vendor/autoload.php myapp/src

The `-b` allows to execute some extra PHP code to load whatever is needed to register your apps classloader with PHP.

::: warning
One common case for this type of error is when trying out annotations in a standalone single file.
Typically, this means it will not use namespaces or confirm to any other autoloading standards.

In this case the `-b` option can also be used to autoload the actual file.

Please note that you still need to provide the file (or its folder) as the target.

```shell
openapi -b src/test.php src/test.php
```
:::


### Namespace mismatch

Another reason for this error could be that your class actually has the wrong namespace (or no namespace at all!).
Expand Down
4 changes: 2 additions & 2 deletions docs/guide/under-the-hood.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ about the PHP context where the annotation was found.

Typically, there will be a processor that uses the data to augment/enrich the annotation.

**Examples of the data collected:**
**Examples of the data collected:**
- class/interface/trait/enum names
- property names
- doctype or native type hints
Expand All @@ -35,7 +35,7 @@ This documentation is generated with [VitePress](https://vitepress.vuejs.org/)
### Installation
```shell
cd docs
npm install vitepress
npm install
```

### Workflow
Expand Down
15 changes: 5 additions & 10 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ parameters:
count: 1
path: src/Annotations/AbstractAnnotation.php

-
message: "#^Parameter \\#4 \\$flags of static method Symfony\\\\Component\\\\Yaml\\\\Yaml\\:\\:dump\\(\\) expects 0\\|1\\|16\\|17\\|64\\|65\\|80\\|81\\|128\\|129\\|144\\|145\\|192\\|193\\|208\\|209\\|1024\\|1025\\|1040\\|1041\\|1088\\|1089\\|1104\\|1105\\|1152\\|1153\\|1168\\|1169\\|1216\\|1217\\|1232\\|1233\\|2048\\|2049\\|2064\\|2065\\|2112\\|2113\\|2128\\|2129\\|2176\\|2177\\|2192\\|2193\\|2240\\|2241\\|2256\\|2257\\|3072\\|3073\\|3088\\|3089\\|3136\\|3137\\|3152\\|3153\\|3200\\|3201\\|3216\\|3217\\|3264\\|3265\\|3280\\|3281\\|4096\\|4097\\|4112\\|4113\\|4160\\|4161\\|4176\\|4177\\|4224\\|4225\\|4240\\|4241\\|4288\\|4289\\|4304\\|4305\\|5120\\|5121\\|5136\\|5137\\|5184\\|5185\\|5200\\|5201\\|5248\\|5249\\|5264\\|5265\\|5312\\|5313\\|5328\\|5329\\|6144\\|6145\\|6160\\|6161\\|6208\\|6209\\|6224\\|6225\\|6272\\|6273\\|6288\\|6289\\|6336\\|6337\\|6352\\|6353\\|7168\\|7169\\|7184\\|7185\\|7232\\|7233\\|7248\\|7249\\|7296\\|7297\\|7312\\|7313\\|7360\\|7361\\|7376\\|7377, int given\\.$#"
count: 1
path: src/Annotations/AbstractAnnotation.php

-
message: "#^Variable \\$name might not be defined\\.$#"
count: 2
Expand All @@ -55,16 +60,6 @@ parameters:
count: 1
path: src/Generator.php

-
message: "#^Result of && is always false\\.$#"
count: 3
path: src/Processors/AugmentProperties.php

-
message: "#^Strict comparison using \\=\\=\\= between non\\-empty\\-string and '' will always evaluate to false\\.$#"
count: 1
path: src/Processors/AugmentProperties.php

-
message: "#^Call to function is_array\\(\\) with bool\\|OpenApi\\\\Annotations\\\\AdditionalProperties will always evaluate to false\\.$#"
count: 1
Expand Down

0 comments on commit dc81ae3

Please sign in to comment.