forked from php-embed/Embed
-
Notifications
You must be signed in to change notification settings - Fork 0
Add PHPStan Static Analysis (Level Max + Strict Rules) #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
248f26f
feat: add PHPStan.
uzulla 0e5d3ae
feat: improve type safety with PHPStan (590→0 errors)
uzulla ff5d41a
fix(PHPStan): store result of mb_encoding_aliases() for PHPStan warn.
uzulla efa32ce
feat: refactor Extractor classes to improve constructor dependency in…
uzulla 783e7c2
refactor: improve empty string handling in adapter detectors for PHPS…
uzulla c14275a
fix: correct variable usage for extractor in AuthorUrl class
uzulla c128a80
fix: prevent meaningless ratio calculation for zero height in EmbedCode
uzulla a386551
test: use assertEqualsWithDelta for ratio calculations in EmbedCodeTest
uzulla fc1a6c9
fix: enhance owner and username checks to prevent empty string handli…
uzulla 22de3cc
refactoring: improve token validation in OEmbed class to ensure prope…
uzulla cfa2b6d
refactoring: improve readable code.
uzulla 77bf186
fix: ensure empty strings fallback to next metadata source in detectors
uzulla feaecea
fix: add unit tests for AuthorUrl detectors handling empty and zero s…
uzulla 6bb8de9
fix: add trim() to adapter detectors for consistent whitespace handling
uzulla 9a85f3f
Ignoring argument type
Vitorinox File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| includes: | ||
| - vendor/phpstan/phpstan-strict-rules/rules.neon | ||
|
|
||
| parameters: | ||
| level: max | ||
| paths: | ||
| - src | ||
| # - tests | ||
| excludePaths: | ||
| - tests/cache | ||
| - tests/fixtures | ||
| checkMissingCallableSignature: true | ||
| checkUninitializedProperties: true | ||
| checkTooWideReturnTypesInProtectedAndPublicMethods: true | ||
| checkImplicitMixed: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,20 +4,35 @@ | |
| namespace Embed\Adapters\Archive; | ||
|
|
||
| use Embed\Extractor as Base; | ||
| use Embed\Http\Crawler; | ||
| use Psr\Http\Message\RequestInterface; | ||
| use Psr\Http\Message\ResponseInterface; | ||
| use Psr\Http\Message\UriInterface; | ||
|
|
||
| class Extractor extends Base | ||
| { | ||
| private Api $api; | ||
|
|
||
| public function __construct( | ||
| UriInterface $uri, | ||
| RequestInterface $request, | ||
| ResponseInterface $response, | ||
| Crawler $crawler | ||
| ) { | ||
| parent::__construct($uri, $request, $response, $crawler); | ||
| $this->api = new Api($this); | ||
|
Owner
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Avoid uninitialized |
||
| } | ||
|
|
||
| public function getApi(): Api | ||
| { | ||
| return $this->api; | ||
| } | ||
|
|
||
| /** | ||
| * @return array<string, \Embed\Detectors\Detector> | ||
| */ | ||
| public function createCustomDetectors(): array | ||
| { | ||
| $this->api = new Api($this); | ||
|
|
||
| return [ | ||
| 'title' => new Detectors\Title($this), | ||
| 'description' => new Detectors\Description($this), | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.