Skip to content
This repository has been archived by the owner on May 23, 2024. It is now read-only.

@api-see now has support for static/self targets. #76

Merged
merged 1 commit into from
May 10, 2017
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion resources/examples/Showtimes/Representations/Movie.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function create()
/**
* @api-data external_urls (object) - External URLs
* @api-version >=1.1
* @api-see \Mill\Examples\Showtimes\Representations\Movie::getExternalUrls external_urls
* @api-see self::getExternalUrls external_urls
*/
'external_urls' => $this->getExternalUrls(),

Expand Down
1 change: 1 addition & 0 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -923,6 +923,7 @@ public function doesErrorRepresentationNeedAnErrorCode($representation)
*/
private function getClassFQNFromFile($file)
{
/** @var resource $fp */
$fp = fopen($file, 'r');
$class = $namespace = $buffer = '';
$i = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/Parser/Representation/RepresentationParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ public function parseAnnotations(array $tags, $original_content)
// If we matched an `@api-see` annotation, then let's parse it out into viable annotations.
if (!empty($has_see)) {
list($see_class, $see_method) = explode('::', array_shift($has_see));
if (in_array(strtolower($see_class), ['self', 'static'])) {
$see_class = $this->class;
}

$prefix = array_shift($has_see);

$parser = new self($see_class);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php
namespace Mill\Tests\Fixtures\Representations;

use Mill\Examples\Showtimes\Representations\Movie;

/**
* @api-label RepresentationWithOnlyApiSee
*/
Expand All @@ -11,5 +13,6 @@ public function create()
/**
* @api-see \Mill\Examples\Showtimes\Representations\Movie::create
*/
return (new Movie())->create();
}
}