Skip to content
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"require": {
"php": "^8.2 || ^8.3 || ^8.4 || ^8.5",
"phunkie/phunkie": "^1.3",
"phunkie/phunkie": "^1.4",
"phunkie/effect": "^1.1",
"nikic/php-parser": "^5.6"
},
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions features/repl/basic_php_expressions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ Feature: Evaluating Basic PHP Expressions
Scenario: Boolean AND operation
Given I start the REPL
When I enter "true && false"
Then I should see output containing "$var0: Bool = false"
Then I should see output containing "$var0: Boolean = false"

Scenario: Boolean NOT operation
Given I start the REPL
When I enter "!true"
Then I should see output containing "$var0: Bool = false"
Then I should see output containing "$var0: Boolean = false"

Scenario: Simple variable assignment
Given I start the REPL
Expand Down Expand Up @@ -68,17 +68,17 @@ Feature: Evaluating Basic PHP Expressions
Scenario: Boolean OR operation
Given I start the REPL
When I enter "true || false"
Then I should see output containing "$var0: Bool = true"
Then I should see output containing "$var0: Boolean = true"

Scenario: Comparison greater than
Given I start the REPL
When I enter "5 > 3"
Then I should see output containing "$var0: Bool = true"
Then I should see output containing "$var0: Boolean = true"

Scenario: Comparison equal
Given I start the REPL
When I enter "5 == 5"
Then I should see output containing "$var0: Bool = true"
Then I should see output containing "$var0: Boolean = true"

Scenario: Unary minus
Given I start the REPL
Expand Down
4 changes: 2 additions & 2 deletions features/repl/casts.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ Feature: Type casts
Scenario: Casting zero to bool
Given I start the REPL
When I enter "(bool) 0"
Then I should see output containing "Bool = false"
Then I should see output containing "Boolean = false"

Scenario: Casting a non-empty string to bool
Given I start the REPL
When I enter "(bool) \"phunkie\""
Then I should see output containing "Bool = true"
Then I should see output containing "Boolean = true"

Scenario: Casting a scalar to array
Given I start the REPL
Expand Down
2 changes: 1 addition & 1 deletion features/repl/clone_expressions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: Clone expressions
Then I should see "$var0: Int = 42"
When I type "$original === $copy"
And I press enter
Then I should see "$var1: Bool = false"
Then I should see "$var1: Boolean = false"

Scenario: Clone with __clone magic method
Given I am running the repl
Expand Down
2 changes: 1 addition & 1 deletion features/repl/error_suppression.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Feature: Error Suppression Operator (@)
Scenario: Suppress warning from file operation
Given I start the REPL
When I enter "@file_get_contents('/nonexistent/file.txt')"
Then I should see output containing "Bool = false"
Then I should see output containing "Boolean = false"

Scenario: Error suppression in variable assignment
Given I start the REPL
Expand Down
2 changes: 1 addition & 1 deletion features/repl/first_class_callable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ Feature: First-Class Callable Syntax
When I enter "$f1 = strlen(...)"
And I enter "$f2 = strlen(...)"
And I enter "$f1 === $f2"
Then I should see output containing "Bool = false"
Then I should see output containing "Boolean = false"
4 changes: 2 additions & 2 deletions features/repl/import_command.feature
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,14 @@ Feature: Import Command
When I enter ":import option/isDefined"
Then I should see output containing "imported function \Phunkie\Functions\option\isDefined()"
When I enter "isDefined(Some(42))"
Then I should see output containing "Bool = true"
Then I should see output containing "Boolean = true"

Scenario: Import from option module - isNone
Given I start the REPL
When I enter ":import option/isNone"
Then I should see output containing "imported function \Phunkie\Functions\option\isNone()"
When I enter "isNone(None())"
Then I should see output containing "Bool = true"
Then I should see output containing "Boolean = true"

