-
Notifications
You must be signed in to change notification settings - Fork 11.5k
Closed
Description
Laravel Version
10.4.1
PHP Version
8.1.4
Database Driver & Version
No response
Description
Description
The Illuminate\Support\Str::is()
method internally uses Arr::wrap()
on the $pattern
argument, which allows it to accept both a single string and an array of strings as a pattern.
However, the current PHPDoc block for the method only specifies string
for the $pattern
parameter.
/**
* Determine if a given string matches a given pattern.
*
* @param string $pattern
* @param string $value
* @return bool
*/
### Steps To Reproduce
This can be misleading for developers who rely on IDE type-hinting and static analysis, as it doesn't reflect the method's full capability.
Of course. Here is a step-by-step guide on how to raise this specific issue on GitHub.
Step 1: Go to the "Issues" Tab
First, you need a GitHub account. Once you are logged in, navigate to the Laravel framework's GitHub repository and click on the Issues tab.
Direct Link: https://github.com/laravel/framework/issues
Step 2: Create a New Issue
On the top-right of the issues page, you will see a green button that says "New issue". Click on it.
Step 3: Choose an Issue Template
Laravel provides templates to help you structure your report. For this type of problem, the "Bug report" template is the most appropriate choice. Click the "Get started" button next to it.
Step 4: Fill Out the Issue Form
Now, you'll see a form with a title and a large text box for the description. This is where you'll provide the details.
1. Title:
Copy and paste this into the "Title" field. It's clear and concise.
PHPDoc for Str::is() is incomplete
2. Description:
Delete the placeholder text in the description box and paste the following content. It's written in Markdown, which will format correctly on GitHub.
Markdown
### Description
The `Illuminate\Support\Str::is()` method internally uses `Arr::wrap()` on the `$pattern` argument, which allows it to accept both a single string and an array of strings as a pattern.
However, the current PHPDoc block for the method only specifies `string` for the `$pattern` parameter.
```php
/**
* Determine if a given string matches a given pattern.
*
* @param string $pattern
* @param string $value
* @return bool
*/
## The Problem
This can be misleading for developers who rely on IDE type-hinting and static analysis, as it doesn't reflect the method's full capability.
## Suggested Solution
The PHPDoc @param tag for $pattern should be updated to reflect that it also accepts an array of strings.
## Suggested Change:
- * @param string $pattern
+ * @param string|string[] $pattern
This will improve code clarity and the developer experience.
Metadata
Metadata
Assignees
Labels
No labels