Skip to content
Closed
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 .github/workflows/auto-regenerate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: "shivammathur/setup-php@v2"
with:
coverage: "pcov"
php-version: "7.4"
php-version: "8.0"

- name: "Check out salathe/phpdoc-base"
uses: "actions/checkout@v2"
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ jobs:
strategy:
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"

dependencies:
- "highest"
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/rector-continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,14 @@ on:
jobs:

rector-continuous-integration:
name: "Check if refactoring can be done with rector/rector:~0.7.0"
name: "Check if refactoring can be done with rector/rector"

runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"

dependencies:
- "highest"
Expand All @@ -34,13 +32,13 @@ jobs:

- name: "Composer install"
run: "composer install && composer rector && composer test"
working-directory: "generator/tests/rector/0.7"
working-directory: "generator/tests/rector"

- name: "Run rector"
run: "composer rector"
working-directory: "generator/tests/rector/0.7"
working-directory: "generator/tests/rector"

- name: "Run tests"
run: "composer test"
working-directory: "generator/tests/rector/0.7"
working-directory: "generator/tests/rector"

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
/generator/doc/entities/generated.ent
/composer.lock
vendor/
/generator/tests/rector/0.7/composer.lock
/generator/tests/rector/composer.lock
.phpunit.result.cache
68 changes: 0 additions & 68 deletions .travis.yml.old

This file was deleted.

15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@
Safe PHP
========

# This project is deprecated



Because of how this project needs to be in sync with the official PHP documentation, maintaining a set of functions for PHP 7 is simply too difficult, which means we have to drop support for versions below PHP 8.

On the other hand, because this project is used in other libraries, I cannot actually change the PHP dependency in composer.json to ^8.0 without risking some huge versions conflicts.

So the only solution I see is to create a new project: [Safe8](https://github.com/thecodingmachine/safe8/).

The old safe library will stay on Packagist, but it won't be updated anymore.


**Work in progress**

A set of core PHP functions rewritten to throw exceptions instead of returning `false` when an error is encountered.
Expand Down Expand Up @@ -136,7 +123,7 @@ to install `rector/rector`.
Run

```bash
vendor/bin/rector process src/ --config vendor/thecodingmachine/safe/rector-migrate-0.7.php
vendor/bin/rector process src/ --config vendor/thecodingmachine/safe/rector-migrate.php
```

to run `rector/rector`.
Expand Down
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"generated/curl.php",
"generated/datetime.php",
"generated/dir.php",
"generated/dom.php",
"generated/eio.php",
"generated/errorfunc.php",
"generated/exec.php",
Expand All @@ -36,6 +37,7 @@
"generated/fpm.php",
"generated/ftp.php",
"generated/funchand.php",
"generated/gettext.php",
"generated/gmp.php",
"generated/gnupg.php",
"generated/hash.php",
Expand All @@ -45,7 +47,6 @@
"generated/image.php",
"generated/imap.php",
"generated/info.php",
"generated/ingres-ii.php",
"generated/inotify.php",
"generated/json.php",
"generated/ldap.php",
Expand All @@ -56,8 +57,6 @@
"generated/misc.php",
"generated/mysql.php",
"generated/mysqli.php",
"generated/mysqlndMs.php",
"generated/mysqlndQc.php",
"generated/network.php",
"generated/oci8.php",
"generated/opcache.php",
Expand All @@ -76,8 +75,8 @@
"generated/sem.php",
"generated/session.php",
"generated/shmop.php",
"generated/simplexml.php",
"generated/sockets.php",
"generated/sodium.php",
"generated/solr.php",
"generated/spl.php",
"generated/sqlsrv.php",
Expand All @@ -100,7 +99,7 @@
]
},
"require": {
"php": ">=7.2"
"php": "^8.0"
},
"require-dev": {
"phpstan/phpstan": "^0.12",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Safe\Exceptions;

class IngresiiException extends \ErrorException implements SafeExceptionInterface
class DomException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Safe\Exceptions;

class MysqlndMsException extends \ErrorException implements SafeExceptionInterface
class GettextException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Safe\Exceptions;

class MysqlndQcException extends \ErrorException implements SafeExceptionInterface
class SodiumException extends \ErrorException implements SafeExceptionInterface
{
public static function createFromPhpError(): self
{
Expand Down
22 changes: 0 additions & 22 deletions generated/apache.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,28 +110,6 @@ function apache_request_headers(): array
}


/**
* apache_reset_timeout resets the Apache write timer,
* which defaults to 300 seconds. With set_time_limit(0);
* ignore_user_abort(true) and periodic
* apache_reset_timeout calls, Apache can theoretically
* run forever.
*
* This function requires Apache 1.
*
* @throws ApacheException
*
*/
function apache_reset_timeout(): void
{
error_clear_last();
$result = \apache_reset_timeout();
if ($result === false) {
throw ApacheException::createFromPhpError();
}
}


/**
* Fetch all HTTP response headers. Works in the
* Apache, FastCGI, CLI, and FPM webservers.
Expand Down
21 changes: 10 additions & 11 deletions generated/array.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,17 @@ function array_replace(array $array, array ...$replacements): array
* reference. Then,
* any changes made to those elements will be made in the
* original array itself.
* @param mixed $userdata If the optional userdata parameter is supplied,
* @param mixed $arg If the optional arg parameter is supplied,
* it will be passed as the third parameter to the
* callback.
* @throws ArrayException
*
*/
function array_walk_recursive(array &$array, callable $callback, $userdata = null): void
function array_walk_recursive(array &$array, callable $callback, $arg = null): void
{
error_clear_last();
if ($userdata !== null) {
$result = \array_walk_recursive($array, $callback, $userdata);
if ($arg !== null) {
$result = \array_walk_recursive($array, $callback, $arg);
} else {
$result = \array_walk_recursive($array, $callback);
}
Expand All @@ -170,7 +170,7 @@ function array_walk_recursive(array &$array, callable $callback, $userdata = nul


/**
* This function sorts an array such that array indices maintain their
* This function sorts an array in descending order such that array indices maintain their
* correlation with the array elements they are associated with.
*
* This is used mainly when sorting associative arrays where the actual
Expand Down Expand Up @@ -228,7 +228,7 @@ function arsort(array &$array, int $flags = SORT_REGULAR): void


/**
* This function sorts an array such that array indices maintain
* This function sorts an array in ascending order such that array indices maintain
* their correlation with the array elements they are associated
* with. This is used mainly when sorting associative arrays where
* the actual element order is significant.
Expand Down Expand Up @@ -285,7 +285,7 @@ function asort(array &$array, int $flags = SORT_REGULAR): void


/**
* Sorts an array by key in reverse order, maintaining key to data
* Sorts an array by key in descending order, maintaining key to data
* correlations. This is useful mainly for associative arrays.
*
* @param array $array The input array.
Expand Down Expand Up @@ -340,7 +340,7 @@ function krsort(array &$array, int $flags = SORT_REGULAR): void


/**
* Sorts an array by key, maintaining key to data correlations. This is
* Sorts an array by key in ascending order, maintaining key to data correlations. This is
* useful mainly for associative arrays.
*
* @param array $array The input array.
Expand Down Expand Up @@ -438,7 +438,7 @@ function natsort(array &$array): void


/**
* This function sorts an array in reverse order (highest to lowest).
* This function sorts an array by value in descending order.
*
* @param array $array The input array.
* @param int $flags The optional second parameter flags
Expand Down Expand Up @@ -511,8 +511,7 @@ function shuffle(array &$array): void


/**
* This function sorts an array. Elements will be arranged from
* lowest to highest when this function has completed.
* This function sorts an array by value in ascending order.
*
* @param array $array The input array.
* @param int $flags The optional second parameter flags
Expand Down
8 changes: 4 additions & 4 deletions generated/classobj.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@

/**
* Creates an alias named alias
* based on the user defined class original.
* based on the user defined class class.
* The aliased class is exactly the same as the original class.
*
* @param string $original The original class.
* @param string $class The original class.
* @param string $alias The alias name for the class.
* @param bool $autoload Whether to autoload if the original class is not found.
* @throws ClassobjException
*
*/
function class_alias(string $original, string $alias, bool $autoload = true): void
function class_alias(string $class, string $alias, bool $autoload = true): void
{
error_clear_last();
$result = \class_alias($original, $alias, $autoload);
$result = \class_alias($class, $alias, $autoload);
if ($result === false) {
throw ClassobjException::createFromPhpError();
}
Expand Down
Loading