Skip to content

Add PHPStan Template #98

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

Merged
merged 1 commit into from
Feb 16, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Reader
{
/**
* Populate OpenAPI spec object from JSON data.
* @phpstan-template T of SpecObjectInterface
* @phpstan-param class-string<T> $baseType
* @phpstan-return T
* @param string $json the JSON string to decode.
* @param string $baseType the base Type to instantiate. This must be an instance of [[SpecObjectInterface]].
* The default is [[OpenApi]] which is the base type of a OpenAPI specification file.
Expand All @@ -37,6 +40,9 @@ public static function readFromJson(string $json, string $baseType = OpenApi::cl

/**
* Populate OpenAPI spec object from YAML data.
* @phpstan-template T of SpecObjectInterface
* @phpstan-param class-string<T> $baseType
* @phpstan-return T
* @param string $yaml the YAML string to decode.
* @param string $baseType the base Type to instantiate. This must be an instance of [[SpecObjectInterface]].
* The default is [[OpenApi]] which is the base type of a OpenAPI specification file.
Expand All @@ -52,6 +58,9 @@ public static function readFromYaml(string $yaml, string $baseType = OpenApi::cl

/**
* Populate OpenAPI spec object from a JSON file.
* @phpstan-template T of SpecObjectInterface
* @phpstan-param class-string<T> $baseType
* @phpstan-return T
* @param string $fileName the file name of the file to be read.
* If `$resolveReferences` is true (the default), this should be an absolute URL, a `file://` URI or
* an absolute path to allow resolving relative path references.
Expand Down Expand Up @@ -95,6 +104,9 @@ public static function readFromJsonFile(string $fileName, string $baseType = Ope

/**
* Populate OpenAPI spec object from YAML file.
* @phpstan-template T of SpecObjectInterface
* @phpstan-param class-string<T> $baseType
* @phpstan-return T
* @param string $fileName the file name of the file to be read.
* If `$resolveReferences` is true (the default), this should be an absolute URL, a `file://` URI or
* an absolute path to allow resolving relative path references.
Expand Down