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

+11

composer.json

+4-2
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

+23
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

+2-3
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

-2
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

-1
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

-2
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

-2
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

-1
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

-1
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

src/Model/DatabaseInfo.php

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
* This class models the database information returned by the listDatabases
3030
* command. It provides methods to access common database properties.
3131
*
32-
* @api
3332
* @see \MongoDB\Client::listDatabases()
3433
* @see https://mongodb.com/docs/manual/reference/command/listDatabases/
3534
*/

src/Model/DatabaseInfoIterator.php

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*
2626
* This iterator is used for enumerating databases on a server.
2727
*
28-
* @api
2928
* @see \MongoDB\Client::listDatabases()
3029
*/
3130
interface DatabaseInfoIterator extends Iterator

src/Model/IndexInfo.php

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
* For information on keys and index options, see the referenced
3535
* db.collection.createIndex() documentation.
3636
*
37-
* @api
3837
* @see \MongoDB\Collection::listIndexes()
3938
* @see https://github.com/mongodb/specifications/blob/master/source/enumerate-indexes.rst
4039
* @see https://mongodb.com/docs/manual/reference/method/db.collection.createIndex/

src/Model/IndexInfoIterator.php

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*
2626
* This iterator is used for enumerating indexes in a collection.
2727
*
28-
* @api
2928
* @see \MongoDB\Collection::listIndexes()
3029
*/
3130
interface IndexInfoIterator extends Iterator

src/Operation/Aggregate.php

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
/**
4545
* Operation for the aggregate command.
4646
*
47-
* @api
4847
* @see \MongoDB\Collection::aggregate()
4948
* @see https://mongodb.com/docs/manual/reference/command/aggregate/
5049
*/

src/Operation/BulkWrite.php

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
/**
4141
* Operation for executing multiple write operations.
4242
*
43-
* @api
4443
* @see \MongoDB\Collection::bulkWrite()
4544
*/
4645
class BulkWrite implements Executable

src/Operation/Count.php

-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
/**
3838
* Operation for the count command.
3939
*
40-
* @api
4140
* @see \MongoDB\Collection::count()
4241
* @see https://mongodb.com/docs/manual/reference/command/count/
4342
*/

src/Operation/CountDocuments.php

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
/**
3737
* Operation for obtaining an exact count of documents in a collection
3838
*
39-
* @api
4039
* @see \MongoDB\Collection::countDocuments()
4140
* @see https://github.com/mongodb/specifications/blob/master/source/crud/crud.rst#countdocuments
4241
*/

src/Operation/CreateCollection.php

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
/**
3939
* Operation for the create command.
4040
*
41-
* @api
4241
* @see \MongoDB\Database::createCollection()
4342
* @see https://mongodb.com/docs/manual/reference/command/create/
4443
*/

src/Operation/CreateIndexes.php

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
/**
3737
* Operation for the createIndexes command.
3838
*
39-
* @api
4039
* @see \MongoDB\Collection::createIndex()
4140
* @see \MongoDB\Collection::createIndexes()
4241
* @see https://mongodb.com/docs/manual/reference/command/createIndexes/

src/Operation/DatabaseCommand.php

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
/**
3131
* Operation for executing a database command.
3232
*
33-
* @api
3433
* @see \MongoDB\Database::command()
3534
*/
3635
class DatabaseCommand implements Executable

src/Operation/DeleteMany.php

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
/**
2727
* Operation for deleting multiple document with the delete command.
2828
*
29-
* @api
3029
* @see \MongoDB\Collection::deleteOne()
3130
* @see https://mongodb.com/docs/manual/reference/command/delete/
3231
*/

src/Operation/DeleteOne.php

-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
/**
2727
* Operation for deleting a single document with the delete command.
2828
*
29-
* @api
3029
* @see \MongoDB\Collection::deleteOne()
3130
* @see https://mongodb.com/docs/manual/reference/command/delete/
3231
*/

src/Operation/Distinct.php

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
/**
3737
* Operation for the distinct command.
3838
*
39-
* @api
4039
* @see \MongoDB\Collection::distinct()
4140
* @see https://mongodb.com/docs/manual/reference/command/distinct/
4241
*/

src/Operation/DropCollection.php

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
/**
3333
* Operation for the drop command.
3434
*
35-
* @api
3635
* @see \MongoDB\Collection::drop()
3736
* @see \MongoDB\Database::dropCollection()
3837
* @see https://mongodb.com/docs/manual/reference/command/drop/

src/Operation/DropDatabase.php

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
/**
3131
* Operation for the dropDatabase command.
3232
*
33-
* @api
3433
* @see \MongoDB\Client::dropDatabase()
3534
* @see \MongoDB\Database::drop()
3635
* @see https://mongodb.com/docs/manual/reference/command/dropDatabase/

src/Operation/DropIndexes.php

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
/**
3333
* Operation for the dropIndexes command.
3434
*
35-
* @api
3635
* @see \MongoDB\Collection::dropIndexes()
3736
* @see https://mongodb.com/docs/manual/reference/command/dropIndexes/
3837
*/

