Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save olleolleolle/560530 to your computer and use it in GitHub Desktop.
Save olleolleolle/560530 to your computer and use it in GitHub Desktop.
Deprecations checker: A PHP Bundle script that I put on Ctrl-Shift-V (as a second PHP validation). Will jump to the line of the first reported error.
#!/usr/bin/env ruby
#
# Uses Stas Malyshev's migrate.php script to check code style
#
require ENV['TM_SUPPORT_PATH'] + '/lib/textmate'
version = %x{#{ENV['TM_PHP'] || 'php'} -v}.split[0..2].join(' ')
result = `#{ENV['TM_PHP'] || 'php'} /Users/olle/opensource/php/migrate/migrate.php '#{ENV['TM_FILEPATH']}'`
result.gsub!("in file #{ENV['TM_FILEPATH']}", '')
puts "OK!" if result.empty?
puts result
TextMate.go_to :line => $1 if result =~ /line (\d+)/
@olleolleolle
Copy link
Author

Just open the Bundle Editor, and duplicate the "Validate Syntax" item, then empty the big text box, and replace it with the above script. Change my migrate.php path, and you're good to go.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment