Skip to content

Commit

Permalink
fix: several typos in concepts (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
vnkmpf authored Aug 26, 2023
1 parent 60336f6 commit 2deb482
Show file tree
Hide file tree
Showing 25 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion concepts/basic-syntax/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Variable names must start with a dollar `$` sign.

```php
<?php
$count = 1 // Asssigned an integer value of 1
$count = 1 // Assigned an integer value of 1
$count = 2 // Re-assigned a new value to the variable

$count = false // You may assign any value type
Expand Down
2 changes: 1 addition & 1 deletion concepts/basic-syntax/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Variable names must start with a dollar `$` sign.

```php
<?php
$count = 1 // Asssigned an integer value of 1
$count = 1 // Assigned an integer value of 1
$count = 2 // Re-assigned a new value to the variable

$count = false // You may assign any value type
Expand Down
2 changes: 1 addition & 1 deletion concepts/class-basics/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Car
}

$a_car = new Car("red");
$a_car->color; // => "red" by accesing the property
$a_car->color; // => "red" by accessing the property
$a_car->getColor(); // => "red" by invoking the instance method
```

2 changes: 1 addition & 1 deletion concepts/class-basics/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class Car
}

$a_car = new Car("red");
$a_car->color; // => "red" by accesing the property
$a_car->color; // => "red" by accessing the property
$a_car->getColor(); // => "red" by invoking the instance method
```

Expand Down
2 changes: 1 addition & 1 deletion concepts/class-visibility/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

When using classes to organize code, the visibility of properties, methods, and constants can encourage proper abstractions and responsibilities.
The visibility of properties, methods, and constants is defined by the usage of the `public`, `private`, or `protected` keywords at the time they are declared.
Visibility is always in refernce to an external usage of the class property, method, or constant.
Visibility is always in reference to an external usage of the class property, method, or constant.
That is, if a property is declared `public`, it is observable and usable to external calls.
Private properties, methods, and constants are not observable or usable to external calls.

Expand Down
2 changes: 1 addition & 1 deletion concepts/class-visibility/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

When using classes to organize code, the visibility of properties, methods, and constants can encourage proper abstractions and responsibilities.
The visibility of properties, methods, and constants is defined by the usage of the `public`, `private`, or `protected` keywords at the time they are declared.
Visibility is always in refernce to an external usage of the class property, method, or constant.
Visibility is always in reference to an external usage of the class property, method, or constant.
That is, if a property is declared `public`, it is observable and usable to external calls.
Private properties, methods, and constants are not observable or usable to external calls.

Expand Down
4 changes: 2 additions & 2 deletions concepts/covariance-and-contravariance/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class StringCalc extends Foo
}
```

We could substitue `StringCalc` in place of an original `Calculator` and everything would still work. The caller would still be able to send in the `float` or `int` it originally could, and the return type would still be the expected `int` or `float`.
We could substitute `StringCalc` in place of an original `Calculator` and everything would still work. The caller would still be able to send in the `float` or `int` it originally could, and the return type would still be the expected `int` or `float`.

Similarly, you can narrow the return type, meaning make it more specific by removing types from the union. This example takes advantage of this rule:

Expand Down Expand Up @@ -63,4 +63,4 @@ class InvalidCalc extends Calculator
}
```

The `InvalidCalc` class will not compile and has two probems. By reducing what is allowed as a parameter, `InvalidCalc` could not stand in for the original `Calculator` because it no longer accepts `float`. Additionally, it now could return a `string` which is also not within the allowed return types of the original class.
The `InvalidCalc` class will not compile and has two problems. By reducing what is allowed as a parameter, `InvalidCalc` could not stand in for the original `Calculator` because it no longer accepts `float`. Additionally, it now could return a `string` which is also not within the allowed return types of the original class.
2 changes: 1 addition & 1 deletion concepts/floating-point-numbers/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $d = 1_234.567; // as of PHP 7.4.0

## Common pitfalls

Not all numbers and artithmetic operations can be performed with floating point numbers.
Not all numbers and arithmetic operations can be performed with floating point numbers.
Using floating point numbers to represent dollars and cents can often lead to rounding errors.

```php
Expand Down
2 changes: 1 addition & 1 deletion concepts/floating-point-numbers/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ $d = 1_234.567; // as of PHP 7.4.0

## Common pitfalls

Not all numbers and artithmetic operations can be performed with floating point numbers.
Not all numbers and arithmetic operations can be performed with floating point numbers.
Using floating point numbers to represent dollars and cents can lead to rounding errors.

```php
Expand Down
2 changes: 1 addition & 1 deletion concepts/null-values/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ null === false; // => false

## Working with null values

In PHP, null values can be a common cause of error as they are often returned in place of an error state or to reprepresent nothing.
In PHP, null values can be a common cause of error as they are often returned in place of an error state or to represent nothing.
Preventing errors from arising often requires "null-checking" to assert the value is not null before operating on it.

```php
Expand Down
2 changes: 1 addition & 1 deletion concepts/null-values/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ null === false; // => false

## Working with null values

In PHP, null values can be a common cause of error as they are often returned in place of an error state or to reprepresent nothing.
In PHP, null values can be a common cause of error as they are often returned in place of an error state or to represent nothing.
Preventing errors from arising often requires "null-checking" to assert the value is not null before operating on it.

Repeatedly null-checking can be error prone, so PHP provides two operators for working with null values -- the null-safe access `?->` operator and the null coalescing `??` operator.
2 changes: 1 addition & 1 deletion concepts/strings/about.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $expanded = "The answer to life, the universe, and everything is $answer";
## Character Encoding Support

Historically, string functions in PHP only supported ASCII characters and did not support modern Unicode encodings.
ASCII characters are each 1 byte, wheras Unicode characters may be 1-4 bytes in length.
ASCII characters are each 1 byte, whereas Unicode characters may be 1-4 bytes in length.
If needing to manipulate Unicode strings safely, refer to the [multibyte versions][multi-byte-fns] of the historic functions.

```php
Expand Down
2 changes: 1 addition & 1 deletion concepts/strings/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ $expanded = "The answer to life, the universe, and everything is $answer";
## Character Encoding Support

Historically, string functions in PHP only supported ASCII characters and did not support modern Unicode encodings.
ASCII characters are each 1 byte, wheras Unicode characters may be 1-4 bytes in length.
ASCII characters are each 1 byte, whereas Unicode characters may be 1-4 bytes in length.
If needing to manipulate Unicode strings safely, refer to the [multibyte versions][multi-byte-fns] of the historic functions.

```php
Expand Down
2 changes: 1 addition & 1 deletion concepts/type-declaration/introduction.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Type Declaration

Type declarations in PHP provide type assertions at run time for function arugments, return values and class properties.
Type declarations in PHP provide type assertions at run time for function arguments, return values and class properties.
On functions, a `void` return type can be added to indicate that no value is returned from the function.
Declared types also serve as run time assertions that functions are returning a reasonably typed response.

Expand Down
2 changes: 1 addition & 1 deletion concepts/union-types/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ function add(int|float $a, int|float $b): int|float
}
```

PHP will throw a `TypeError` in strict mode if the incoming parameters are not etiher a `float` or an `int`. In non-strict mode, a type error will be thrown if the incoming parameters cannot be coerced into a `float` or an `int`.
PHP will throw a `TypeError` in strict mode if the incoming parameters are not either a `float` or an `int`. In non-strict mode, a type error will be thrown if the incoming parameters cannot be coerced into a `float` or an `int`.

Similarly, if the function does not return one of the declared types, PHP will throw a `TypeError` at runtime.
2 changes: 1 addition & 1 deletion concepts/user-defined-functions/about.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# About

**User-defined** functions are created using the the `function` keyword. It must then be followed by a function name and a list of arguments.
**User-defined** functions are created using the `function` keyword. It must then be followed by a function name and a list of arguments.

```php
function alarm($hour, $minute, $second)
Expand Down
2 changes: 1 addition & 1 deletion concepts/user-defined-functions/introduction.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Introduction

**User-defined** functions are created using the the `function` keyword. It must then be followed by a function name and a list of arguments.
**User-defined** functions are created using the `function` keyword. It must then be followed by a function name and a list of arguments.

```php
function alarm($hour, $minute, $second)
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/city-office/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Type Declaration

Type declarations in PHP provide type assertions at run time for function arugments, return values and class properties.
Type declarations in PHP provide type assertions at run time for function arguments, return values and class properties.
On functions, a `void` return type can be added to indicate that no value is returned from the function.
Declared types also serve as run time assertions that functions are returning a reasonably typed response.

Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/language-list/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ $language_list = language_list("PHP", "Haskell", "Java", "C++", "Rust")

## 3. Define a function to add a language to the list

Define the `add_to_language_list` function that takes 2 arguments, an array of languages, and the new lanugage.
Define the `add_to_language_list` function that takes 2 arguments, an array of languages, and the new language.

```php
<?php
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/language-list/LanguageListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function testGettingFirstDoesNotMutate()
}

/**
* @testdox the count of the lanugages in the language list
* @testdox the count of the languages in the language list
* @task_id 6
*/
public function testLanguageListCount()
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/lasagna/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Variable names must start with a dollar `$` sign.

```php
<?php
$count = 1 // Asssigned an integer value of 1
$count = 1 // Assigned an integer value of 1
$count = 2 // Re-assigned a new value to the variable

$count = false // You may assign any value type
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/pizza-pi/.docs/instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ $pizza_pi->calculateDoughRequirement(4, 8);
## 2. A Splash of Sauce

Lilly is meticulous when applying her sauce, but the size of her pizzas can be inconsistent.
From her experince, she knows that it takes 125mL of sauce per pizza.
From her experience, she knows that it takes 125mL of sauce per pizza.
Lilly needs a function that calculates how many cans of sauce to buy.

`cans of sauce = pizzas * sauce per pizza / sauce can volume`
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/pizza-pi/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $d = 1_234.567; // as of PHP 7.4.0

### Common pitfalls

Not all numbers and artithmetic operations can be performed with floating point numbers.
Not all numbers and arithmetic operations can be performed with floating point numbers.
Using floating point numbers to represent dollars and cents can lead to rounding errors.

```php
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/sweethearts/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ $expanded = "The answer to life, the universe, and everything is $answer";
### Character Encoding Support

Historically, string functions in PHP only supported ASCII characters and did not support modern Unicode encodings.
ASCII characters are each 1 byte, wheras Unicode characters may be 1-4 bytes in length.
ASCII characters are each 1 byte, whereas Unicode characters may be 1-4 bytes in length.
If needing to manipulate Unicode strings safely, refer to the [multibyte versions][multi-byte-fns] of the historic functions.

```php
Expand Down
2 changes: 1 addition & 1 deletion exercises/concept/windowing-system/.docs/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ class Car
}

$a_car = new Car("red");
$a_car->color; // => "red" by accesing the property
$a_car->color; // => "red" by accessing the property
$a_car->getColor(); // => "red" by invoking the instance method
```

0 comments on commit 2deb482

Please sign in to comment.