Skip to content

Commit 8a088e4

Browse files
Increased type safety (#10)
* run tests for main branch * review method args types for 'src/Auth' * review method args types for 'src/AQL' * review method args types for 'src/Batch' * Update README.md * review method args types for 'src/Auth' and 'src/AQL' * review method args types for 'src/Collection' and 'src/Document' * review method args types for 'src/DataStructures' and 'src/Http' * inline return for exceptions on 'src/Admin' * inline return for exceptions on 'Database' and 'Transactions' namespaces * declare class attribute types on 'Graph', 'View' and 'Exceptions' namespaces * gh actions: bump 'github/codeql-action/upload-sarif' version * update docs * type checks for 'Graph' namespace * reviewed docs
1 parent 78db272 commit 8a088e4

File tree

68 files changed

+594
-807
lines changed

Some content is hidden

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

68 files changed

+594
-807
lines changed

.github/workflows/codacy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ jobs:
5555

5656
# Upload the SARIF file generated in the previous step
5757
- name: Upload SARIF results file
58-
uses: github/codeql-action/upload-sarif@v2
58+
uses: github/codeql-action/upload-sarif@v3
5959
with:
6060
sarif_file: results.sarif

.github/workflows/php.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: PHP
22

33
on:
44
push:
5-
branches: [ develop ]
5+
branches: [ main, develop ]
66
pull_request:
7-
branches: [ develop ]
7+
branches: [ main, develop ]
88

99
permissions:
1010
contents: read

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ build/
99
cache/
1010
coverage.xml
1111
*.phar
12-
docs/
1312

1413
# Ignore documentation generation script
1514
documentation.php

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
## Installation
1010

1111
### Using composer
12-
- Run the command bellow on your project root.<br>
12+
- Run the command below on your project root.<br>
1313
`composer require lvieira/arangodb-php-odm`
1414

1515
## Usage
@@ -27,7 +27,7 @@ $connection = new Connection([
2727
'database' => 'YourDatabase',
2828
]);
2929

30-
// Alternatively, you can set an host and a port to connect
30+
// Alternatively, you can set a host and a port to connect
3131
$connection = new Connection([
3232
'host' => 'http://yourarangohost',
3333
'port' => 8529,
@@ -68,25 +68,25 @@ $connection = new Connection([
6868

6969
$database = $connection->getDatabase();
7070

71-
// With database object, we can retrive informations about it.
71+
// With a database object, we can retrieve information about it.
7272
$infoAboutCurrentDatabase = $database->getInfo();
7373

74-
// Check if database has a collection
74+
// Check if the database has a collection
7575
if($database->hasCollection('my_collection_name')){
7676
echo "Collection exists!";
7777
} else {
78-
echo "Collection doesn't exists";
78+
echo "Collection doesn't exist";
7979
}
8080

81-
// We can also create collections in database
81+
// We can also create collections in the database
8282
$collection = $database->createCollection('my_new_colletion');
8383

8484
// Or retrieve existing collections
8585
$collection = $database->getCollection('my_existing_collection');
8686

87-
// With Database class we can create and drop databases
87+
// With the Database class we can create and drop databases
8888

89-
// Lists the databases on server
89+
// Lists the databases on the server
9090
$dbList = Database::list($connection);
9191

9292
// You can create a new database using the existing connection
@@ -116,13 +116,13 @@ $connection = new Connection([
116116

117117
$database = $connection->getDatabase();
118118

119-
// If collection exists on database, the object will be a representation of it.
119+
// If a collection exists on a database, the object will represent it.
120120
$collection = new Collection('my_collection_name', $database);
121121

122-
// If collection not exists, you can create it with method 'save'
122+
// If the collection does not exist, you can create it with the method 'save'
123123
$collection->save();
124124

125-
// Get all documents from collection
125+
// Get all documents from the collection
126126
foreach ($collection->all() as $document){
127127
// Do something.
128128
}
@@ -175,7 +175,7 @@ $document->save();
175175
$document->status = 'active';
176176
$document->save(); // Will update your document on server;
177177

178-
// Delete the document from collection.
178+
// Delete the document from the collection.
179179
$document->delete();
180180
```
181181

@@ -206,7 +206,7 @@ try {
206206
$transaction = new JavascriptTransaction($this->getConnectionObject(), $action, $options);
207207
$result = $transaction->execute(); // Will return 1.
208208
} catch (TransactionException $transactionException) {
209-
// Throws an TransactionException in case of error.
209+
// Throws a TransactionException in case of error.
210210
return $transactionException->getMessage();
211211
}
212212
```
@@ -265,8 +265,8 @@ try {
265265

266266
## Documentation
267267

268-
Check the [full documentation](https://lucassouzavieira.github.io/arangodb-php-odm/v1.0.0/index.html) of project:
268+
Check the [API Reference](https://lucassouzavieira.github.io/arangodb-php-odm/).
269269

270270
## Contributing
271271

272-
[Check how contribute in this project](CONTRIBUTING.md)
272+
[Check how to contribute to this project](CONTRIBUTING.md)

docs/classes/ArangoDB-AQL-AQL.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,9 @@ <h4 class="phpdocumentor-element__name" id="method_functions">
355355
<aside class="phpdocumentor-element-found-in">
356356
<abbr class="phpdocumentor-element-found-in__file" title="src/AQL/AQL.php"><a href="files/src-aql-aql.html"><abbr title="src/AQL/AQL.php">AQL.php</abbr></a></abbr>
357357
:
358-
<span class="phpdocumentor-element-found-in__line">63</span>
358+
<span class="phpdocumentor-element-found-in__line">62</span>
359359

360-
<a href="classes/ArangoDB-AQL-AQL.html#source-view.63" class="phpdocumentor-element-found-in__source" data-line="63" data-modal="source-view" data-src="files/src/AQL/AQL.php.txt"></a>
360+
<a href="classes/ArangoDB-AQL-AQL.html#source-view.62" class="phpdocumentor-element-found-in__source" data-line="62" data-modal="source-view" data-src="files/src/AQL/AQL.php.txt"></a>
361361
</aside>
362362

363363
<p class="phpdocumentor-summary">Returns all registered AQL user functions.</p>

docs/classes/ArangoDB-AQL-BindContainer.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ <h4 id="toc-methods">
360360
<span>
361361
&nbsp;: mixed </span>
362362
</dt>
363-
<dd>Get a value by it&#039;s key</dd>
363+
<dd>Get a value by its key</dd>
364364

365365
<dt class="phpdocumentor-table-of-contents__entry -method -public">
366366
<a href="classes/ArangoDB-AQL-BindContainer.html#method_getAll">getAll()</a>
@@ -705,11 +705,11 @@ <h4 class="phpdocumentor-element__name" id="method_get">
705705
<a href="classes/ArangoDB-AQL-BindContainer.html#source-view.76" class="phpdocumentor-element-found-in__source" data-line="76" data-modal="source-view" data-src="files/src/DataStructures/ArrayList.php.txt"></a>
706706
</aside>
707707

708-
<p class="phpdocumentor-summary">Get a value by it&#039;s key</p>
708+
<p class="phpdocumentor-summary">Get a value by its key</p>
709709

710710
<code class="phpdocumentor-code phpdocumentor-signature ">
711711
<span class="phpdocumentor-signature__visibility">public</span>
712-
<span class="phpdocumentor-signature__name">get</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type"><a href=""></a>&nbsp;</span><span class="phpdocumentor-signature__argument__name">$key</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
712+
<span class="phpdocumentor-signature__name">get</span><span>(</span><span class="phpdocumentor-signature__argument"><span class="phpdocumentor-signature__argument__return-type">int|string&nbsp;</span><span class="phpdocumentor-signature__argument__name">$key</span></span><span>)</span><span> : </span><span class="phpdocumentor-signature__response_type">mixed</span></code>
713713

714714
<div class="phpdocumentor-label-line">
715715
</div>
@@ -718,7 +718,7 @@ <h5 class="phpdocumentor-argument-list__heading">Parameters</h5>
718718
<dl class="phpdocumentor-argument-list">
719719
<dt class="phpdocumentor-argument-list__entry">
720720
<span class="phpdocumentor-signature__argument__name">$key</span>
721-
: <span class="phpdocumentor-signature__argument__return-type"><a href=""></a></span>
721+
: <span class="phpdocumentor-signature__argument__return-type">int|string</span>
722722
</dt>
723723
<dd class="phpdocumentor-argument-list__definition">
724724
<section class="phpdocumentor-description"><p>Key to verify on list.</p>

0 commit comments

Comments
 (0)