Skip to content

Commit b4909e8

Browse files
authored
PHPLIB-1117: Remove @api annotation (#1087)
* Setup rector * Remove api annotation, all classes are public by default unless marked with internal
1 parent f75d3a8 commit b4909e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+40
-52
lines changed

CONTRIBUTING.md

Lines changed: 11 additions & 0 deletions

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
"symfony/polyfill-php80": "^1.27"
1919
},
2020
"require-dev": {
21-
"squizlabs/php_codesniffer": "^3.7",
2221
"doctrine/coding-standard": "^11.1",
22+
"rector/rector": "^0.16.0",
23+
"squizlabs/php_codesniffer": "^3.7",
2324
"symfony/phpunit-bridge": "^5.2",
2425
"vimeo/psalm": "^4.28"
2526
},
@@ -39,6 +40,7 @@
3940
"config": {
4041
"allow-plugins": {
4142
"dealerdirect/phpcodesniffer-composer-installer": true
42-
}
43+
},
44+
"sort-packages": true
4345
}
4446
}

rector.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
use Rector\Config\RectorConfig;
4+
use Rector\DeadCode\Rector\ClassLike\RemoveAnnotationRector;
5+
6+
return static function (RectorConfig $rectorConfig): void {
7+
$rectorConfig->paths([
8+
__DIR__ . '/examples',
9+
__DIR__ . '/src',
10+
__DIR__ . '/tests',
11+
__DIR__ . '/tools',
12+
]);
13+
14+
/**
15+
* All classes are public API by default, unless marked with @internal.
16+
*/
17+
$rectorConfig->ruleWithConfiguration(RemoveAnnotationRector::class, ['api']);
18+
19+
// define sets of rules
20+
// $rectorConfig->sets([
21+
// LevelSetList::UP_TO_PHP_72
22+
// ]);
23+
};

src/ChangeStream.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@
3333
/**
3434
* Iterator for a change stream.
3535
*
36-
* @psalm-type ResumeCallable = callable(array|object|null, bool): ChangeStreamIterator
37-
*
38-
* @api
3936
* @see \MongoDB\Collection::watch()
4037
* @see https://mongodb.com/docs/manual/reference/method/db.watch/#mongodb-method-db.watch
38+
*
39+
* @psalm-type ResumeCallable = callable(array|object|null, bool): ChangeStreamIterator
4140
*/
4241
class ChangeStream implements Iterator
4342
{

src/GridFS/Bucket.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@
5959
/**
6060
* Bucket provides a public API for interacting with the GridFS files and chunks
6161
* collections.
62-
*
63-
* @api
6462
*/
6563
class Bucket
6664
{

src/MapReduceResult.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
* output method (e.g. inline, collection) via the IteratorAggregate interface.
3232
* It also provides access to command statistics.
3333
*
34-
* @api
3534
* @see \MongoDB\Collection::mapReduce()
3635
* @see https://mongodb.com/docs/manual/reference/command/mapReduce/
3736
*/

src/Model/BSONArray.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@
3131
*
3232
* The internal data will be filtered through array_values() during BSON
3333
* serialization to ensure that it becomes a BSON array.
34-
*
35-
* @api
3634
*/
3735
class BSONArray extends ArrayObject implements JsonSerializable, Serializable, Unserializable
3836
{

src/Model/BSONDocument.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
*
3131
* The internal data will be cast to an object during BSON serialization to
3232
* ensure that it becomes a BSON document.
33-
*
34-
* @api
3533
*/
3634
class BSONDocument extends ArrayObject implements JsonSerializable, Serializable, Unserializable
3735
{

src/Model/CollectionInfo.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
* command or, for legacy servers, queries on the "system.namespaces"
3131
* collection. It provides methods to access options for the collection.
3232
*
33-
* @api
3433
* @see \MongoDB\Database::listCollections()
3534
* @see https://github.com/mongodb/specifications/blob/master/source/enumerate-collections.rst
3635
*/

src/Model/CollectionInfoIterator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*
2626
* This iterator is used for enumerating collections in a database.
2727
*
28-
* @api
2928
* @see \MongoDB\Database::listCollections()
3029
*/
3130
interface CollectionInfoIterator extends Iterator

0 commit comments

Comments
 (0)