Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arueckauer/strict-type-declaration-cs-issue
https://github.com/arueckauer/strict-type-declaration-cs-issue
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/arueckauer/strict-type-declaration-cs-issue
- Owner: arueckauer
- License: bsd-3-clause
- Created: 2020-08-29T08:44:02.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-09-02T07:56:55.000Z (over 4 years ago)
- Last Synced: 2024-12-24T05:31:50.307Z (7 days ago)
- Size: 7.81 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Strict Type Declaration CS issue
> Note: `config/development.config.php.dist` is a direct copy from the [Mezzio Skeleton](https://github.com/mezzio/mezzio-skeleton/blob/3.6.x/config/development.config.php.dist).
## Instructions
1. Copy `config/development.config.php.dist` to `config/development.config.php`
2. Run CS check: `./vendor/bin/phpcs`Result:
```powershell
C:\source\strict-type-declaration-cs-issue> .\vendor\bin\phpcs
E 1 / 1 (100%)FILE: config\development.config.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
24 | ERROR | [x] Wrong place of strict type declaration statement;
| | must be above comment
29 | ERROR | [x] Expected 24 spaces before double arrow; 1 found
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------Time: 347ms; Memory: 10MB
```3. Run CS fix: `./vendor/bin/phpcbf`
Result:
```powershell
C:\source\strict-type-declaration-cs-issue> .\vendor\bin\phpcbf
F 1 / 1 (100%)PHPCBF RESULT SUMMARY
----------------------------------------------------------------------
FILE FIXED REMAINING
----------------------------------------------------------------------
config\development.config.php 2 1
----------------------------------------------------------------------
A TOTAL OF 2 ERRORS WERE FIXED IN 1 FILE
----------------------------------------------------------------------Time: 476ms; Memory: 10MB
```
4. Run CS check again: `./vendor/bin/phpcs`
Result:
```powershell
C:\source\strict-type-declaration-cs-issue> .\vendor\bin\phpcs
E 1 / 1 (100%)FILE: config\development.config.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
5 | ERROR | The file-level docblock must follow the opening PHP tag
| | in the file header
----------------------------------------------------------------------Time: 340ms; Memory: 10MB
```5. Conclusion
Initially the CS shows the error:
> Wrong place of strict type declaration statement; must be above comment
`phpcbf` is able to fix it. But CS then shows a new error:
> The file-level docblock must follow the opening PHP tag in the file header