Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog #611

Merged
merged 4 commits into from
Feb 23, 2024
Merged

Blog #611

merged 4 commits into from
Feb 23, 2024

Conversation

pamparam83
Copy link
Contributor

fixed errors and updated the code a little

Copy link

what-the-diff bot commented Feb 23, 2024

PR Summary

  • Improvements to Installation and Startup Instructions
    The README file, which serves as the guide to setting up the project, has been updated. It now includes a more explicit way of installing needed components via composer install, and how to serve up the project on a local environment using ./yii serve.

  • Adjusted Parameters for Data Fixtures
    The command for adding data fixtures—pre-set data used for testing and setup—has been modified. It now creates fewer entries (10 instead of 20), which potentially makes the testing process quicker and more effective.

@samdark samdark merged commit ad70ef5 into yiisoft:master Feb 23, 2024
10 of 14 checks passed
@samdark
Copy link
Member

samdark commented Feb 23, 2024

Thank you!

$user = $this->signupForm->signup();
} catch (Throwable $t) {
$io->error($t->getMessage() . ' ' . $t->getFile() . ' ' . $t->getLine());

return $t->getCode() ?: ExitCode::UNSPECIFIED_ERROR;
}

if ($user === false) {
Copy link
Contributor

@rossaddison rossaddison Apr 14, 2024

Choose a reason for hiding this comment

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

Psalm Level 1: Testing
ERROR: TypeDoesNotContainType - src/User/Console/CreateCommand.php:78:13 - Type App\User\User for $user is never falsy (see https://psalm.dev/056)
if ($user === false) {

Copy link
Contributor

Choose a reason for hiding this comment

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

Recommended: if (!$user instanceof User) {

@@ -12,14 +12,19 @@
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Throwable;
use Yiisoft\FormModel\FormHydrator;
Copy link
Contributor

Choose a reason for hiding this comment

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

Psalm Level 1 Testing Recommendation: Add the following to support recommendation below:

use App\User\User;

$errors = $this->signupForm->getFormErrors()->getFirstErrors();
array_walk($errors, fn ($error, $attribute) => $io->error("$attribute: $error"));

$errors = $this->signupForm->getValidationResult()?->getErrorMessagesIndexedByAttribute();
Copy link
Contributor

@rossaddison rossaddison Apr 14, 2024

Choose a reason for hiding this comment

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

Psalm Level 1 Testing:
ERROR: TypeDoesNotContainNull - src/User/Console/CreateCommand.php:62:23 - Yiisoft\Validator\Result does not contain null (see https://psalm.dev/090)
$errors = $this->signupForm->getValidationResult()?->getErrorMessagesIndexedByAttribute();

Copy link
Contributor

Choose a reason for hiding this comment

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

Recommended: Remove the question mark in getValidationResult?

rossaddison added a commit to rossaddison/invoice that referenced this pull request Apr 14, 2024
rossaddison added a commit to rossaddison/invoice that referenced this pull request Apr 14, 2024
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.

3 participants