Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
!!! Allow plugins to modify Config::$fileExtensions early
ProjectAnalyzer consumed Config::$fileExtensions early in its constructor - without having processed plugins' modifications, registering their custom scanners or analyzer implementations. This change * adds new specific interface \Psalm\Plugin\FileExtensionsInterface to be used by plugin implementations * extracts file extension handling from \Psalm\PluginRegistrationSocket and interface \Psalm\Plugin\RegistrationInterface to a new dedicated \Psalm\PluginFileExtensionsSocket and new interface \Psalm\Plugin\FileExtensionsInterface !!! this is a breaking change in PluginRegistrationSocket !!! * adds runtime in-memory cache for Config::$plugins * calls new method Config::processPluginFileExtensions(), providing modifications to file extension only early in ProjectAnalyzer * adjusts documentation
- Loading branch information
Showing
13 changed files
with
299 additions
and
194 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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,20 @@ | ||
<?php | ||
namespace Psalm\Plugin; | ||
|
||
use Psalm\Internal\Analyzer\FileAnalyzer; | ||
use Psalm\Internal\Scanner\FileScanner; | ||
|
||
interface FileExtensionsInterface | ||
{ | ||
/** | ||
* @param string $fileExtension e.g. `'html'` | ||
* @param class-string<FileScanner> $className | ||
*/ | ||
public function addFileTypeScanner(string $fileExtension, string $className): void; | ||
|
||
/** | ||
* @param string $fileExtension e.g. `'html'` | ||
* @param class-string<FileAnalyzer> $className | ||
*/ | ||
public function addFileTypeAnalyzer(string $fileExtension, string $className): void; | ||
} |
This file contains 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 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,12 @@ | ||
<?php | ||
namespace Psalm\Plugin; | ||
|
||
use SimpleXMLElement; | ||
|
||
interface PluginFileExtensionsInterface extends PluginInterface | ||
{ | ||
public function processFileExtensions( | ||
FileExtensionsInterface $fileExtensions, | ||
?SimpleXMLElement $config = null | ||
): void; | ||
} |
This file contains 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,6 @@ | ||
<?php | ||
namespace Psalm\Plugin; | ||
|
||
interface PluginInterface | ||
{ | ||
} |
This file contains 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.