Skip to content

Commit

Permalink
Merge pull request #51 from fp4php/psalm-v5
Browse files Browse the repository at this point in the history
Psalm v5
  • Loading branch information
klimick authored May 22, 2023
2 parents 88630c5 + b0f74d2 commit d969485
Show file tree
Hide file tree
Showing 170 changed files with 960 additions and 7,066 deletions.
12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,15 @@ PHP Functional Programming library. Monads and common use functions.

### Composer

Supported installation method is via [composer](https://getcomposer.org):

```console
$ composer require fp4php/functional
```

### Enable psalm plugin (optional)

Read more about [plugin](doc/Psalm.md).
### Psalm integration

```console
$ composer require --dev fp4php/psalm-toolkit
$ vendor/bin/psalm-plugin enable fp4php/psalm-toolkit
$ vendor/bin/psalm-plugin enable fp4php/functional
```
Please refer to the [fp4php/functional-psalm-plugin](https://github.com/fp4php/functional-psalm-plugin) repository.

## Overview
Typesafe and concise.
Expand Down
32 changes: 32 additions & 0 deletions UPGRADING-v6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
## Update psalm to v5

Since fp4php/functional v6 Psalm integration ships as separate package.
Including the Psalm integration in the main fp4php/functional repository was a mistake.

For migration:

1. Remove old toolkit:

```shell
composer remove fp4php/psalm-toolkit
```

2. Install new psalm plugin:

```shell
composer require --dev fp4php/functional-psalm-plugin
```

3. Update psalm.xml:

```diff
<?xml version="1.0"?>
<psalm ...>
...
<plugins>
- <pluginClass class="Fp\Psalm\FunctionalPlugin"/>
- <pluginClass class="Fp\PsalmToolkit\Toolkit\Plugin"/>
+ <pluginClass class="Fp\PsalmPlugin\FunctionalPlugin"/>
</plugins>
</psalm>
```
10 changes: 6 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,26 @@
"ext-simplexml": "*"
},
"require-dev": {
"vimeo/psalm": "^4.23",
"vimeo/psalm": "^5.7",
"phpunit/phpunit": "^9",
"symfony/process": "^5.2",
"rregeer/phpunit-coverage-check": "^0.3.1",
"php-coveralls/php-coveralls": "~2.4.0",
"fp4php/psalm-toolkit": "dev-main"
"fp4php/psalm-toolkit": "dev-psalm-v5",
"fp4php/functional-psalm-plugin": "^1.0"
},
"autoload": {
"psr-4": {
"Fp\\Operations\\": "src/Fp/Operations",
"Fp\\Collections\\": "src/Fp/Collections",
"Fp\\Streams\\": "src/Fp/Streams",
"Fp\\Functional\\": "src/Fp/Functional",
"Fp\\Psalm\\": "src/Fp/Psalm"
"Fp\\Functional\\": "src/Fp/Functional"
},
"files": [
"src/Fp/Functions/Callable/Ctor.php",
"src/Fp/Functions/Callable/ToSafeClosure.php",
"src/Fp/Functions/Callable/DropFirstArg.php",
"src/Fp/Functions/Callable/Pipe.php",
"src/Fp/Functions/Callable/Compose.php",
"src/Fp/Functions/Callable/Partial.php",
"src/Fp/Functions/Callable/PartialLeft.php",
Expand Down Expand Up @@ -98,6 +99,7 @@
"src/Fp/Functions/Evidence/ProveObject.php",
"src/Fp/Functions/Evidence/ProveOf.php",
"src/Fp/Functions/Evidence/ProveString.php",
"src/Fp/Functions/Util/ToString.php",
"src/Fp/Functions/Util/JsonDecode.php",
"src/Fp/Functions/Util/RegExp.php",
"src/Fp/Functions/Util/Writeln.php",
Expand Down
62 changes: 10 additions & 52 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -1,69 +1,27 @@
<?xml version="1.0"?>
<psalm
errorLevel="1"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
findUnusedPsalmSuppress="true"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<psalm errorLevel="1"
findUnusedBaselineEntry="false"
findUnusedCode="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
findUnusedPsalmSuppress="true"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd">
<projectFiles>
<directory name="src"/>
<directory name="tests"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>
</projectFiles>
<plugins>
<pluginClass class="Fp\Psalm\FunctionalPlugin"/>
<pluginClass class="Fp\PsalmToolkit\Toolkit\Plugin"/>
</plugins>
<issueHandlers>
<Trace errorLevel="error"/>
<DeprecatedMethod errorLevel="suppress">
<errorLevel type="suppress">
<directory name="tests"/>
</errorLevel>
</DeprecatedMethod>
<UnusedVariable errorLevel="suppress">
<errorLevel type="suppress">
<directory name="src/Fp/Functions"/>
</errorLevel>
</UnusedVariable>
<DuplicateFunction errorLevel="suppress">
<errorLevel type="suppress">
<directory name="src/Fp/Functions"/>
</errorLevel>
</DuplicateFunction>
<PropertyNotSetInConstructor errorLevel="suppress">
<errorLevel type="suppress">
<directory name="tests"/>
</errorLevel>
</PropertyNotSetInConstructor>
<DuplicateClass errorLevel="suppress">
<errorLevel type="suppress">
<directory name="src/Fp/Functional"/>
</errorLevel>
</DuplicateClass>
<InternalMethod errorLevel="suppress">
<errorLevel type="suppress">
<directory name="src/Fp/Psalm"/>
</errorLevel>
</InternalMethod>
<InternalClass errorLevel="suppress">
<errorLevel type="suppress">
<directory name="src/Fp/Psalm"/>
</errorLevel>
</InternalClass>
<InternalProperty errorLevel="suppress">
<errorLevel type="suppress">
<directory name="src/Fp/Psalm"/>
</errorLevel>
</InternalProperty>
<UnusedClosureParam errorLevel="suppress"/>
<UnusedMethodCall errorLevel="suppress">
<errorLevel type="suppress">
<directory name="tests"/>
</errorLevel>
</UnusedMethodCall>
</issueHandlers>
<plugins>
<pluginClass class="Fp\PsalmPlugin\FunctionalPlugin"/>
</plugins>
</psalm>
Loading

0 comments on commit d969485

Please sign in to comment.