Skip to content

Sync hello-world #909

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

Merged
merged 4 commits into from
Aug 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bin/auto-sync.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ flower-field
food-chain
grade-school
hamming
hello-world
house
isbn-verifier
isogram
Expand Down
11 changes: 6 additions & 5 deletions exercises/practice/hello-world/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# Instructions

The classical introductory exercise. Just say "Hello, World!".
The classical introductory exercise.
Just say "Hello, World!".

["Hello, World!"](https://en.wikipedia.org/wiki/%22Hello,_world!%22_program) is
the traditional first program for beginning programming in a new language
or environment.
["Hello, World!"][hello-world] is the traditional first program for beginning programming in a new language or environment.

The objectives are simple:

- Write a function that returns the string "Hello, World!".
- Modify the provided code so that it produces the string "Hello, World!".
- Run the test suite and make sure that it succeeds.
- Submit your solution and check it at the website.

If everything goes well, you will be ready to fetch your first real exercise.

[hello-world]: https://en.wikipedia.org/wiki/%22Hello,_world!%22_program
2 changes: 1 addition & 1 deletion exercises/practice/hello-world/.meta/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
".meta/example.php"
]
},
"blurb": "The classical introductory exercise. Just say \"Hello, World!\"",
"blurb": "Exercism's classic introductory exercise. Just say \"Hello, World!\".",
"source": "This is an exercise to introduce users to using Exercism",
"source_url": "https://en.wikipedia.org/wiki/%22Hello,_world!%22_program"
}
27 changes: 5 additions & 22 deletions exercises/practice/hello-world/HelloWorldTest.php
Original file line number Diff line number Diff line change
@@ -1,30 +1,9 @@
<?php

/*
* By adding type hints and enabling strict type checking, code can become
* easier to read, self-documenting and reduce the number of potential bugs.
* By default, type declarations are non-strict, which means they will attempt
* to change the original type to match the type specified by the
* type-declaration.
*
* In other words, if you pass a string to a function requiring a float,
* it will attempt to convert the string value to a float.
*
* To enable strict mode, a single declare directive must be placed at the top
* of the file.
* This means that the strictness of typing is configured on a per-file basis.
* This directive not only affects the type declarations of parameters, but also
* a function's return type.
*
* For more info review the Concept on strict type checking in the PHP track
* <link>.
*
* To disable strict typing, comment out the directive below.
*/

declare(strict_types=1);

use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\TestDox;

class HelloWorldTest extends TestCase
{
Expand All @@ -33,6 +12,10 @@ public static function setUpBeforeClass(): void
require_once 'HelloWorld.php';
}

/**
* uuid: af9ffe10-dc13-42d8-a742-e7bdafac449d
*/
#[TestDox('Say Hi!')]
public function testHelloWorld(): void
{
$this->assertEquals('Hello, World!', helloWorld());
Expand Down