From 33ce46d4aa15dac7828ed03ac22fa8f159741b20 Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sat, 27 Jan 2024 14:03:43 +0100 Subject: [PATCH 1/6] Remove type declaration from introduction snippet The concept of type declaration is introduced later. Also the declaration is not necessary here for other reasons than type safety. --- concepts/class-basics/introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/concepts/class-basics/introduction.md b/concepts/class-basics/introduction.md index 79bc2f15..e2a00381 100644 --- a/concepts/class-basics/introduction.md +++ b/concepts/class-basics/introduction.md @@ -49,7 +49,7 @@ class Car $this->color = $color; } - function getColor(): string + function getColor() { return $this->color; } From 4398778dc4803289c75dd4dcbe2cfa0934359b0c Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sat, 27 Jan 2024 14:13:00 +0100 Subject: [PATCH 2/6] Fix markdown syntax of concept introduction --- concepts/class-basics/introduction.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/concepts/class-basics/introduction.md b/concepts/class-basics/introduction.md index e2a00381..d5b92347 100644 --- a/concepts/class-basics/introduction.md +++ b/concepts/class-basics/introduction.md @@ -23,7 +23,7 @@ class Door Classes are instantiated with the `new` keyword, this allocates memory for the class instance and calls the classes constructor method. Instantiated classes may be assigned to a variable. -To invoke the methods of a class instance, we can use the `->` access operator +To invoke the methods of a class instance, we can use the `->` access operator. ```php color; // => "red" by accessing the property $a_car->getColor(); // => "red" by invoking the instance method ``` - - From 4aa5afd196768f3c7f9b995b04dd5a654cedb9d1 Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sat, 27 Jan 2024 14:34:07 +0100 Subject: [PATCH 3/6] Specify code block as text in instructions --- exercises/concept/windowing-system/.docs/instructions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exercises/concept/windowing-system/.docs/instructions.md b/exercises/concept/windowing-system/.docs/instructions.md index 6e52a1ec..cbef3de2 100755 --- a/exercises/concept/windowing-system/.docs/instructions.md +++ b/exercises/concept/windowing-system/.docs/instructions.md @@ -4,7 +4,7 @@ In this exercise, you will be simulating a windowing based computer system. You will create some windows that can be moved and resized. The following image is representative of the values you will be working with below. -``` +```text ╔════════════════════════════════════════════════════════════╗ ║ ║ ║ position::$x,_ ║ From 0dd51be76a91d57d2f1bc154568d2971db3a5fcc Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sat, 27 Jan 2024 14:38:05 +0100 Subject: [PATCH 4/6] Add hint on parameter positioning --- exercises/concept/windowing-system/.docs/hints.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/exercises/concept/windowing-system/.docs/hints.md b/exercises/concept/windowing-system/.docs/hints.md index 6cef5b9a..7a1ad211 100644 --- a/exercises/concept/windowing-system/.docs/hints.md +++ b/exercises/concept/windowing-system/.docs/hints.md @@ -3,11 +3,12 @@ ## General - Revisit the [Objects Concept][concept-class-basics] if needed to fresh up on the basics. +- Carefully read the instructions for the parameter positioning of `x`, `y`, `width`, and `height`. These are easily confused. ## 1. Define a ProgramWindow class - Remember to use [class syntax][php-class] for this task. -- Define [properties][php-properties] by adding them to class declaration. +- Define [properties][php-properties] by adding them to the class declaration. ## 2. Define a constructor function for the ProgramWindow class From c48435df5da3c768b79cfea15e37cb85b51bc813 Mon Sep 17 00:00:00 2001 From: Michael Kramer Date: Sat, 27 Jan 2024 14:58:04 +0100 Subject: [PATCH 5/6] Move / reassign Position property test to task 4 --- .../windowing-system/ProgramWindowTest.php | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/exercises/concept/windowing-system/ProgramWindowTest.php b/exercises/concept/windowing-system/ProgramWindowTest.php index 52b634ff..40d3b3f0 100644 --- a/exercises/concept/windowing-system/ProgramWindowTest.php +++ b/exercises/concept/windowing-system/ProgramWindowTest.php @@ -74,17 +74,6 @@ public function testHasConstructorSettingInitialValues() $this->assertEquals(800, $window->width); } - /** - * @testdox assert Position class exists, with constructor, properties - * @task_id 3 - */ - public function testPositionHasConstructorSettingInitialValues() - { - $position = new Position(30, 70); - $this->assertEquals(30, $position->y); - $this->assertEquals(70, $position->x); - } - /** * @testdox assert Position class exists, with constructor, properties * @task_id 3 @@ -109,6 +98,17 @@ public function testProgramWindowResize() $this->assertEquals(2135, $window->width); } + /** + * @testdox assert Position class exists, with constructor, properties + * @task_id 4 + */ + public function testPositionHasConstructorSettingInitialValues() + { + $position = new Position(30, 70); + $this->assertEquals(30, $position->y); + $this->assertEquals(70, $position->x); + } + /** * @testdox assert ProgramWindow::move function exists * @task_id 4 From bb84505030aba7bde96897053238e181f3657d06 Mon Sep 17 00:00:00 2001 From: mk-mxp Date: Sat, 27 Jan 2024 13:59:36 +0000 Subject: [PATCH 6/6] Apply automatic changes --- exercises/concept/windowing-system/.docs/introduction.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exercises/concept/windowing-system/.docs/introduction.md b/exercises/concept/windowing-system/.docs/introduction.md index 23ead1f6..da9f47fd 100644 --- a/exercises/concept/windowing-system/.docs/introduction.md +++ b/exercises/concept/windowing-system/.docs/introduction.md @@ -25,7 +25,7 @@ class Door Classes are instantiated with the `new` keyword, this allocates memory for the class instance and calls the classes constructor method. Instantiated classes may be assigned to a variable. -To invoke the methods of a class instance, we can use the `->` access operator +To invoke the methods of a class instance, we can use the `->` access operator. ```php color = $color; } - function getColor(): string + function getColor() { return $this->color; }