Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
4698256
Bump PHP requirement to 8.1
norkunas Apr 9, 2025
8b9a442
Add missing types
norkunas Apr 9, 2025
b08c13e
Add task object and related enums
norkunas Apr 9, 2025
8017944
Replace task array return with Task object
norkunas Apr 9, 2025
a4091a9
Add tests for missing coverage report
norkunas Apr 10, 2025
204f354
Fix conflicts
norkunas May 5, 2025
444e391
Remove unused variable
norkunas May 14, 2025
b7d0c9c
Fix test method name
norkunas May 14, 2025
12e4e1a
Add a missing phpdoc type for documentId validation
norkunas May 14, 2025
fe3c1ff
Remove task type that does not exist
norkunas May 14, 2025
6cb7c0e
Add comment about array access retrocompatibility
norkunas May 14, 2025
23813ac
Fix tests after `TaskType::documentEdition` removal
norkunas May 14, 2025
412c8bd
Revert "Fix tests after `TaskType::documentEdition` removal"
norkunas May 14, 2025
c523684
Revert "Remove task type that does not exist"
norkunas May 14, 2025
6a601da
Add a `non-negative-int` hint for `searchCutoffMs` setting value
norkunas May 14, 2025
757f5cf
Add typed TaskDetails and TaskError + fix namespace casing
norkunas May 14, 2025
a1d5654
Wrap in Task `Indexes::getTask`
norkunas May 14, 2025
18813de
Rename `$promise` to `$task` in tests
norkunas May 14, 2025
605d8dd
Wrap tasks in `TasksResults` object with `Task` object
norkunas May 14, 2025
bd8fc9a
Replace task array access usage with getters
norkunas May 14, 2025
998de9b
Completely replace array data usage
norkunas May 14, 2025
2e771aa
Fix bot review
norkunas May 14, 2025
a7aa9f3
Add assertion
norkunas May 14, 2025
eaf2a27
Fix missing coverage
norkunas May 14, 2025
fbfaf1f
Fix phpstan errors
norkunas May 14, 2025
a809c4d
Configure phpunit to display deprecations/errors/notices/warnings
norkunas May 15, 2025
7bed369
Fix TaskDeletionDetails to accept `deletedTasks`
norkunas May 15, 2025
96c6c58
Fix `DocumentDeletionDetails` to not require `providedIds` (not avail…
norkunas May 15, 2025
db15b4b
Remove task array access
norkunas May 15, 2025
c42a611
Fix test
norkunas May 15, 2025
c4f3355
Add missing typehints
norkunas May 16, 2025
1412f52
Add the `disableOnNumbers` field to SettingsUpdateDetails on `typoTol…
norkunas Jun 3, 2025
191c422
Fix code review
norkunas Jun 3, 2025
4a32e09
Add `wait` method to task
norkunas Jun 3, 2025
e5c7ba6
Use `str_contains`
norkunas Jun 3, 2025
bfb0a87
Fix another review comment
norkunas Jun 4, 2025
5a7a310
Avoid count
norkunas Jun 4, 2025
d975de0
Always use JSON_THROW_ON_ERROR
norkunas Jun 4, 2025
c51d9ab
Fix CS
norkunas Jun 4, 2025
4bb394b
Fix lint
norkunas Jun 10, 2025
397cd4b
Fix test
norkunas Jun 10, 2025
db46570
Fix code review
norkunas Nov 17, 2025
12574f2
Fix test
norkunas Nov 17, 2025
c0e77e2
Remove dropped php versions from gh workflows
norkunas Nov 17, 2025
288f6c5
Fix coderabbit comment
norkunas Nov 17, 2025
6f61cea
Fix failing tests
norkunas Nov 17, 2025
33c2781
Pass waiter fn
norkunas Nov 17, 2025
93512cd
Add missing type
norkunas Nov 17, 2025
4b361f1
Add missing types
norkunas Nov 17, 2025
a01eab9
Add `UnknownTaskDetails`, `TaskType::Unknown`, `TaskStatus::Unknown`
norkunas Nov 17, 2025
9275679
Fix passing no details
norkunas Nov 17, 2025
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 .github/workflows/meilisearch-beta-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
MEILI_NO_ANALYTICS: true
strategy:
matrix:
php-version: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
php-version: ["8.1", "8.2", "8.3", "8.4"]

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-release-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
MEILI_NO_ANALYTICS: true
strategy:
matrix:
php-version: ["7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
php-version: ["8.1", "8.2", "8.3", "8.4"]

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
MEILI_NO_ANALYTICS: true
strategy:
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php-version: ['8.1', '8.2', '8.3', '8.4']

steps:
- uses: actions/checkout@v5
Expand Down
5 changes: 2 additions & 3 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,8 @@
'void_return' => true,
'native_function_invocation' => ['include' => ['@compiler_optimized'], 'scope' => 'namespaced'],
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'php_unit_strict' => true,
// @todo: when we'll support only PHP 8.0 and upper, we can enable `parameters` for `trailing_comma_in_multiline` rule
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['array_destructuring', 'arrays', 'match'/* , 'parameters' */]],
'php_unit_strict' => false,
'trailing_comma_in_multiline' => ['after_heredoc' => true, 'elements' => ['array_destructuring', 'arrays', 'match', 'parameters']],
])
->setRiskyAllowed(true)
->setFinder($finder);
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,20 @@
],
"minimum-stability": "stable",
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.1",
"ext-json": "*",
"php-http/discovery": "^1.7",
"php-http/discovery": "^1.19",
"psr/http-client": "^1.0",
"symfony/polyfill-php81": "^1.33"
},
"autoload": {
"psr-4": {
"MeiliSearch\\": "src/",
"Meilisearch\\": "src/"
}
},
"files": [
"src/functions.php"
]
},
"autoload-dev": {
"psr-4": {
Expand All @@ -54,7 +57,7 @@
"symfony/http-client": "Use Symfony Http client"
},
"require-dev": {
"phpunit/phpunit": "^9.5 || ^10.5",
"phpunit/phpunit": "^10.5",
"php-cs-fixer/shim": "^3.59.3",
"http-interop/http-factory-guzzle": "^1.2.0",
"phpstan/phpstan": "^2.0",
Expand Down
25 changes: 23 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" bootstrap="vendor/autoload.php" stopOnFailure="false" cacheResult="false" colors="true" cacheDirectory=".phpunit.cache">
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
stopOnFailure="false"
cacheResult="false"
colors="true"
cacheDirectory=".phpunit.cache"
displayDetailsOnPhpunitDeprecations="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerWarnings="true"
>
<testsuites>
<testsuite name="Tests">
<directory suffix="Test.php">./tests</directory>
Expand All @@ -9,7 +22,15 @@
<env name="MEILISEARCH_URL" value="http://localhost:7700"/>
<env name="MEILISEARCH_API_KEY" value="masterKey"/>
</php>
<source>
<source
ignoreSuppressionOfDeprecations="true"
ignoreSuppressionOfPhpDeprecations="true"
ignoreSuppressionOfErrors="true"
ignoreSuppressionOfNotices="true"
ignoreSuppressionOfPhpNotices="true"
ignoreSuppressionOfWarnings="true"
ignoreSuppressionOfPhpWarnings="true"
>
<include>
<directory>src/</directory>
</include>
Expand Down
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(
?ClientInterface $httpClient = null,
?RequestFactoryInterface $requestFactory = null,
array $clientAgents = [],
?StreamFactoryInterface $streamFactory = null
?StreamFactoryInterface $streamFactory = null,
) {
$this->http = new MeilisearchClientAdapter($url, $apiKey, $httpClient, $requestFactory, $clientAgents, $streamFactory);
$this->chats = new ChatWorkspaces($this->http);
Expand Down
11 changes: 3 additions & 8 deletions src/Contracts/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

class Data implements \ArrayAccess, \Countable, \IteratorAggregate
{
protected $data = [];
protected array $data = [];

public function __construct(array $data = [])
{
Expand All @@ -28,14 +28,9 @@ public function offsetUnset($offset): void
unset($this->data[$offset]);
}

#[\ReturnTypeWillChange]
public function offsetGet($offset)
public function offsetGet($offset): mixed
{
if (isset($this->data[$offset])) {
return $this->data[$offset];
}

return null;
return $this->data[$offset] ?? null;
}

public function count(): int
Expand Down
8 changes: 4 additions & 4 deletions src/Contracts/Http.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ public function get(string $path, array $query = []);
* @throws ApiException
* @throws \JsonException
*/
public function post(string $path, $body = null, array $query = [], ?string $contentType = null);
public function post(string $path, mixed $body = null, array $query = [], ?string $contentType = null);

/**
* @param non-empty-string|null $contentType
*
* @throws ApiException
* @throws \JsonException
*/
public function put(string $path, $body = null, array $query = [], ?string $contentType = null);
public function put(string $path, mixed $body = null, array $query = [], ?string $contentType = null);

/**
* @throws ApiException
* @throws \JsonException
*/
public function patch(string $path, $body = null, array $query = []);
public function patch(string $path, mixed $body = null, array $query = []);

/**
* @throws ApiException
Expand All @@ -47,5 +47,5 @@ public function delete(string $path, array $query = []);
* @throws ApiException
* @throws \JsonException
*/
public function postStream(string $path, $body = null, array $query = []): StreamInterface;
public function postStream(string $path, mixed $body = null, array $query = []): StreamInterface;
}
21 changes: 8 additions & 13 deletions src/Contracts/SimilarDocumentsQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
class SimilarDocumentsQuery
{
/**
* @var int|string
* @var int|non-empty-string
*/
private $id;
private int|string $id;

/**
* @var non-empty-string
Expand Down Expand Up @@ -42,16 +42,13 @@ class SimilarDocumentsQuery
*/
private ?array $filter = null;

/**
* @var int|float|null
*/
private $rankingScoreThreshold;
private int|float|null $rankingScoreThreshold = null;

/**
* @param int|string $id
* @param non-empty-string $embedder
* @param int|non-empty-string $id
* @param non-empty-string $embedder
*/
public function __construct($id, string $embedder)
public function __construct(int|string $id, string $embedder)
{
$this->id = $id;
$this->embedder = $embedder;
Expand Down Expand Up @@ -142,11 +139,9 @@ public function setRetrieveVectors(?bool $retrieveVectors): self
}

/**
* @param int|float|null $rankingScoreThreshold
*
* @return $this
*/
public function setRankingScoreThreshold($rankingScoreThreshold): self
public function setRankingScoreThreshold(int|float|null $rankingScoreThreshold): self
{
$this->rankingScoreThreshold = $rankingScoreThreshold;

Expand All @@ -155,7 +150,7 @@ public function setRankingScoreThreshold($rankingScoreThreshold): self

/**
* @return array{
* id: int|string,
* id: int|non-empty-string,
* embedder: non-empty-string,
* offset?: non-negative-int,
* limit?: positive-int,
Expand Down
Loading