Scenario: Error when importing non-existent module
Given I start the REPL
Expand Down
22 changes: 11 additions & 11 deletions features/repl/instanceof_checks.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,77 +8,77 @@ Feature: Instanceof Operator Support
When I enter "class Dog {}"
And I enter "$dog = new Dog()"
And I enter "$dog instanceof Dog"
Then I should see output containing "$var0: Bool = true"
Then I should see output containing "$var0: Boolean = true"

Scenario: instanceof with false result for different class
Given I start the REPL
When I enter "class Dog {}"
And I enter "class Cat {}"
And I enter "$dog = new Dog()"
And I enter "$dog instanceof Cat"
Then I should see output containing "$var0: Bool = false"
Then I should see output containing "$var0: Boolean = false"

Scenario: instanceof with interface
Given I start the REPL
When I enter "interface Flyable {}"
And I enter "class Bird implements Flyable {}"
And I enter "$bird = new Bird()"
And I enter "$bird instanceof Flyable"
Then I should see output containing "$var0: Bool = true"
Then I should see output containing "$var0: Boolean = true"

Scenario: instanceof with parent class
Given I start the REPL
When I enter "class Animal {}"
And I enter "class Dog extends Animal {}"
And I enter "$dog = new Dog()"
And I enter "$dog instanceof Animal"
Then I should see output containing "$var0: Bool = true"
Then I should see output containing "$var0: Boolean = true"

Scenario: instanceof with variable class name
Given I start the REPL
When I enter "class Dog {}"
And I enter "$dog = new Dog()"
And I enter "$className = 'Dog'"
And I enter "$dog instanceof $className"
Then I should see output containing "$var0: Bool = true"
Then I should see output containing "$var0: Boolean = true"

Scenario: instanceof with null value returns false
Given I start the REPL
When I enter "class Dog {}"
And I enter "$dog = null"
And I enter "$dog instanceof Dog"
Then I should see output containing "$var0: Bool = false"
Then I should see output containing "$var0: Boolean = false"

Scenario: instanceof with standard PHP class
Given I start the REPL
When I enter "$date = new DateTime()"
And I enter "$date instanceof DateTime"
Then I should see output containing "$var0: Bool = true"
Then I should see output containing "$var0: Boolean = true"

Scenario: instanceof with Phunkie Some monad
Given I start the REPL
When I enter "$x = Some(42)"
And I enter "$x instanceof Phunkie\Types\Some"
Then I should see output containing "$var0: Bool = true"
Then I should see output containing "$var0: Boolean = true"

Scenario: instanceof checks are chainable in expressions
Given I start the REPL
When I enter "class Dog {}"
And I enter "class Cat {}"
And I enter "$dog = new Dog()"
And I enter "$dog instanceof Dog && !($dog instanceof Cat)"
Then I should see output containing "$var0: Bool = true"
Then I should see output containing "$var0: Boolean = true"

Scenario: instanceof with scalar value returns false
Given I start the REPL
When I enter "class Dog {}"
And I enter "$value = 42"
And I enter "$value instanceof Dog"
Then I should see output containing "$var0: Bool = false"
Then I should see output containing "$var0: Boolean = false"

Scenario: instanceof with anonymous class
Given I start the REPL
When I enter "interface Runnable { public function run(); }"
And I enter "$obj = new class implements Runnable { public function run() { return 'running'; } }"
And I enter "$obj instanceof Runnable"
Then I should see output containing "$var0: Bool = true"
Then I should see output containing "$var0: Boolean = true"
8 changes: 4 additions & 4 deletions features/repl/php8.2/false_type.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: False Type (PHP 8.2)
}
"""
And I enter "alwaysFalse()"
Then I should see output containing "Bool = false"
Then I should see output containing "Boolean = false"

# Note: Literal true/false/null types in parameters have a known limitation in REPL
# due to how arguments are evaluated before function calls.
Expand All @@ -41,13 +41,13 @@ Feature: False Type (PHP 8.2)
"""
And I enter "$checker = new Checker()"
And I enter "$checker->check()"
Then I should see output containing "Bool = false"
Then I should see output containing "Boolean = false"

Scenario: Arrow function with false return type
Given I start the REPL
When I enter "$failure = fn(): false => false"
And I enter "$failure()"
Then I should see output containing "Bool = false"
Then I should see output containing "Boolean = false"

