Commit Graph
685 Commits
Author SHA1 Message Date
Jaap van Otterdijk 0f36fa483b Merge pull request #303 from jrfnl/feature/phpunit-update-config
PHPUnit: update configuration
2021-09-27 21:30:08 +02:00
jrfnl 670b3b54af PHPUnit: update configuration
PHPUnit just 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.

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
2021-09-25 18:47:01 +02:00
Jaap van Otterdijk adf7a90588 Merge pull request #302 from phpDocumentor/dependabot/composer/phpdocumentor/type-resolver-1.5.0
Bump phpdocumentor/type-resolver from 1.4.0 to 1.5.0
2021-09-23 20:17:06 +02:00
dependabot[bot] 91a16428da Bump phpdocumentor/type-resolver from 1.4.0 to 1.5.0
Bumps [phpdocumentor/type-resolver](https://github.com/phpDocumentor/TypeResolver) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/phpDocumentor/TypeResolver/releases)
- [Commits](https://github.com/phpDocumentor/TypeResolver/compare/1.4.0...1.5.0)

---
updated-dependencies:
- dependency-name: phpdocumentor/type-resolver
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-09-20 10:02:18 +00:00
Jaap van Otterdijk c512fd308b Merge pull request #300 from phpDocumentor/dependabot/composer/psalm/phar-4.10.0
Bump psalm/phar from 4.9.3 to 4.10.0
2021-09-17 15:49:47 +02:00
dependabot[bot] 68c9ee9a00 Bump psalm/phar from 4.9.3 to 4.10.0
Bumps [psalm/phar](https://github.com/psalm/phar) from 4.9.3 to 4.10.0.
- [Release notes](https://github.com/psalm/phar/releases)
- [Commits](https://github.com/psalm/phar/compare/4.9.3...4.10.0)

---
updated-dependencies:
- dependency-name: psalm/phar
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-09-17 13:43:15 +00:00
Jaap van Otterdijk 9ebbb531c1 Merge pull request #301 from phpDocumentor/php81_support
Run test on php 8.1
2021-09-17 15:42:31 +02:00
Jaapio bafd0edab0 Bump mocker to fix php 8.1 tests 2021-09-17 15:35:18 +02:00
Jaapio a01675497f Run test on php 8.1 2021-09-17 15:27:30 +02:00
Jaap van Otterdijk be3b495b92 Merge pull request #290 from jrfnl/ghactions-fail-on-failing-test
GH Actions: fail the build if a test run fails
2021-09-17 15:23:58 +02:00
Jaap van Otterdijk d708b18227 Merge pull request #299 from villfa/test/298
Tests: add a case to cover issue #298
2021-09-17 10:37:36 +02:00
Jaap van Otterdijk e4b1dd3f91 Merge pull request #296 from phpDocumentor/fix/287-line-endings
Improve line-endings for windows.
2021-09-17 08:30:37 +02:00
Fabien Villepinte 98e82e39fa Tests: add a case to cover issue #298 2021-09-05 18:57:50 +00:00
Fabien Villepinte 44e31d19a6 Fix undefined index 2021-09-05 12:40:50 +02:00
Jaapio 6fa60f9f08 Fix code style 2021-08-26 22:32:25 +02:00
Jaapio c5e702d299 Allow serializer to have a configurable line-ending 2021-08-26 22:31:30 +02:00
Jaapio bca4974b0b Make split platform independend 2021-08-26 22:31:30 +02:00
Jaap van Otterdijk c212334d39 Merge pull request #295 from phpDocumentor/dependabot/composer/psalm/phar-4.9.3
Bump psalm/phar from 4.9.2 to 4.9.3
2021-08-26 14:24:56 +02:00
dependabot[bot] 8e8592bda6 Bump psalm/phar from 4.9.2 to 4.9.3
Bumps [psalm/phar](https://github.com/psalm/phar) from 4.9.2 to 4.9.3.
- [Release notes](https://github.com/psalm/phar/releases)
- [Commits](https://github.com/psalm/phar/compare/4.9.2...4.9.3)

---
updated-dependencies:
- dependency-name: psalm/phar
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-08-16 10:01:07 +00:00
Jaap van Otterdijk c5ac781da3 Merge pull request #277 from phpDocumentor/dependabot/github_actions/actions/cache-2.1.6
Bump actions/cache from 2.1.4 to 2.1.6
2021-08-13 11:13:23 +02:00
Jaap van Otterdijk 79d2777813 Merge pull request #294 from phpDocumentor/dependabot/composer/psalm/phar-4.9.2
Bump psalm/phar from 4.8.1 to 4.9.2
2021-08-09 19:52:09 +02:00
dependabot[bot] 1f1f2f0414 Bump psalm/phar from 4.8.1 to 4.9.2
Bumps [psalm/phar](https://github.com/psalm/phar) from 4.8.1 to 4.9.2.
- [Release notes](https://github.com/psalm/phar/releases)
- [Commits](https://github.com/psalm/phar/compare/4.8.1...4.9.2)

---
updated-dependencies:
- dependency-name: psalm/phar
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
2021-08-09 10:00:47 +00:00
jrfnl 63aa02024c GH Actions: fail the build if a test run fails
The way things were set up now in the `phpunit` job, no matter whether tests passed or failed, the workflow would always continue.

I suspect this may have been set-up this way to make sure that all variations of test runs will actually be run ?
The downside is that, while you will see a  for the individual build in the workflow summary, the workflow will not be marked as failed, nor will the individual test builds be marked as failed.

If we look back at the last time the workflow was run completely, this can be seen in the annotations below the summary, which show that the Windows test runs all failed.
https://github.com/phpDocumentor/ReflectionDocBlock/actions/runs/370378454

I'm proposing to change this now by:
* Removing the `continue-on-error` for the test run.
* Adding the `fail-fast` key and setting it to `false`.
    By default this key is set to `true`, which means that if any individual build within the job fails, all other builds within the job will be cancelled.
    By setting it to `false`, all builds in the matrix will still be run, but if any of them fail, the workflow will be marked as "failed".
2021-08-08 22:30:14 +02:00
dependabot[bot] e5d5fb1aa2 Bump actions/cache from 2.1.4 to 2.1.6
Bumps [actions/cache](https://github.com/actions/cache) from 2.1.4 to 2.1.6.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.4...v2.1.6)

Signed-off-by: dependabot[bot] <[email protected]>
2021-08-08 20:16:22 +00:00
Jaap van Otterdijk ece0c41d6d Merge pull request #270 from phpDocumentor/dependabot/composer/webmozart/assert-1.10.0
Bump webmozart/assert from 1.9.1 to 1.10.0
2021-08-08 22:15:47 +02:00
Jaap van Otterdijk 8d73b8d29c Merge pull request #293 from jrfnl/feature/phpcs-fix-ruleset
PHPCS ruleset: remove an outdated exclusion
2021-08-08 22:09:39 +02:00
Jaap van Otterdijk 6698bfb1da Merge pull request #292 from jrfnl/feature/phive-upgrade-phpunit
Phive: upgrade used version of PHPUnit
2021-08-08 22:09:26 +02:00
jrfnl 839c177147 PHPCS ruleset: remove an outdated exclusion
The `SlevomatCodingStandard.Classes.UnusedPrivateElements` sniff has been removed from Slevomat.
2021-08-08 21:59:12 +02:00
jrfnl 6215ff6630 Phive: upgrade used version of PHPUnit 2021-08-08 21:53:50 +02:00
dependabot[bot] a254f61d62 Bump webmozart/assert from 1.9.1 to 1.10.0
Bumps [webmozart/assert](https://github.com/webmozart/assert) from 1.9.1 to 1.10.0.
- [Release notes](https://github.com/webmozart/assert/releases)
- [Changelog](https://github.com/webmozarts/assert/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webmozart/assert/compare/1.9.1...1.10.0)

Signed-off-by: dependabot[bot] <[email protected]>
2021-08-08 19:33:57 +00:00
Jaapio ffff80c1a6 Resolve psalm return type
The original php method preg_split might return `string[][]` in some
situations, however this should never be the case for this library. By
adding an extra assert, we should be more safe.
2021-08-08 21:32:57 +02:00
jrfnl aa1efc030b CS: no whitespace before return type colon 2021-08-08 21:32:57 +02:00
jrfnl c269e1b26e Psalm: remove suppression of return type issue
... and fix it instead.
2021-08-08 21:32:57 +02:00
jrfnl 93198fae49 Psalm: suppress notice about preg_split $flags
As discussed in the PR:
> > Argument 4 of preg_split expects 0|1|2|3|4|5|6|7, parent type int provided (see https://psalm.dev/193)
>
> I believe this issue is for the `phpDocumentor\Reflection\Utils` class and expects the `pregSplit()` method to apply input validation to the value received for `$flags` before passing it off to the PHP native `preg_split()` function.
>
> IMO that's taking things a little too far as PHP will handle this internally without errors.
> See: https://3v4l.org/NdDRK
2021-08-08 21:32:56 +02:00
jrfnl b7f9b17881 Psalm: suppress two notices
The current version of Psalm flags the following issues:
```
ERROR: InvalidReturnType - src\Utils.php:44:16 - The declared return type 'array<array-key, string>' for phpDocumentor\Reflection\Utils::pregSplit is incorrect, got 'list<list<int|string>|string>' (see https://psalm.dev/011)
     * @return string[] Returns an array containing substrings of subject split along boundaries matched by pattern

ERROR: InvalidReturnStatement - src\Utils.php:55:16 - The inferred type 'list<list<int|string>|string>' does not match the declared return type 'array<array-key, string>' for phpDocumentor\Reflection\Utils::pregSplit (see https://psalm.dev/128)
        return $parts;
```

I'm suggest ignoring this as `list` isn't an officially supported type.
2021-08-08 21:32:56 +02:00
jrfnl 7172d132a3 Tags/Return: remove redundant condition
Psalm flags this condition as redundant:
```
ERROR: RedundantCondition - src/DocBlock/Tags/Return_.php:62:48 - "" can never contain non-empty-lowercase-string (see https://psalm.dev/122)
        return $type . ($description !== '' ? ($type !== '' ? ' ' : '') . $description : '');
```

Based on the statement in the line above - `$type = $this->type ? '' . $this->type : 'mixed';` -, Psalm is correct and the `$type` variable can never be an empty string.
2021-08-08 21:32:56 +02:00
jrfnl f5118ce302 Tags::__toString(): remove redundant type casts
Psalm flags these type casts as redundant:
```
ERROR: RedundantCastGivenDocblockType - src/DocBlock/Tags/Author.php:80:23 - Redundant cast to string given docblock-provided type (see https://psalm.dev/263)
        $authorName = (string) $this->authorName;

ERROR: RedundantCastGivenDocblockType - src/DocBlock/Tags/Example.php:150:21 - Redundant cast to string given docblock-provided type (see https://psalm.dev/263)
        $filePath = (string) $this->filePath;

ERROR: RedundantCastGivenDocblockType - src/DocBlock/Tags/Link.php:74:17 - Redundant cast to string given docblock-provided type (see https://psalm.dev/263)
        $link = (string) $this->link;

ERROR: RedundantCastGivenDocblockType - src/DocBlock/Tags/Method.php:228:23 - Redundant cast to string given docblock-provided type (see https://psalm.dev/263)
        $methodName = (string) $this->methodName;
```

I have verified each and can confirm that these are redundant. They are probably a left-over from the time when the `__construct()` method in these classes did not yet have type declarations.
2021-08-08 21:32:55 +02:00
jrfnl 155efd647f Utils::pregSplit: limit is not nullable
Correctly flagged by Psalm:
```
ERROR: PossiblyNullArgument - src\Utils.php:50:53 - Argument 3 of preg_split cannot be null, possibly null value provided (see https://psalm.dev/078)
        $parts = php_preg_split($pattern, $subject, $limit, $flags);
```

The `$limit` argument of the PHP native `preg_split()` function is not nullable.

Ref: https://www.php.net/manual/en/function.preg-split
2021-08-08 21:32:50 +02:00
jrfnl 9ab603b069 Psalm: switch from Phive to Composer
This switches the installation method for Psalm from Phive to Composer, while still using a Phar file for running Psalm.

Includes:
* Removing Psalm from the Phive configuration.
* Adding Psalm to the Composer configuration. Includes upgrading from version `3.11.2` to version `4.8.1`.
* Adjusting the script used in the `Makefile`.
    👉 Please verify and test this as things work differently on different OS-es and this should work for you.
* Adjusting the GH Actions script to use the Composer installed version of Psalm.

Note: due to the committed `composer.lock` file, Psalm will not automatically upgrade when newer versions are available.

Refs:
* https://github.com/vimeo/psalm/releases
* https://github.com/psalm/phar/releases
2021-08-08 21:31:44 +02:00
Jaap van Otterdijk e45d003a09 Merge pull request #291 from jrfnl/feature/cs-update
CS update after upstream changes
2021-08-08 21:14:39 +02:00
jrfnl 19e97332e5 CS: miscellaneous other whitespace fixes 2021-08-08 19:41:03 +02:00
jrfnl 11315744bf CS: blank line between different use statement types 2021-08-08 19:41:03 +02:00
jrfnl a607236134 CS: no whitespace before return type colon 2021-08-08 19:41:03 +02:00
jrfnl 2a1aba8089 PHPCS ruleset: update ruleset for upstream changes
* Fix the name and description to prevent confusion between the project ruleset and the organisation ruleset.
* Set the minimum PHP version for the PHPCompatibility standard.
* Don't require property type declarations.
* Ensure special characters used as literals in an exclude pattern are escaped.
2021-08-08 19:41:03 +02:00
Jaap van Otterdijk dc7d72e47e Merge pull request #288 from jrfnl/feature/docblock-source-phpstan-fix
DocBlock/Tags/Source: remove redundant code
2021-08-06 11:57:03 +02:00
Jaap van Otterdijk 9381f67ecc Merge pull request #289 from jrfnl/feature/composer-fix-autoload-dev
Composer: fix `autoload-dev` directive
2021-08-06 11:34:27 +02:00
Jaap van Otterdijk 8c8deff92b Merge pull request #282 from jrfnl/feature/ghactions-switch-to-composer-cache-action
GH Actions: simplify Composer caching
2021-08-06 11:33:24 +02:00
Jaap van Otterdijk be1f0c122d Merge pull request #281 from jrfnl/feature/ghactions-allow-manual-triggering
GH Actions: allow for manually triggering a workflow
2021-08-06 11:31:46 +02:00
Jaap van Otterdijk 78dca37266 Merge pull request #285 from jrfnl/feature/tests-annotate-no-assertions
Tests: mark test without assertions as such
2021-08-01 22:21:35 +02:00
Jaap van Otterdijk d5fef100cc Merge pull request #286 from jrfnl/feature/tests-add-missing-coversnothing
Tests: fix missing `@covers` tag
2021-08-01 22:21:05 +02:00