Skip to content

Commit 792e38e

Browse files
authored
Merge pull request #178 from wp-blocks/8.4-compat
B8 - php 8.4 compatibility
2 parents 4a0df02 + 5267c90 commit 792e38e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

core/b8/b8/b8.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function __construct(array $config = [],
122122
* @param string The text to classify
123123
* @return mixed float The rating between 0 (ham) and 1 (spam) or an error code
124124
*/
125-
public function classify(string $text = null)
125+
public function classify(?string $text = null)
126126
{
127127
// Let's first see if the user called the function correctly
128128
if ($text === null) {
@@ -325,7 +325,7 @@ private function check_category(string $category)
325325
* @param string Either b8::SPAM or b8::HAM
326326
* @return mixed void or an error code
327327
*/
328-
public function learn(string $text = null, string $category = null)
328+
public function learn(?string $text = null, ?string $category = null)
329329
{
330330
// Let's first see if the user called the function correctly
331331
if ($text === null) {
@@ -346,7 +346,7 @@ public function learn(string $text = null, string $category = null)
346346
* @param string Either b8::SPAM or b8::HAM
347347
* @return mixed void or an error code
348348
*/
349-
public function unlearn(string $text = null, string $category = null)
349+
public function unlearn(?string $text = null, ?string $category = null)
350350
{
351351
// Let's first see if the user called the function correctly
352352
if ($text === null) {

core/b8/b8/lexer/standard.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ private function is_valid(string $token)
165165
* @param string $word_to_remove Word to remove from the processed string
166166
* @return void
167167
*/
168-
private function add_token(string $token, string $word_to_remove = null)
168+
private function add_token(string $token, ?string $word_to_remove = null)
169169
{
170170
// Check the validity of the token
171171
if (! $this->is_valid($token)) {

0 commit comments

Comments
 (0)