src/Operation/EstimatedDocumentCount.php

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
/**
3333
* Operation for obtaining an estimated count of documents in a collection
3434
*
35-
* @api
3635
* @see \MongoDB\Collection::estimatedDocumentCount()
3736
* @see https://mongodb.com/docs/manual/reference/command/count/
3837
*/

src/Operation/Explain.php

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
/**
3434
* Operation for the explain command.
3535
*
36-
* @api
3736
* @see \MongoDB\Collection::explain()
3837
* @see https://mongodb.com/docs/manual/reference/command/explain/
3938
*/

src/Operation/Find.php

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
/**
4141
* Operation for the find command.
4242
*
43-
* @api
4443
* @see \MongoDB\Collection::find()
4544
* @see https://mongodb.com/docs/manual/tutorial/query-documents/
4645
* @see https://mongodb.com/docs/manual/reference/operator/query-modifier/

src/Operation/FindOne.php

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
/**
2828
* Operation for finding a single document with the find command.
2929
*
30-
* @api
3130
* @see \MongoDB\Collection::findOne()
3231
* @see https://mongodb.com/docs/manual/tutorial/query-documents/
3332
* @see https://mongodb.com/docs/manual/reference/operator/query-modifier/

src/Operation/FindOneAndDelete.php

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
/**
2929
* Operation for deleting a document with the findAndModify command.
3030
*
31-
* @api
3231
* @see \MongoDB\Collection::findOneAndDelete()
3332
* @see https://mongodb.com/docs/manual/reference/command/findAndModify/
3433
*/

src/Operation/FindOneAndReplace.php

-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
/**
3232
* Operation for replacing a document with the findAndModify command.
3333
*
34-
* @api
3534
* @see \MongoDB\Collection::findOneAndReplace()
3635
* @see https://mongodb.com/docs/manual/reference/command/findAndModify/
3736
*/

src/Operation/FindOneAndUpdate.php

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
/**
3333
* Operation for updating a document with the findAndModify command.
3434
*
35-
* @api
3635
* @see \MongoDB\Collection::findOneAndUpdate()
3736
* @see https://mongodb.com/docs/manual/reference/command/findAndModify/
3837
*/

src/Operation/InsertMany.php

-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
/**
3535
* Operation for inserting multiple documents with the insert command.
3636
*
37-
* @api
3837
* @see \MongoDB\Collection::insertMany()
3938
* @see https://mongodb.com/docs/manual/reference/command/insert/
4039
*/

src/Operation/InsertOne.php

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
/**
3434
* Operation for inserting a single document with the insert command.
3535
*
36-
* @api
3736
* @see \MongoDB\Collection::insertOne()
3837
* @see https://mongodb.com/docs/manual/reference/command/insert/
3938
*/

src/Operation/ListCollectionNames.php

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
/**
2828
* Operation for the listCollectionNames helper.
2929
*
30-
* @api
3130
* @see \MongoDB\Database::listCollectionNames()
3231
* @see https://mongodb.com/docs/manual/reference/command/listCollections/
3332
*/

src/Operation/ListCollections.php

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
/**
2828
* Operation for the listCollections command.
2929
*
30-
* @api
3130
* @see \MongoDB\Database::listCollections()
3231
* @see https://mongodb.com/docs/manual/reference/command/listCollections/
3332
*/

src/Operation/ListDatabaseNames.php

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
/**
3131
* Operation for the ListDatabases command, returning only database names.
3232
*
33-
* @api
3433
* @see \MongoDB\Client::listDatabaseNames()
3534
* @see https://mongodb.com/docs/manual/reference/command/listDatabases/#mongodb-dbcommand-dbcmd.listDatabases
3635
*/

src/Operation/ListDatabases.php

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
/**
2929
* Operation for the ListDatabases command.
3030
*
31-
* @api
3231
* @see \MongoDB\Client::listDatabases()
3332
* @see https://mongodb.com/docs/manual/reference/command/listDatabases/#mongodb-dbcommand-dbcmd.listDatabases`
3433
*/

src/Operation/ListIndexes.php

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
/**
3434
* Operation for the listIndexes command.
3535
*
36-
* @api
3736
* @see \MongoDB\Collection::listIndexes()
3837
* @see https://mongodb.com/docs/manual/reference/command/listIndexes/
3938
*/

src/Operation/MapReduce.php

-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
/**
4949
* Operation for the mapReduce command.
5050
*
51-
* @api
5251
* @see \MongoDB\Collection::mapReduce()
5352
* @see https://mongodb.com/docs/manual/reference/command/mapReduce/
5453
*/

src/Operation/ModifyCollection.php

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
/**
3131
* Operation for the collMod command.
3232
*
33-
* @api
3433
* @see \MongoDB\Database::modifyCollection()
3534
* @see https://mongodb.com/docs/manual/reference/command/collMod/
3635
*/

src/Operation/RenameCollection.php

-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
/**
3333
* Operation for the renameCollection command.
3434
*
35-
* @api
3635
* @see \MongoDB\Collection::rename()
3736
* @see \MongoDB\Database::renameCollection()
3837
* @see https://mongodb.com/docs/manual/reference/command/renameCollection/

0 commit comments

Comments
 (0)