Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merging from upstream #1

Merged
merged 50 commits into from
Dec 2, 2021
Merged

Conversation

cloudcogsio
Copy link
Owner

No description provided.

jzecca and others added 30 commits June 5, 2021 17:54
Add OpenStreetMap.org provider
Bumps [github-pages](https://github.com/github/pages-gem) from 215 to 221.
- [Release notes](https://github.com/github/pages-gem/releases)
- [Commits](github/pages-gem@v215...v221)

---
updated-dependencies:
- dependency-name: github-pages
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
…hub-pages-221

Bump github-pages from 215 to 221 in /docs
The default setting for `error_reporting` used by the SetupPHP action is `error_reporting=E_ALL & ~E_DEPRECATED & ~E_STRICT` and `display_errors` is set to `Off`.

For the purposes of CI, I'd recommend running with `E_ALL` and `display_errors=On` to ensure **all** PHP notices are shown.
As of PHP 8.1, PHP will start throwing deprecation warnings along the lines of:
```
Deprecated:  Return type of [CLASS]::[METHOD]() should either be compatible with [PHP NATIVE INTERFACE]::[METHOD](): [TYPE], or the #[ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
```

These type of deprecation notices relate to the [Return types for internal methods RFC](https://wiki.php.net/rfc/internal_method_return_types) in PHP 8.1.

Basically, as of PHP 8.1, these methods in classes which implement PHP native interfaces are expected to have a return type declared.
The return type can be the same as used in PHP itself or a more specific type. This complies with the Liskov principle of covariance, which allows the return type of a child overloaded method to be more specific than that of the parent.

The return type for `JsonSerializable::jsonSerialize()` is supposed to be `mixed`, but as that is a PHP 8.0 type, it cannot yet be added.
Ref: https://www.php.net/manual/en/class.jsonserializable.php

With that in mind, I've added the annotation instead.

Note: While attributes are a PHP 8.0 feature only, due to the syntax choice for `#[]`, they will ignored in PHP < 8 and can be safely added.
While, the version constraints work with _minimum_ versions, I'd recommend upping those minimum versions of various CI tools to ensure that PHP 8.1 compatible versions of the tooling will be installed.

Refs:
* https://github.com/php-parallel-lint/PHP-Parallel-Lint/releases
* https://github.com/mockery/mockery/releases
* https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-9.5.md
For now, linting against PHP 8.1 is set to be allowed to fail. This should be turned off once PHP 8.1 has been released in 4/5 weeks time.

Optionally, the `test` workflow could be made dependent on the `lint` workflow, so it won't run unnecessarily.
PHPUnit recently released version 9.5.10 and 8.5.21.

This contains a particular (IMO breaking) change:

> * PHPUnit no longer converts PHP deprecations to exceptions by default (configure `convertDeprecationsToExceptions="true"` to enable this)

Let's unpack this:

Previously (PHPUnit < 9.5.10/8.5.21), if PHPUnit would encounter a PHP native deprecation notice, it would:
1. Show a test which causes a deprecation notice to be thrown as **"errored"**,
2. Show the **first** deprecation notice it encountered and
3. PHPUnit would exit with a **non-0 exit code** (2), which will fail a CI build.

As of PHPUnit 9.5.10/8.5.21, if PHPUnit encounters a PHP native deprecation notice, it will no longer do so. Instead PHPUnit will:
1. Show a test which causes a PHP deprecation notice to be thrown as **"risky"**,
2. Show the **all** deprecation notices it encountered and
3. PHPUnit will exit with a **0 exit code**, which will show a CI build as passing.

This commit reverts PHPUnit to the previous behaviour by adding `convertDeprecationsToExceptions="true"` to the PHPUnit configuration.
It also adds the other related directives for consistency.

Refs:
* https://github.com/sebastianbergmann/phpunit/blob/9.5/ChangeLog-8.5.md
* https://github.com/sebastianbergmann/phpunit/blob/9.5/ChangeLog-9.5.md
Bumps [github-pages](https://github.com/github/pages-gem) from 221 to 222.
- [Release notes](https://github.com/github/pages-gem/releases)
- [Commits](github/pages-gem@v221...v222)

---
updated-dependencies:
- dependency-name: github-pages
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
This fixes an issue with a call to the PHP native `http_build_query()` function, the second parameter of which is the _optional_ `$numeric_prefix` parameter which expects a `string`.

A parameter being optional, however, does not automatically make it nullable.

As of PHP 8.1, passing `null` to a non-nullable PHP native function will generate a deprecation notice.
In this case, this function call yielded a `http_build_query(): Passing null to parameter composer#2 ($numeric_prefix) of type string is deprecated` notice.

Changing the `null` to an empty string fixes this without BC-break.

Fixes nearly all deprecation warnings found when running the tests.

Refs:
* https://www.php.net/manual/en/function.http-build-query.php
* https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg
@cloudcogsio cloudcogsio merged commit 0e6396d into cloudcogsio:master Dec 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.