Skip to content

Dev 123965 general improvements fixes#97

Open
tomerparizer wants to merge 5 commits into
DEV-123965_general-improvementsfrom
DEV-123965_general-improvements_fixes
Open

Dev 123965 general improvements fixes#97
tomerparizer wants to merge 5 commits into
DEV-123965_general-improvementsfrom
DEV-123965_general-improvements_fixes

Conversation

@tomerparizer

@tomerparizer tomerparizer commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summery

Follow-up cleanup on top DEV-123965_general-improvements of that gets the codebase to a green composer check (lint + static analysis) and a fully passing test suite. This is a code-quality / standards pass — no changes to runtime behavior or the public API.

what changed?

  1. ran composer analyse to run code analysis and fixed findings
  2. ran composer lint and composer fix to run lint and fixed findings
  3. added comments to ignore any issues that wasnt quick fix

Note

these changes are just those fixes.. no code shuold have change

Relates to #98

@tomerparizer tomerparizer requested a review from a team as a code owner June 16, 2026 15:07
…Riskified/php_sdk into DEV-123965_general-improvements_fixes

# Conflicts:
#	src/Riskified/DecisionNotification/Model/Notification.php
#	src/Riskified/polyfill.php
Comment on lines +20 to +21
class BaseException extends \Exception {
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we configure the opposite/keep as it was for these empty classes?

Comment on lines +195 to +199
// @phpstan-ignore deadCode.unreachable
break;
case 'array':
return $this->validate_array($key, $types, $value);
// @phpstan-ignore deadCode.unreachable

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is dead/unreachable code, why not remove it?

$exceptions = array();
foreach ($this->_fields as $propertyName => $constraints) {
$types = explode(' ', $constraints);
// phpcs:ignore Generic.PHP.ForbiddenFunctions.Found -- is_null() is intentional here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're setting is_null as forbidden, then we need to change the code or remove it as forbidden.

Replacing is_null with x === null, is more performant, but not enough to be relevant, so I'd say remove it as forbidden.

foreach($array as $key => $value) {
if (is_null($value))
foreach ($array as $key => $value) {
// phpcs:ignore Generic.PHP.ForbiddenFunctions.Found -- is_null() is intentional here

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/**
* Update a merchant's settings
* @param hash object named 'settings' with a key-value structure
* @param $settings object named 'settings' with a key-value structure

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the change?

Comment on lines +286 to 287
// @phpstan-ignore deadCode.unreachable
return null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

}

$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated -- kept for PHP < 8.0 where curl_close() is still required

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, can we have it be ignore in the configuration? That way, if we change config, we get the warning

}

$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
// phpcs:ignore Generic.PHP.DeprecatedFunctions.Deprecated -- kept for PHP < 8.0 where curl_close() is still required

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, can we have it be ignore in the configuration? That way, if we change config, we get the warning

Comment on lines -20 to -21
$this->assertStringContainsString('"settings"', $json);
$this->assertStringContainsString('"notify_url":"https://example.com/hook"', $json);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this test changed?

Not that it is a major change, just that we're now doing a decode unnecessarily.

// Register Riskified autoloader into the SPL autoloading stack (in order to support multiple autoloaders)
spl_autoload_register('riskifiedAutoload',null,true);
// @phpstan-ignore argument.type
spl_autoload_register('riskifiedAutoload', null, true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The second param of this is a boolean. It's just ignored on PHP >=8.0.0 ref

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants