Skip to content

Commit 785890a

Browse files
authored
use phpDocumentor 3 + misc doc comment cleanup (#68)
1 parent b8d539a commit 785890a

19 files changed

+106
-90
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ composer.phar
77
integration-tests/vendor
88
composer.lock
99
docs/build
10+
docs/.phpdoc
1011
.phpunit.result.cache

.ldrelease/build-docs.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/bash
22

3+
# This script assumes that it is running in a Docker container using the image
4+
# "ldcircleci/php-sdk-release", defined in https://github.com/launchdarkly/sdks-ci-docker
5+
36
set -e
47

58
cd docs
6-
make PHPDOC_ARCHIVE=/home/circleci/ldtools/phpDocumentor.phar # provided in ldcircleci/ld-php-sdk-release image
9+
make

.ldrelease/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ publications:
88

99
circleci:
1010
linux:
11-
image: ldcircleci/ld-php-sdk-release:1 # built in sdks-ci-docker project, contains PHP 7.2 + phpDocumentor
11+
image: ldcircleci/php-sdk-release:1 # built in sdks-ci-docker project, contains PHP 7.3 + phpDocumentor 3
1212

1313
documentation:
1414
githubPages: true

docs/Makefile

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11

2-
# PHPDOC_ARCHIVE is overridden in the CircleCI release
3-
PHPDOC_ARCHIVE := $(shell pwd)/build/phpDocumentor.phar
4-
OUTPUT_DIR := $(shell pwd)/build
5-
PHPDOC_URL=https://www.phpdoc.org/phpDocumentor.phar
2+
SOURCE_DIR = $(shell cd .. && pwd)
3+
PHPDOCUMENTOR = php $(LDTOOLS_DIR)/php/phpDocumentor.phar
64

7-
.PHONY: install html
5+
.PHONY: html
86

9-
html: install
7+
html:
108
rm -rf build/temp build/html
11-
cd .. && php $(PHPDOC_ARCHIVE) --visibility public --title "LaunchDarkly PHP SDK ${LD_RELEASE_VERSION}"
12-
13-
install: $(PHPDOC_ARCHIVE)
14-
15-
$(PHPDOC_ARCHIVE):
16-
mkdir -p build
17-
cd build && unzip ../lib/phpDocumentor.phar.zip
9+
$(PHPDOCUMENTOR) \
10+
-d $(SOURCE_DIR) \
11+
-t build/html \
12+
--ignore vendor/ \
13+
--ignore tests/ \
14+
--ignore docs/ \
15+
--ignore src/LaunchDarkly/Impl \
16+
--visibility public \
17+
--defaultpackagename "SDK" \
18+
--title "LaunchDarkly PHP SDK ${LD_RELEASE_VERSION}"

src/LaunchDarkly/EvaluationDetail.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* An object that combines the result of a flag evaluation with an explanation of how it was calculated.
99
*
10-
* This is returned by {@link \LaunchDarkly\LDClient::variationDetail()}.
10+
* This is returned by {@see \LaunchDarkly\LDClient::variationDetail()}.
1111
*/
1212
class EvaluationDetail
1313
{

src/LaunchDarkly/EvaluationReason.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* Describes the reason that a flag evaluation produced a particular value.
77
*
8-
* This is part of the {@link \LaunchDarkly\EvaluationDetail} object returned by {@link \LaunchDarkly\LDClient::variationDetail()}.
8+
* This is part of the {@see \LaunchDarkly\EvaluationDetail} object returned by {@see \LaunchDarkly\LDClient::variationDetail()}.
99
*/
1010
class EvaluationReason implements \JsonSerializable
1111
{

src/LaunchDarkly/EventPublisher.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44
/**
55
* Interface for the component that sends events to the LaunchDarkly service.
66
*
7-
* The default implementation is {@link \LaunchDarkly\Integrations\Curl::eventPublisher()}. The SDK also
8-
* provides {@link \LaunchDarkly\Integrations\Guzzle::eventPublisher()}.
7+
* The default implementation is {@see \LaunchDarkly\Integrations\Curl::eventPublisher()}. The SDK also
8+
* provides {@see \LaunchDarkly\Integrations\Guzzle::eventPublisher()}.
99
*/
1010
interface EventPublisher
1111
{
12-
/** @var int */
12+
/**
13+
* @var int
14+
* @ignore
15+
*/
1316
const CURRENT_SCHEMA_VERSION = 2;
1417

1518
/**

src/LaunchDarkly/FeatureFlagsState.php

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22
namespace LaunchDarkly;
33

44
use LaunchDarkly\Impl\Model\FeatureFlag;
5+
use LaunchDarkly\LDClient;
56

67
/**
78
* A snapshot of the state of all feature flags with regard to a specific user.
89
*
9-
* This is generated by calling {@link \LaunchDarkly\LDClient::allFlagsState()}.
10+
* This is generated by calling {@see \LaunchDarkly\LDClient::allFlagsState()}.
1011
*
1112
* Serializing this object to JSON using json_encode(), or the jsonSerialize() method, will produce the
1213
* appropriate data structure for bootstrapping the LaunchDarkly JavaScript client. See the SDK
@@ -87,11 +88,12 @@ public function getFlagValue(string $key)
8788
}
8889

8990
/**
90-
* Returns the evaluation reason for an individual feature flag (as returned by LDClient.variationDetail())
91+
* Returns the evaluation reason for an individual feature flag (as returned by variationDetail())
9192
* at the time the state was recorded.
9293
* @param string $key the feature flag key
9394
* @return EvaluationReason|null the evaluation reason; null if reasons were not recorded, or if there
9495
* was no such flag
96+
* @see \LaunchDarkly\LDClient::variationDetail()
9597
*/
9698
public function getFlagReason(string $key): ?EvaluationReason
9799
{
@@ -103,9 +105,10 @@ public function getFlagReason(string $key): ?EvaluationReason
103105
}
104106

105107
/**
106-
* Returns an associative array of flag keys to flag values. If a flag would have evaluated to the default
107-
* value, its value will be null.
108-
* <p>
108+
* Returns an associative array of flag keys to flag values.
109+
*
110+
* If a flag would have evaluated to the default value, its value will be null.
111+
*
109112
* Do not use this method if you are passing data to the front end to "bootstrap" the JavaScript client.
110113
* Instead, use jsonSerialize().
111114
* @return array an associative array of flag keys to JSON values
@@ -117,9 +120,10 @@ public function toValuesMap(): array
117120

118121
/**
119122
* Returns a JSON representation of the entire state map (as an associative array), in the format used
120-
* by the LaunchDarkly JavaScript SDK. Use this method if you are passing data to the front end in
121-
* order to "bootstrap" the JavaScript client.
122-
* <p>
123+
* by the LaunchDarkly JavaScript SDK.
124+
*
125+
* Use this method if you are passing data to the front end in order to "bootstrap" the JavaScript client.
126+
*
123127
* Note that calling json_encode() on a FeatureFlagsState object will automatically use the
124128
* jsonSerialize() method.
125129
* @return array an associative array suitable for passing as a JSON object

src/LaunchDarkly/FeatureRequester.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
/**
88
* Interface for the component that retrieves feature flag data.
99
*
10-
* The default implementation is {@link \LaunchDarkly\Integrations\Guzzle::featureRequester()}, which requests
10+
* The default implementation is {@see \LaunchDarkly\Integrations\Guzzle::featureRequester()}, which requests
1111
* flags inefficiently via HTTP on demand. For other implementations, including database integrations, see the
1212
* LaunchDarkly\Integrations namespace.
1313
*/

src/LaunchDarkly/Impl/Integrations/FeatureRequesterBase.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ protected function __construct(string $baseUri, string $sdkKey, array $options)
4242
/**
4343
* Override this method to read a JSON object (as a string) from the underlying store.
4444
*
45-
* @param $namespace "features" or "segments"
46-
* @param $key flag or segment key
45+
* @param string $namespace "features" or "segments"
46+
* @param string $key flag or segment key
4747
* @return string|null the stored JSON data, or null if not found
4848
*/
4949
protected function readItemString(string $namespace, string $key): ?string
@@ -54,7 +54,7 @@ protected function readItemString(string $namespace, string $key): ?string
5454
/**
5555
* Override this method to read a set of JSON objects (as strings) from the underlying store.
5656
*
57-
* @param $namespace "features" or "segments"
57+
* @param string $namespace "features" or "segments"
5858
* @return array|null array of stored JSON strings
5959
*/
6060
protected function readItemStringList(string $namespace): ?array
@@ -76,7 +76,7 @@ protected function createCache(array $options): ?FeatureRequesterCache
7676
/**
7777
* Gets an individual feature flag.
7878
*
79-
* @param $key string feature flag key
79+
* @param string $key feature flag key
8080
* @return FeatureFlag|null The decoded JSON feature data, or null if missing
8181
*/
8282
public function getFeature(string $key): ?FeatureFlag
@@ -98,7 +98,7 @@ public function getFeature(string $key): ?FeatureFlag
9898
/**
9999
* Gets an individual user segment.
100100
*
101-
* @param $key string segment key
101+
* @param string $key segment key
102102
* @return Segment|null The decoded JSON segment data, or null if missing
103103
*/
104104
public function getSegment(string $key): ?Segment

0 commit comments

Comments
 (0)