Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update generator.md #1662

Merged
merged 1 commit into from
Oct 7, 2024
Merged

Update generator.md #1662

merged 1 commit into from
Oct 7, 2024

Conversation

Kiina
Copy link
Contributor

@Kiina Kiina commented Oct 7, 2024

I just spend way too long to figure out why the example throws errors. Since you can't call new Analysis without a context and TokenAnalyser is the old way of doing things, I updated it so the example works.

Maybe the signature for

public function __construct(array $annotations = [], ?Context $context = null)

in Analysis.php should get updated since it calls addAnnotations, which doesn't allow context to be null, so I don't quite see why it allows it in the constructor since it will just crash anyway?

I just spend way too long to figure out why the example throws errors. Since you can't call new Analysis without a context and TokenAnalyser is the old way of doing things, I updated it so the  example works.


Maybe the signature for 

```php 
public function __construct(array $annotations = [], ?Context $context = null)
```
in Analysis.php should get updated since it calls addAnnotations which doesn't allow context to be null, so I don't quite see why it allows it in the constructor since it will just crash anyway?
@Kiina
Copy link
Contributor Author

Kiina commented Oct 7, 2024

Also noticed that it says:

processors: null|array                    Defaults to `Analysis::processors()`.

But Analysis::processors() has been removed in v4

@DerManoMann
Copy link
Collaborator

Fair point. That page was originally the migration doc for switching to using the Generator class. I think there are a few more things to fix, so thanks for the reminder.

@Kiina
Copy link
Contributor Author

Kiina commented Oct 7, 2024

Ah yeah I've tried to implement some processors and the docs seemed a bit confusing. Some stuff only seems to be documented in the examples. I tried to extend the default pipeline with a new processor and it seems like this is only to be found in one of the examples:

https://github.com/zircote/swagger-php/blob/master/Examples/processors/schema-query-parameter/scan.php#L26

Maybe the examples should be in the header on the documentation to make them easier to find. Would've probably made it less confusing than looking through the docs and the existing Processors which use the deprecated ProcessorInterface.

@DerManoMann DerManoMann merged commit 1d92485 into zircote:master Oct 7, 2024
21 checks passed
@DerManoMann
Copy link
Collaborator

Thanks, @Kiina

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants