Comments (5)
Hi,
I take this issue, can you assign to me please @villfa ?
Thanks :)
from codor.
To run a specific test file, use this command:
vendor/bin/simple-phpunit --debug tests/Sniffs/Files/ReturnNullSniffTest.php
To reproduce the problem you have to write a new test.
You could add a new method by duplicating the existing one and then modifying it as you need.
You can also use the code snippet from my previous comment by creating a new file in this folder: https://github.com/bmitch/Codor/tree/be85e18/tests/Sniffs/Files/Assets/ReturnNullSniff
from codor.
This problem is not specific to Laravel.
Here an example to reproduce it:
<?php
class Foo
{
public function filter(array $items): array
{
return array_filter($items, function ($item) {
return $item !== null;
});
}
}
And the error message:
---------------------------------------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 1 LINE
---------------------------------------------------------------------------------------------------
7 | ERROR | Return null value found.
| | (Codor.Files.ReturnNull.Codor\Sniffs\Files\ReturnNullSniff)
7 | ERROR | Return null value found.
| | (Codor.Files.ReturnNull.Codor\Sniffs\Files\ReturnNullSniff)
---------------------------------------------------------------------------------------------------
According this message the problem comes from ReturnNullSniff.
from codor.
Hello,
Question please when i run test to try to reproduce problem
composer test tests/Sniffs/Files/ReturnNullSniffTest.php
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
23 | ERROR | Method name
| | "ReturnNullSniffTest::it_detects_functions_that_return_null"
| | is not in camel caps format
| | (PSR1.Methods.CamelCapsMethodName.NotCamelCaps)
----------------------------------------------------------------------
How to test and reproduce problem in local please?
Thanks
from codor.
Fixed with Codor 1.2.2
from codor.
Related Issues (20)
- Detect duplicate array elements
- Add Sniff to check for the use of instance of function HOT 1
- Add churn-php
- Add instanceof to list of forbidden functions
- PropertyDeclarationSniff bug? HOT 2
- Sniff to prevent `mixed` type hints and return types?
- Sniff to disallow set methods.
- A more gentle class line count sniff HOT 2
- Sniff to prevent customizable list of static method calls.
- Add a "downloads" badge HOT 5
- Add section in the readme or contributing about how to run tests. HOT 1
- MixedReturnTypeSniff - Check for `comment_opener` index before assuming it is there.
- Update `code_sniffer` version up to ^3.* HOT 3
- Typo `ternery` should be `ternary`
- composer.json is not strictly valid
- Undefined array index when a function is after a class
- Available for php8 HOT 3
- What issue choice for contribution? HOT 3
- Upgrade to php8.1 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codor.