updated-packages

This commit is contained in:
RafficMohammed
2023-01-08 00:13:22 +05:30
parent 3ff7df7487
commit da241bacb6
12659 changed files with 563377 additions and 510538 deletions

View File

@@ -0,0 +1 @@
github: sebastianbergmann

View File

@@ -1,40 +0,0 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale Issue or Pull Request is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 7
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- enhancement
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false
# Label to use when marking as stale
staleLabel: stale
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions.
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.
# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
# Limit to only `issues` or `pulls`
only: issues

View File

@@ -3,3 +3,4 @@
/composer.lock
/composer.phar
/.php_cs.cache
/.phpunit.result.cache

View File

@@ -4,19 +4,22 @@ php:
- 7.1
- 7.2
- 7.3
- master
- 7.4snapshot
sudo: false
env:
matrix:
- DRIVER="phpdbg"
- DRIVER="xdebug"
before_install:
- composer self-update
- composer clear-cache
install:
- travis_retry composer update --no-interaction --no-ansi --no-progress --no-suggest
script:
- ./vendor/bin/phpunit --coverage-clover=coverage.xml
- if [[ "$DRIVER" = 'phpdbg' ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
- if [[ "$DRIVER" != 'phpdbg' ]]; then vendor/bin/phpunit --coverage-clover=coverage.xml; fi
after_success:
- bash <(curl -s https://codecov.io/bash)

View File

@@ -2,6 +2,57 @@
All notable changes in `sebastianbergmann/environment` are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [4.2.4] - 2020-11-30
### Changed
* Changed PHP version constraint in `composer.json` from `^7.1` to `>=7.1`
## [4.2.3] - 2019-11-20
### Changed
* Implemented [#50](https://github.com/sebastianbergmann/environment/pull/50): Windows improvements to console capabilities
### Fixed
* Fixed [#49](https://github.com/sebastianbergmann/environment/issues/49): Detection how OpCache handles docblocks does not work correctly when PHPDBG is used
## [4.2.2] - 2019-05-05
### Fixed
* Fixed [#44](https://github.com/sebastianbergmann/environment/pull/44): `TypeError` in `Console::getNumberOfColumnsInteractive()`
## [4.2.1] - 2019-04-25
### Fixed
* Fixed an issue in `Runtime::getCurrentSettings()`
## [4.2.0] - 2019-04-25
### Added
* Implemented [#36](https://github.com/sebastianbergmann/environment/pull/36): `Runtime::getCurrentSettings()`
## [4.1.0] - 2019-02-01
### Added
* Implemented `Runtime::getNameWithVersionAndCodeCoverageDriver()` method
* Implemented [#34](https://github.com/sebastianbergmann/environment/pull/34): Support for PCOV extension
## [4.0.2] - 2019-01-28
### Fixed
* Fixed [#33](https://github.com/sebastianbergmann/environment/issues/33): `Runtime::discardsComments()` returns true too eagerly
### Removed
* Removed support for Zend Optimizer+ in `Runtime::discardsComments()`
## [4.0.1] - 2018-11-25
### Fixed
@@ -58,6 +109,13 @@ All notable changes in `sebastianbergmann/environment` are documented in this fi
* This component is no longer supported on PHP 5.6
[4.2.4]: https://github.com/sebastianbergmann/phpunit/compare/4.2.3...4.2.4
[4.2.3]: https://github.com/sebastianbergmann/phpunit/compare/4.2.2...4.2.3
[4.2.2]: https://github.com/sebastianbergmann/phpunit/compare/4.2.1...4.2.2
[4.2.1]: https://github.com/sebastianbergmann/phpunit/compare/4.2.0...4.2.1
[4.2.0]: https://github.com/sebastianbergmann/phpunit/compare/4.1.0...4.2.0
[4.1.0]: https://github.com/sebastianbergmann/phpunit/compare/4.0.2...4.1.0
[4.0.2]: https://github.com/sebastianbergmann/phpunit/compare/4.0.1...4.0.2
[4.0.1]: https://github.com/sebastianbergmann/phpunit/compare/66691f8e2dc4641909166b275a9a4f45c0e89092...4.0.1
[4.0.0]: https://github.com/sebastianbergmann/phpunit/compare/3.1.0...66691f8e2dc4641909166b275a9a4f45c0e89092
[3.1.0]: https://github.com/sebastianbergmann/phpunit/compare/3.0...3.1.0

View File

@@ -1,6 +1,6 @@
sebastian/environment
Copyright (c) 2014-2018, Sebastian Bergmann <sebastian@phpunit.de>.
Copyright (c) 2014-2019, Sebastian Bergmann <sebastian@phpunit.de>.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -16,10 +16,13 @@
},
"prefer-stable": true,
"require": {
"php": "^7.1"
"php": ">=7.1"
},
"require-dev": {
"phpunit/phpunit": "^7.4"
"phpunit/phpunit": "^7.5"
},
"suggest": {
"ext-posix": "*"
},
"autoload": {
"classmap": [
@@ -28,7 +31,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
"dev-master": "4.2-dev"
}
}
}

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.4/phpunit.xsd"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/7.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
forceCoversAnnotation="true"
beStrictAboutCoversAnnotation="true"

View File

@@ -40,7 +40,7 @@ final class Console
if ($this->isWindows()) {
// @codeCoverageIgnoreStart
return (\defined('STDOUT') && \function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(\STDOUT))
return (\defined('STDOUT') && \function_exists('sapi_windows_vt100_support') && @\sapi_windows_vt100_support(\STDOUT))
|| false !== \getenv('ANSICON')
|| 'ON' === \getenv('ConEmuANSI')
|| 'xterm' === \getenv('TERM');
@@ -53,13 +53,7 @@ final class Console
// @codeCoverageIgnoreEnd
}
if ($this->isInteractive(\STDOUT)) {
return true;
}
$stat = @\fstat(\STDOUT);
// Check if formatted mode is S_IFCHR
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
return $this->isInteractive(\STDOUT);
}
/**
@@ -69,14 +63,14 @@ final class Console
*/
public function getNumberOfColumns(): int
{
if ($this->isWindows()) {
return $this->getNumberOfColumnsWindows();
}
if (!$this->isInteractive(\defined('STDIN') ? \STDIN : self::STDIN)) {
return 80;
}
if ($this->isWindows()) {
return $this->getNumberOfColumnsWindows();
}
return $this->getNumberOfColumnsInteractive();
}
@@ -90,8 +84,18 @@ final class Console
*/
public function isInteractive($fileDescriptor = self::STDOUT): bool
{
return (\is_resource($fileDescriptor) && \function_exists('stream_isatty') && @\stream_isatty($fileDescriptor)) // stream_isatty requires that descriptor is a real resource, not numeric ID of it
|| (\function_exists('posix_isatty') && @\posix_isatty($fileDescriptor));
if (\is_resource($fileDescriptor)) {
// These functions require a descriptor that is a real resource, not a numeric ID of it
if (\function_exists('stream_isatty') && @\stream_isatty($fileDescriptor)) {
return true;
}
$stat = @\fstat(\STDOUT);
// Check if formatted mode is S_IFCHR
return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
}
return \function_exists('posix_isatty') && @\posix_isatty($fileDescriptor);
}
private function isWindows(): bool
@@ -104,13 +108,13 @@ final class Console
*/
private function getNumberOfColumnsInteractive(): int
{
if (\function_exists('shell_exec') && \preg_match('#\d+ (\d+)#', \shell_exec('stty size') ?? '', $match) === 1) {
if (\function_exists('shell_exec') && \preg_match('#\d+ (\d+)#', \shell_exec('stty size') ?: '', $match) === 1) {
if ((int) $match[1] > 0) {
return (int) $match[1];
}
}
if (\function_exists('shell_exec') && \preg_match('#columns = (\d+);#', \shell_exec('stty') ?? '', $match) === 1) {
if (\function_exists('shell_exec') && \preg_match('#columns = (\d+);#', \shell_exec('stty') ?: '', $match) === 1) {
if ((int) $match[1] > 0) {
return (int) $match[1];
}

View File

@@ -20,26 +20,32 @@ final class Runtime
private static $binary;
/**
* Returns true when Xdebug is supported or
* Returns true when Xdebug or PCOV is available or
* the runtime used is PHPDBG.
*/
public function canCollectCodeCoverage(): bool
{
return $this->hasXdebug() || $this->hasPHPDBGCodeCoverage();
return $this->hasXdebug() || $this->hasPCOV() || $this->hasPHPDBGCodeCoverage();
}
/**
* Returns true when OPcache is loaded and opcache.save_comments=0 is set.
*
* Code taken from Doctrine\Common\Annotations\AnnotationReader::__construct().
* Returns true when Zend OPcache is loaded, enabled, and is configured to discard comments.
*/
public function discardsComments(): bool
{
if (\extension_loaded('Zend Optimizer+') && (\ini_get('zend_optimizerplus.save_comments') === '0' || \ini_get('opcache.save_comments') === '0')) {
if (!\extension_loaded('Zend OPcache')) {
return false;
}
if (\ini_get('opcache.save_comments') !== '0') {
return false;
}
if ((\PHP_SAPI === 'cli' || \PHP_SAPI === 'phpdbg') && \ini_get('opcache.enable_cli') === '1') {
return true;
}
if (\extension_loaded('Zend OPcache') && \ini_get('opcache.save_comments') == 0) {
if (\PHP_SAPI !== 'cli' && \PHP_SAPI !== 'phpdbg' && \ini_get('opcache.enable') === '1') {
return true;
}
@@ -100,6 +106,29 @@ final class Runtime
return $this->getName() . ' ' . $this->getVersion();
}
public function getNameWithVersionAndCodeCoverageDriver(): string
{
if (!$this->canCollectCodeCoverage() || $this->hasPHPDBGCodeCoverage()) {
return $this->getNameWithVersion();
}
if ($this->hasXdebug()) {
return \sprintf(
'%s with Xdebug %s',
$this->getNameWithVersion(),
\phpversion('xdebug')
);
}
if ($this->hasPCOV()) {
return \sprintf(
'%s with PCOV %s',
$this->getNameWithVersion(),
\phpversion('pcov')
);
}
}
public function getName(): string
{
if ($this->isHHVM()) {
@@ -174,11 +203,63 @@ final class Runtime
/**
* Returns true when the runtime used is PHP with the PHPDBG SAPI
* and the phpdbg_*_oplog() functions are available (PHP >= 7.0).
*
* @codeCoverageIgnore
*/
public function hasPHPDBGCodeCoverage(): bool
{
return $this->isPHPDBG();
}
/**
* Returns true when the runtime used is PHP with PCOV loaded and enabled
*/
public function hasPCOV(): bool
{
return $this->isPHP() && \extension_loaded('pcov') && \ini_get('pcov.enabled');
}
/**
* Parses the loaded php.ini file (if any) as well as all
* additional php.ini files from the additional ini dir for
* a list of all configuration settings loaded from files
* at startup. Then checks for each php.ini setting passed
* via the `$values` parameter whether this setting has
* been changed at runtime. Returns an array of strings
* where each string has the format `key=value` denoting
* the name of a changed php.ini setting with its new value.
*
* @return string[]
*/
public function getCurrentSettings(array $values): array
{
$diff = [];
$files = [];
if ($file = \php_ini_loaded_file()) {
$files[] = $file;
}
if ($scanned = \php_ini_scanned_files()) {
$files = \array_merge(
$files,
\array_map(
'trim',
\explode(",\n", $scanned)
)
);
}
foreach ($files as $ini) {
$config = \parse_ini_file($ini, true);
foreach ($values as $value) {
$set = \ini_get($value);
if (isset($config[$value]) && $set != $config[$value]) {
$diff[] = \sprintf('%s=%s', $value, $set);
}
}
}
return $diff;
}
}

View File

@@ -32,7 +32,7 @@ final class ConsoleTest extends TestCase
*/
public function testCanDetectIfStdoutIsInteractiveByDefault(): void
{
$this->assertInternalType('boolean', $this->console->isInteractive());
$this->assertIsBool($this->console->isInteractive());
}
/**
@@ -41,7 +41,7 @@ final class ConsoleTest extends TestCase
*/
public function testCanDetectIfFileDescriptorIsInteractive(): void
{
$this->assertInternalType('boolean', $this->console->isInteractive(\STDOUT));
$this->assertIsBool($this->console->isInteractive(\STDOUT));
}
/**
@@ -50,7 +50,7 @@ final class ConsoleTest extends TestCase
*/
public function testCanDetectColorSupport(): void
{
$this->assertInternalType('boolean', $this->console->hasColorSupport());
$this->assertIsBool($this->console->hasColorSupport());
}
/**
@@ -59,6 +59,6 @@ final class ConsoleTest extends TestCase
*/
public function testCanDetectNumberOfColumns(): void
{
$this->assertInternalType('integer', $this->console->getNumberOfColumns());
$this->assertIsInt($this->console->getNumberOfColumns());
}
}

View File

@@ -33,4 +33,28 @@ final class OperatingSystemTest extends TestCase
{
$this->assertEquals('Linux', $this->os->getFamily());
}
/**
* @requires OS Darwin
*/
public function testFamilyReturnsDarwinWhenRunningOnDarwin(): void
{
$this->assertEquals('Darwin', $this->os->getFamily());
}
/**
* @requires OS Windows
*/
public function testGetFamilyReturnsWindowsWhenRunningOnWindows(): void
{
$this->assertSame('Windows', $this->os->getFamily());
}
/**
* @requires PHP 7.2.0
*/
public function testGetFamilyReturnsPhpOsFamilyWhenRunningOnPhp72AndGreater(): void
{
$this->assertSame(\PHP_OS_FAMILY, $this->os->getFamily());
}
}

View File

@@ -27,83 +27,139 @@ final class RuntimeTest extends TestCase
}
/**
* @todo Now that this component is PHP 7-only and uses return type declarations
* this test makes even less sense than before
* @requires extension xdebug
*/
public function testAbilityToCollectCodeCoverageCanBeAssessed(): void
public function testCanCollectCodeCoverageWhenXdebugExtensionIsEnabled(): void
{
$this->assertInternalType('boolean', $this->env->canCollectCodeCoverage());
$this->assertTrue($this->env->canCollectCodeCoverage());
}
/**
* @todo Now that this component is PHP 7-only and uses return type declarations
* this test makes even less sense than before
* @requires extension pcov
*/
public function testCanCollectCodeCoverageWhenPcovExtensionIsEnabled(): void
{
$this->assertTrue($this->env->canCollectCodeCoverage());
}
public function testCanCollectCodeCoverageWhenRunningOnPhpdbg(): void
{
$this->markTestSkippedWhenNotRunningOnPhpdbg();
$this->assertTrue($this->env->canCollectCodeCoverage());
}
public function testBinaryCanBeRetrieved(): void
{
$this->assertInternalType('string', $this->env->getBinary());
$this->assertNotEmpty($this->env->getBinary());
}
/**
* @todo Now that this component is PHP 7-only and uses return type declarations
* this test makes even less sense than before
* @requires PHP
*/
public function testCanBeDetected(): void
public function testIsHhvmReturnsFalseWhenRunningOnPhp(): void
{
$this->assertInternalType('boolean', $this->env->isHHVM());
$this->assertFalse($this->env->isHHVM());
}
/**
* @todo Now that this component is PHP 7-only and uses return type declarations
* this test makes even less sense than before
* @requires PHP
*/
public function testCanBeDetected2(): void
public function testIsPhpReturnsTrueWhenRunningOnPhp(): void
{
$this->assertInternalType('boolean', $this->env->isPHP());
$this->markTestSkippedWhenRunningOnPhpdbg();
$this->assertTrue($this->env->isPHP());
}
/**
* @todo Now that this component is PHP 7-only and uses return type declarations
* this test makes even less sense than before
* @requires extension pcov
*/
public function testPCOVCanBeDetected(): void
{
$this->assertTrue($this->env->hasPCOV());
}
public function testPhpdbgCanBeDetected(): void
{
$this->markTestSkippedWhenNotRunningOnPhpdbg();
$this->assertTrue($this->env->hasPHPDBGCodeCoverage());
}
/**
* @requires extension xdebug
*/
public function testXdebugCanBeDetected(): void
{
$this->assertInternalType('boolean', $this->env->hasXdebug());
$this->markTestSkippedWhenRunningOnPhpdbg();
$this->assertTrue($this->env->hasXdebug());
}
/**
* @todo Now that this component is PHP 7-only and uses return type declarations
* this test makes even less sense than before
*/
public function testNameAndVersionCanBeRetrieved(): void
{
$this->assertInternalType('string', $this->env->getNameWithVersion());
$this->assertNotEmpty($this->env->getNameWithVersion());
}
public function testGetNameReturnsPhpdbgWhenRunningOnPhpdbg(): void
{
$this->markTestSkippedWhenNotRunningOnPhpdbg();
$this->assertSame('PHPDBG', $this->env->getName());
}
/**
* @todo Now that this component is PHP 7-only and uses return type declarations
* this test makes even less sense than before
* @requires PHP
*/
public function testNameCanBeRetrieved(): void
public function testGetNameReturnsPhpdbgWhenRunningOnPhp(): void
{
$this->assertInternalType('string', $this->env->getName());
$this->markTestSkippedWhenRunningOnPhpdbg();
$this->assertSame('PHP', $this->env->getName());
}
public function testNameAndCodeCoverageDriverCanBeRetrieved(): void
{
$this->assertNotEmpty($this->env->getNameWithVersionAndCodeCoverageDriver());
}
/**
* @todo Now that this component is PHP 7-only and uses return type declarations
* this test makes even less sense than before
* @requires PHP
*/
public function testVersionCanBeRetrieved(): void
public function testGetVersionReturnsPhpVersionWhenRunningPhp(): void
{
$this->assertInternalType('string', $this->env->getVersion());
$this->assertSame(\PHP_VERSION, $this->env->getVersion());
}
/**
* @todo Now that this component is PHP 7-only and uses return type declarations
* this test makes even less sense than before
* @requires PHP
*/
public function testVendorUrlCanBeRetrieved(): void
public function testGetVendorUrlReturnsPhpDotNetWhenRunningPhp(): void
{
$this->assertInternalType('string', $this->env->getVendorUrl());
$this->assertSame('https://secure.php.net/', $this->env->getVendorUrl());
}
private function markTestSkippedWhenNotRunningOnPhpdbg(): void
{
if ($this->isRunningOnPhpdbg()) {
return;
}
$this->markTestSkipped('PHPDBG is required.');
}
private function markTestSkippedWhenRunningOnPhpdbg(): void
{
if (!$this->isRunningOnPhpdbg()) {
return;
}
$this->markTestSkipped('Cannot run on PHPDBG');
}
private function isRunningOnPhpdbg(): bool
{
return \PHP_SAPI === 'phpdbg';
}
}