Scenario: False type in union with other types
Given I start the REPL
Expand All @@ -58,4 +58,4 @@ Feature: False Type (PHP 8.2)
}
"""
And I enter "tryOperation()"
Then I should see output containing "Bool = false"
Then I should see output containing "Boolean = false"
8 changes: 4 additions & 4 deletions features/repl/php8.2/true_type.feature
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: True Type (PHP 8.2)
}
"""
And I enter "alwaysTrue()"
Then I should see output containing "Bool = true"
Then I should see output containing "Boolean = true"

# Note: Literal true/false/null types in parameters have a known limitation in REPL
# due to how arguments are evaluated before function calls.
Expand All @@ -41,13 +41,13 @@ Feature: True Type (PHP 8.2)
"""
And I enter "$validator = new Validator()"
And I enter "$validator->validate()"
Then I should see output containing "Bool = true"
Then I should see output containing "Boolean = true"

Scenario: Arrow function with true return type
Given I start the REPL
When I enter "$success = fn(): true => true"
And I enter "$success()"
Then I should see output containing "Bool = true"
Then I should see output containing "Boolean = true"

Scenario: True type in union with other types
Given I start the REPL
Expand All @@ -58,4 +58,4 @@ Feature: True Type (PHP 8.2)
}
"""
And I enter "checkStatus()"
Then I should see output containing "Bool = true"
Then I should see output containing "Boolean = true"
12 changes: 6 additions & 6 deletions features/repl/php8.3/builtin_functions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ Feature: PHP 8.3 Built-in Functions
Scenario: json_validate() with valid JSON
Given I start the REPL
When I enter "json_validate('{\"name\": \"test\", \"value\": 123}')"
Then I should see output containing "Bool = true"
Then I should see output containing "Boolean = true"

Scenario: json_validate() with invalid JSON
Given I start the REPL
When I enter "json_validate('{invalid json}')"
Then I should see output containing "Bool = false"
Then I should see output containing "Boolean = false"

Scenario: json_validate() with empty string
Given I start the REPL
When I enter "json_validate('')"
Then I should see output containing "Bool = false"
Then I should see output containing "Boolean = false"

Scenario: json_validate() with valid array JSON
Given I start the REPL
When I enter "json_validate('[1, 2, 3, 4]')"
Then I should see output containing "Bool = true"
Then I should see output containing "Boolean = true"

Scenario: mb_str_pad() basic padding
Given I start the REPL
Expand Down Expand Up @@ -49,11 +49,11 @@ Feature: PHP 8.3 Built-in Functions
When I enter "$r = new \Random\Randomizer()"
And I enter "$f = $r->getFloat(0, 1)"
And I enter "$f >= 0 && $f < 1"
Then I should see output containing "Bool = true"
Then I should see output containing "Boolean = true"

Scenario: Randomizer::nextFloat()
Given I start the REPL
When I enter "$r = new \Random\Randomizer()"
And I enter "$f = $r->nextFloat()"
And I enter "$f >= 0 && $f < 1"
Then I should see output containing "Bool = true"
Then I should see output containing "Boolean = true"
2 changes: 1 addition & 1 deletion features/repl/php8.3/readonly_amendments.feature
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Feature: Readonly Amendments (PHP 8.3)
When I enter "$c2->timeout"
Then I should see output containing "Int = 60"
When I enter "$c2->debug"
Then I should see output containing "Bool = false"
Then I should see output containing "Boolean = false"

Scenario: Clone with conditional readonly modification
Given I start the REPL
Expand Down
2 changes: 1 addition & 1 deletion features/repl/php8.3/typed_class_constants.feature
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Feature: Typed Class Constants (PHP 8.3)
When I enter "Database::PORT"
Then I should see output containing "Int = 3306"
When I enter "Database::SSL"
Then I should see output containing "Bool = true"
Then I should see output containing "Boolean = true"

Scenario: Private typed constant
Given I start the REPL
Expand Down
Loading
Loading