-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix default values via reflection for LoggerInterface (PHP 8 only)
Using ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE See #78
- Loading branch information
Showing
4 changed files
with
60 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--TEST-- | ||
Psr\Log\LoggerInterface - Invalid context default value (PHP 7) | ||
--SKIPIF-- | ||
<?php | ||
include 'skip.inc'; | ||
if (PHP_VERSION_ID >= 80000) { | ||
print "skip Due to version incompatibility"; | ||
} | ||
?> | ||
--FILE-- | ||
<?php | ||
$reflectionMethod = new \ReflectionMethod(\Psr\Log\LoggerInterface::class, "emergency"); | ||
$reflectionParameter = $reflectionMethod->getParameters()[1]; | ||
var_dump($reflectionParameter->isOptional()); | ||
var_dump($reflectionParameter->isDefaultValueAvailable()); | ||
var_dump($reflectionParameter->getDefaultValue()); | ||
--EXPECT-- | ||
bool(true) | ||
bool(true) | ||
array(0) { | ||
} | ||
--XFAIL-- | ||
PHP 7 internal functions cannot have default values reported via reflection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--TEST-- | ||
Psr\Log\LoggerInterface - Invalid context default value (PHP 8) | ||
--SKIPIF-- | ||
<?php | ||
include 'skip.inc'; | ||
if (PHP_VERSION_ID < 80000) { | ||
print "skip Due to version incompatibility"; | ||
} | ||
?> | ||
--FILE-- | ||
<?php | ||
$reflectionMethod = new \ReflectionMethod(\Psr\Log\LoggerInterface::class, "emergency"); | ||
$reflectionParameter = $reflectionMethod->getParameters()[1]; | ||
var_dump($reflectionParameter->isOptional()); | ||
var_dump($reflectionParameter->isDefaultValueAvailable()); | ||
var_dump($reflectionParameter->getDefaultValue()); | ||
--EXPECT-- | ||
bool(true) | ||
bool(true) | ||
array(0) { | ||
} |