Skip to content

Commit

Permalink
Merge pull request #14225 from jeabakker/features
Browse files Browse the repository at this point in the history
chore(core): fix scrutinizer issues
  • Loading branch information
jdalsem committed Nov 22, 2022
2 parents 43d3f96 + cfd5895 commit e4e5ca1
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 41 deletions.
2 changes: 1 addition & 1 deletion engine/classes/Elgg/Database/EntityTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ public function updateLastAction(\ElggEntity $entity, int $posted = null): int {
* @throws UserFetchFailureException
*/
public function getUserForPermissionsCheck(int $guid = null): ?\ElggUser {
if (!$guid || $guid === $this->session_manager->getLoggedInUserGuid()) {
if (empty($guid) || $guid === $this->session_manager->getLoggedInUserGuid()) {
return $this->session_manager->getLoggedInUser();
}

Expand Down
1 change: 0 additions & 1 deletion engine/classes/Elgg/Database/Seeds/Groups.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function seed() {
if ($this->create) {
$group = $this->createGroup([
'access_id' => $this->getRandomGroupVisibility(),
], [
'content_access_mode' => $this->getRandomGroupContentAccessMode(),
'membership' => $this->getRandomGroupMembership(),
], [
Expand Down
2 changes: 1 addition & 1 deletion engine/classes/Elgg/Database/Seeds/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function seed() {

while ($this->getCount() < $this->limit) {
if ($this->create) {
$user = $this->createUser([], [], [
$user = $this->createUser([], [
'profile_fields' => $profile_fields,
]);
} else {
Expand Down
1 change: 1 addition & 0 deletions engine/classes/Elgg/Filesystem/Filestore/DiskFilestore.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Elgg\Filesystem\Filestore;

use Elgg\Exceptions\DomainException;
use Elgg\Exceptions\Filesystem\IOException;
use Elgg\Exceptions\InvalidArgumentException;
use Elgg\Filesystem\Filestore;
use Elgg\Project\Paths;
Expand Down
3 changes: 1 addition & 2 deletions engine/classes/Elgg/Traits/Seeding.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ function(QueryBuilder $qb, $main_alias) use ($exclude) {
foreach ($profile_fields_config as $field) {
$profile_fields[$field['name']] = $field['#type'];
}
return $this->createUser([], [
return $this->createUser([
'validated' => true,
], [
'profile_fields' => $profile_fields,
Expand Down Expand Up @@ -581,7 +581,6 @@ function(QueryBuilder $qb, $main_alias) use ($exclude) {

return $this->createGroup([
'access_id' => $this->getRandomGroupVisibility(),
], [
'content_access_mode' => $this->getRandomGroupContentAccessMode(),
'membership' => $this->getRandomGroupMembership(),
], [
Expand Down
4 changes: 2 additions & 2 deletions engine/classes/ElggSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use Elgg\Config;
use Elgg\Database;
use Elgg\Database\SessionHandler;
use Elgg\Database\SessionHandler as ElggSessionHandler;
use Elgg\Traits\Debug\Profilable;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
Expand Down Expand Up @@ -282,7 +282,7 @@ public static function fromDatabase(Config $config, Database $db) {
'cookie_lifetime' => $params['lifetime'],
];

$handler = new SessionHandler($db);
$handler = new ElggSessionHandler($db);
$storage = new NativeSessionStorage($options, $handler);
$session = new Session($storage);
return new self($session);
Expand Down
2 changes: 1 addition & 1 deletion engine/lib/events.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,6 @@ function elgg_trigger_deprecated_event(string $event, string $type, $object = nu
*
* @since 5.0
*/
function elgg_trigger_deprecated_event_results(string $event, string $type, $params = null, $returnvalue = null, string $message = '', string $version = '') {
function elgg_trigger_deprecated_event_results(string $event, string $type, array $params = [], $returnvalue = null, string $message = '', string $version = '') {
return _elgg_services()->events->triggerDeprecatedResults($event, $type, $params, $returnvalue, $message, $version);
}
9 changes: 3 additions & 6 deletions mod/blog/classes/Elgg/Blog/Seeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,15 @@ class Seeder extends Seed {
public function seed() {
$this->advance($this->getCount());

$attributes = [
'subtype' => 'blog',
];

while ($this->getCount() < $this->limit) {
$metadata = [
$properties = [
'subtype' => 'blog',
'status' => $this->getRandomStatus(),
'comments_on' => $this->faker()->boolean() ? 'On' : 'Off',
'excerpt' => $this->faker()->sentence(),
];

$blog = $this->createObject($attributes, $metadata);
$blog = $this->createObject($properties);
if (!$blog) {
continue;
}
Expand Down
9 changes: 3 additions & 6 deletions mod/bookmarks/classes/Elgg/Bookmarks/Seeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@ class Seeder extends Seed {
public function seed() {
$this->advance($this->getCount());

$attributes = [
'subtype' => 'bookmarks',
];

while ($this->getCount() < $this->limit) {
$metadata = [
$properties = [
'subtype' => 'bookmarks',
'address' => $this->faker()->url,
];

$bookmark = $this->createObject($attributes, $metadata);
$bookmark = $this->createObject($properties);
if (!$bookmark) {
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion mod/developers/classes/Elgg/Developers/HandlerLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function trackEvent(\Elgg\Event $event) : void {
return;
}

self::track($event->getName(), $event->getType(), $event);
self::track($event->getName(), $event->getType());
}

/**
Expand Down
11 changes: 4 additions & 7 deletions mod/discussions/classes/Elgg/Discussions/Seeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,14 @@ public function seed() {
$this->advance($this->getCount());

while ($this->getCount() < $this->limit) {
$metadata = [
'status' => $this->getRandomStatus(),
'excerpt' => $this->faker()->sentence(),
];

$attributes = [
$properties = [
'subtype' => 'discussion',
'container_guid' => $this->getRandomGroup()->guid,
'status' => $this->getRandomStatus(),
'excerpt' => $this->faker()->sentence(),
];

$discussion = $this->createObject($attributes, $metadata);
$discussion = $this->createObject($properties);
if (!$discussion) {
continue;
}
Expand Down
9 changes: 3 additions & 6 deletions mod/pages/classes/Elgg/Pages/Seeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@ public function seed() {
$this->advance($this->getCount());

$create_page = function () {
$metadata = [
'write_access_id' => ACCESS_LOGGED_IN,
];

$attributes = [
$properties = [
'subtype' => 'page',
'write_access_id' => ACCESS_LOGGED_IN,
];

$page = $this->createObject($attributes, $metadata);
$page = $this->createObject($properties);
if (!$page) {
return;
}
Expand Down
11 changes: 4 additions & 7 deletions mod/site_notifications/classes/Elgg/SiteNotifications/Seeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,15 @@ class Seeder extends Seed {
public function seed() {
$this->advance($this->getCount());

$attributes = [
'subtype' => 'site_notification',
'access_id' => ACCESS_PRIVATE,
];

while ($this->getCount() < $this->limit) {
$metadata = [
$properties = [
'subtype' => 'site_notification',
'access_id' => ACCESS_PRIVATE,
'read' => $this->faker()->boolean(),
'summary' => $this->faker()->sentence(),
];

$notification = $this->createObject($attributes, $metadata);
$notification = $this->createObject($properties);
if (!$notification instanceof \SiteNotification) {
continue;
}
Expand Down

0 comments on commit e4e5ca1

Please sign in to comment.