Comments (19)
Same issue. When running with verbose -v
option I see that problem happens when tool hits certain layout.blade.php
file.
from phpinsights.
I had a look through the slevomat/coding-standard
package code, and this appears to be to do with php files which do not contain a full opening tag <?php
.
I ran insights and found it failed on a template file of mine which contained a short <?=
tag, but no full tag, and it failed with this error. I then added a full tag at the start of the file and then closed it immediately (an empty php block) and insights then failed with the same error on the next template it found.
from phpinsights.
This issue has been fixed on the version v1.8.1
.
from phpinsights.
^ I hit the same error as @jadamec after updating to 1.8.1
from phpinsights.
@jadamec @michaeldyrynda Can you try again with v1.9.0
?
from phpinsights.
Yes, short tag is likely explanation.
In my case template contained some legacy spaghetti code such as:
<?=(preg_match(PRIVILEGES['something'],$user['privileges'])?'<a href="..">aa</a>':'')?>
Does this tool understand .blade.php files anyway? I could not get my head around if there is a way to exclude some file name patterns / directories. If not, there should be.
from phpinsights.
The folder resources
is ignored on the Laravel preset, so your blade views should be ignored. No?
from phpinsights.
Oh, sorry. My project is not Laravel, just blade template component, so the path is different.
I will have to learn how to create project settings/presets. :)
from phpinsights.
You just have to: cp vendor/nunomaduro/phpinsights/stubs/config.php phpinsights.php
, than add the blade folder to the exclude
key.
from phpinsights.
Actually, we should exclude all *.blade.php
extensions. Can someone do a pull request on this? Here is the file: https://github.com/nunomaduro/phpinsights/blob/master/src/Infrastructure/Repositories/LocalFilesRepository.php
Don't forget to add tests on this.
from phpinsights.
For me it was jquery.repeater in node_modules. Luckily I don't really need it so just removed it.
from phpinsights.
@TheFrankman Hmm that's weird, we should be ignoring node_modules
.
from phpinsights.
@olivernybroe I wouldn't concern yourself too much with it, It might be down to a theme that we are importing, it's a rather unusual laravel installation.
from phpinsights.
λ php artisan insights
?[2K 53/65 [======================>-----] 81%
?[41;1m Symfony\Component\Debug\Exception\FatalThrowableError ?[49;22m : ?[33mArgument 1 passed to NunoMaduro\PhpInsights\Doma
in\File::resolveFullyQualifiedCode() must be of the type string, int given, called in C:\Users\jadam\bsgup\vendor\nunomaduro\php
insights\src\Domain\File.php on line 191?[39m
at ?[32mC:\Users\jadam\bsgup\vendor\nunomaduro\phpinsights\src\Domain\File.php?[39m:?[32m222?[39m
218| * @param string $sniffClassOrCode
219| *
220| * @return string
221| */
> 222| private function resolveFullyQualifiedCode(string $sniffClassOrCode): string
223| {
224| if (class_exists($sniffClassOrCode)) {
225| return $sniffClassOrCode;
226| }
?[33mException trace:?[39m
?[36m1 ?[39m?[33mNunoMaduro\PhpInsights\Domain\File::resolveFullyQualifiedCode()?[39m
?[32mC:\Users\jadam\bsgup\vendor\nunomaduro\phpinsights\src\Domain\File.php?[39m:?[32m191?[39m
?[36m2 ?[39m?[33mNunoMaduro\PhpInsights\Domain\File::addMessage("Unparsable php code: syntax error or wrong phpdocs.", [])?[
39m
?[32mC:\Users\jadam\bsgup\vendor\squizlabs\php_codesniffer\src\Files\File.php?[39m:?[32m663?[39m
?[32mPlease use the argument ?[39m?[31m-v?[39m?[32m to see more details.?[39m
from phpinsights.
@jadamec @michaeldyrynda Can you try again with
v1.9.0
?
Works now, great! Thank you.
from phpinsights.
I did get a notice with 1.9, but it finished running.
from phpinsights.
@michaeldyrynda Could you share the notice, having some difficulties reproducing it.
from phpinsights.
PHP Notice: Undefined offset: 0 in /Users/mdyrynda/code/crm/vendor/slevomat/coding-standard/SlevomatCodingStandard/Helpers/UseStatementHelper.php on line 147
from phpinsights.
@michaeldyrynda Thanks. Found the cause.
PR #253 should silence the php messages
from phpinsights.
Related Issues (20)
- Github actions skips config file HOT 1
- Configure insights (dokumentation)
- Configured excludes are ignored when specifying paths in the command
- Is there any sniff available for valid variable name when preset is Laravel
- DisallowedShortTernaryOperator suppress doesnt work
- How to add and config a PHP CS Fixer?
- Replace PHP cs fixer to Laravel pint? HOT 2
- Differences between switch and match sentences, impact on Cyclomatic Complexity HOT 5
- Provided files are ignored
- Support Symfony 7 HOT 4
- Add links to details or examples
- Ordered imports verification is incorrect
- Parameter type hint: Unparsable php code
- PHP CodeSniffer alternative HOT 2
- I am getting timeout error. Please guide me solution. HOT 2
- Laravel Lumen Error while running "php artisan insights" HOT 1
- Deprecated creation of dynamic property in SniffLoader
- Can not ignore SlevomatCodingStandard\Sniffs\Functions\FunctionLengthSniff
- Cannot install on laravel project based on php 8.3.4 | Your requirements could not be resolved to an installable set of packages. HOT 2
- Can't use with PHPUnit 11
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 phpinsights.