Conversation
solr/Documents/SolrDocument.php
Outdated
| * Returns a SolrInputDocument equivalent of the object | ||
| * @link https://php.net/manual/en/solrdocument.getinputdocument.php | ||
| * @return SolrInputDocument <p> | ||
| * @return SolrInputDocument|null <p> |
There was a problem hiding this comment.
It say Returns a SolrInputDocument on success and <b>NULL</b> on failure.
There was a problem hiding this comment.
@VincentLanglet I suppose it's just a bug in docs text since the very same page shows return type as SolrInputDocument. Also a simple code that causes error
<?php
declare(strict_types=1);
if (!extension_loaded('solr')) {
fwrite(STDERR, "The solr extension is not loaded.\n");
exit(1);
}
$doc = new SolrDocument();
$doc->unserialize('<not-a-valid-solr-document></not-a-valid-solr-document>');
$result = $doc->getInputDocument();
var_dump($result);
if ($result === null) {
echo "OK: getInputDocument() returned null on failure.\n";
} else {
echo "Unexpected: getInputDocument() did not return null.\n";
var_dump($result);
}
actually shows that the method returns SolrInputDocument
There was a problem hiding this comment.
I reverted this change then.
solr/Documents/SolrDocument.php
Outdated
| * Returns a SolrInputDocument equivalent of the object | ||
| * @link https://php.net/manual/en/solrdocument.getinputdocument.php | ||
| * @return SolrInputDocument <p> | ||
| * @return SolrInputDocument|null <p> |
There was a problem hiding this comment.
@VincentLanglet I suppose it's just a bug in docs text since the very same page shows return type as SolrInputDocument. Also a simple code that causes error
<?php
declare(strict_types=1);
if (!extension_loaded('solr')) {
fwrite(STDERR, "The solr extension is not loaded.\n");
exit(1);
}
$doc = new SolrDocument();
$doc->unserialize('<not-a-valid-solr-document></not-a-valid-solr-document>');
$result = $doc->getInputDocument();
var_dump($result);
if ($result === null) {
echo "OK: getInputDocument() returned null on failure.\n";
} else {
echo "Unexpected: getInputDocument() did not return null.\n";
var_dump($result);
}
actually shows that the method returns SolrInputDocument
solr/Queries/SolrQuery.php
Outdated
| * The value to use. | ||
| * </p> | ||
| * @param string $field_override <p> | ||
| * @param string $field_override [Optional] <p> |
There was a problem hiding this comment.
[Optional] can be removed here, actually. Optionality of a parameter is obvious from its default value. Stubs use [optional] in some other places because due to some reasons it's impossible to add a default value in signature, but it's not a case here
There was a problem hiding this comment.
I removed it then.
Mainly improving
optionalparam signature by adding a default value.cf https://www.php.net/manual/en/class.solrdismaxquery.php for instance
And a missing
@return void